From fa936a958087e4408ae8ae9284208c6e935bd282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Thu, 8 Jun 2023 17:40:26 +0800 Subject: [PATCH] Marionette: fix animation blend 2d algorithm type is not setup correctly (#15377) --- cocos/animation/marionette/animation-graph.ts | 2 ++ cocos/animation/marionette/motion/animation-blend-2d.ts | 8 ++++++++ cocos/animation/marionette/motion/motion.ts | 6 ++++++ cocos/animation/marionette/state-machine/motion-state.ts | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/cocos/animation/marionette/animation-graph.ts b/cocos/animation/marionette/animation-graph.ts index 58f745422f..280fae8887 100644 --- a/cocos/animation/marionette/animation-graph.ts +++ b/cocos/animation/marionette/animation-graph.ts @@ -305,6 +305,8 @@ export class StateMachine extends EditorExtendable { state.stateMachine.__callOnAfterDeserializeRecursive(); } else if (state instanceof ProceduralPoseState) { state.__callOnAfterDeserializeRecursive(); + } else if (state instanceof MotionState) { + state.__callOnAfterDeserializeRecursive(); } } } diff --git a/cocos/animation/marionette/motion/animation-blend-2d.ts b/cocos/animation/marionette/motion/animation-blend-2d.ts index e7e164c3fc..debd06fd38 100644 --- a/cocos/animation/marionette/motion/animation-blend-2d.ts +++ b/cocos/animation/marionette/motion/animation-blend-2d.ts @@ -96,6 +96,14 @@ export class AnimationBlend2D extends AnimationBlend { this._tryReconstructPolarSpaceInterpolator(); } + /** + * // TODO: HACK + * @internal + */ + __callOnAfterDeserializeRecursive () { + this._tryReconstructPolarSpaceInterpolator(); + } + public clone () { const that = new AnimationBlend2D(); this.copyTo(that); diff --git a/cocos/animation/marionette/motion/motion.ts b/cocos/animation/marionette/motion/motion.ts index 617be6bd31..f8d7871868 100644 --- a/cocos/animation/marionette/motion/motion.ts +++ b/cocos/animation/marionette/motion/motion.ts @@ -74,6 +74,12 @@ export abstract class Motion extends EditorExtendable { ): MotionEval | null; abstract clone(): Motion; + + /** + * // TODO: HACK + * @internal + */ + __callOnAfterDeserializeRecursive () { } } export interface MotionPort { diff --git a/cocos/animation/marionette/state-machine/motion-state.ts b/cocos/animation/marionette/state-machine/motion-state.ts index 9b4ac33d13..b86fbae0d4 100644 --- a/cocos/animation/marionette/state-machine/motion-state.ts +++ b/cocos/animation/marionette/state-machine/motion-state.ts @@ -62,6 +62,14 @@ export class MotionState extends InteractiveState { @editable public transitionOutEventBinding = new AnimationGraphEventBinding(); + /** + * // TODO: HACK + * @internal + */ + __callOnAfterDeserializeRecursive () { + this.motion?.__callOnAfterDeserializeRecursive(); + } + public copyTo (that: MotionState) { super.copyTo(that); that.motion = this.motion?.clone() ?? null;