Skip to content

Commit

Permalink
Fix clip visiting in animation controller; fix typo (cocos#15791)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit authored Jul 21, 2023
1 parent 9cffcaa commit 775b794
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion editor/src/marionette/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class AnimationGraphPartialPreviewer {

const bindingContext = new AnimationGraphBindingContext(
this._root, this._poseLayoutMaintainer, this._varInstances, this._dummyAnimationController,
new EventTarget(),
);

poseLayoutMaintainer.startBind();
Expand Down
15 changes: 13 additions & 2 deletions editor/src/marionette/visit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { PoseNodeStateMachine } from '../../../cocos/animation/marionette/pose-g
import { PoseNodePlayMotion } from "../../../cocos/animation/marionette/pose-graph/pose-nodes/play-motion";
import { PoseNodeSampleMotion } from "../../../cocos/animation/marionette/pose-graph/pose-nodes/sample-motion";
import { PoseGraph } from "../../../cocos/animation/marionette/pose-graph/pose-graph";
import { AnimationGraphVariant } from "../../../cocos/animation/marionette/animation-graph-variant";

export function* visitAnimationGraphEditorExtras(animationGraph: AnimationGraph): Generator<EditorExtendableObject> {
for (const layer of animationGraph.layers) {
Expand Down Expand Up @@ -112,7 +113,17 @@ export function* visitAnimationClipsInController(animationController: AnimationC
const {
graph,
} = animationController;
if (graph) {
yield* visitAnimationClips(graph as AnimationGraph);
if (graph instanceof AnimationGraph) {
yield* visitAnimationClips(graph);
} else if (graph instanceof AnimationGraphVariant) {
const {
original,
clipOverrides,
} = graph;
if (original) {
for (const clip of visitAnimationClips(original)) {
yield clipOverrides.get(clip) ?? clip;
}
}
}
}

0 comments on commit 775b794

Please sign in to comment.