mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
validate animation state in editor (#3027)
This commit is contained in:
@@ -274,8 +274,10 @@ function refreshScene () {
|
||||
if (nowPreviewing) {
|
||||
animationState.animatedSinceLastFrame = true;
|
||||
let component = cc.engine.getInstanceById(AnimUtils.Cache.component);
|
||||
let animation = component.getAnimationState(AnimUtils.Cache.animation);
|
||||
animationState.time = animation.time;
|
||||
if (component) {
|
||||
let animation = component.getAnimationState(AnimUtils.Cache.animation);
|
||||
animationState.time = animation.time;
|
||||
}
|
||||
}
|
||||
else {
|
||||
animationState.animatedSinceLastFrame = false;
|
||||
@@ -283,10 +285,12 @@ function refreshScene () {
|
||||
}
|
||||
else if (nowPreviewing) {
|
||||
let component = cc.engine.getInstanceById(AnimUtils.Cache.component);
|
||||
let animation = component.getAnimationState(AnimUtils.Cache.animation);
|
||||
if (animationState.time !== animation.time) {
|
||||
animationState.animatedSinceLastFrame = true;
|
||||
animationState.time = AnimUtils.Cache.animation.time;
|
||||
if (component) {
|
||||
let animation = component.getAnimationState(AnimUtils.Cache.animation);
|
||||
if (animationState.time !== animation.time) {
|
||||
animationState.animatedSinceLastFrame = true;
|
||||
animationState.time = AnimUtils.Cache.animation.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,18 +311,20 @@ function refreshScene () {
|
||||
(AnimUtils = Editor.require('scene://utils/animation')) &&
|
||||
AnimUtils.Cache.animation) {
|
||||
var editingNode = cc.engine.getInstanceById(AnimUtils.Cache.rNode);
|
||||
for (i = activeWidgets.length - 1; i >= 0; i--) {
|
||||
widget = activeWidgets[i];
|
||||
var node = widget.node;
|
||||
if (widget.alignMode !== AlignMode.ALWAYS &&
|
||||
animationState.animatedSinceLastFrame &&
|
||||
node.isChildOf(editingNode)
|
||||
) {
|
||||
// widget contains in activeWidgets should aligned at least once
|
||||
widget.enabled = false;
|
||||
}
|
||||
else {
|
||||
align(node, widget);
|
||||
if (editingNode) {
|
||||
for (i = activeWidgets.length - 1; i >= 0; i--) {
|
||||
widget = activeWidgets[i];
|
||||
var node = widget.node;
|
||||
if (widget.alignMode !== AlignMode.ALWAYS &&
|
||||
animationState.animatedSinceLastFrame &&
|
||||
node.isChildOf(editingNode)
|
||||
) {
|
||||
// widget contains in activeWidgets should aligned at least once
|
||||
widget.enabled = false;
|
||||
}
|
||||
else {
|
||||
align(node, widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user