Skip to content

Preserve runtime animation layers on first assignment - #10132

Open
Harrison0223-svg wants to merge 2 commits into
playcanvas:mainfrom
Harrison0223-svg:fix/preserve-anim-layers-on-first-assignment
Open

Harrison0223-svg wants to merge 2 commits into
playcanvas:mainfrom
Harrison0223-svg:fix/preserve-anim-layers-on-first-assignment

Conversation

@Harrison0223-svg

Copy link
Copy Markdown

Description

Refs #6390 (first issue only).

If addLayer() runs before the first component-level assignAnimation(), the generated Base graph can replace the existing layer array while leaving its name lookup pointing at the wrong layer. The first assignment now preserves existing runtime layers, their order, and routing. Assigning first on an empty component still creates the normal Base layer.

The generated graph is tagged separately from an authored empty graph because they mean different things: the former is metadata for layers created at runtime; the latter explicitly describes a graph with no layers. Reloading the component’s own generated graph therefore keeps its existing layers and tracks, while loading another graph or reloading an authored graph follows the normal replace path.

The separate additive-layer symptom in #6390 is out of scope. Directly assigned tracks were already lost on clone on the tested main baseline; this PR does not change that behavior.

Validation

  • Added regression cases for first assignment with an existing layer, same generated graph reload (including after an asset-backed clone), replacing it with an explicit empty graph, and reloading an authored graph.
  • Same component suite on the preceding patch: 45 passed, 2 failed; on this revision: 47 passed. Animation suite: 221 passed.
  • On this fork head, npm test with native Canvas: 4,991 passed, 50 pending, 0 failed. Lint, type generation, and type tests passed.

AI-assisted implementation and testing. Scope and results refer to this revision.

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

Do not replace layers already created by addLayer when implicitly assigning an animation. Preserve their order, identity and named routing. Keep the original empty-component Base behavior.

Refs playcanvas#6390 (layer loss only; additive scaling excluded). AI-assisted implementation and testing with OpenAI Codex.
Distinguish implicitly generated runtime metadata from authored graphs and guard only same-object reloads. Test runtime reload, clone reload and explicit graph replacement separately.

Refs playcanvas#6390. AI-assisted implementation and testing with OpenAI Codex.
@Harrison0223-svg

Copy link
Copy Markdown
Author

Chrome 158 on Apple Silicon, automated verification by OpenAI Codex. At d6e3a1c, Locomotion/Walk and UpperBody/Wave kept their layer objects and active states across first assignment and a reload of the generated graph. Explicitly loading a separate empty graph cleared both layers. The base lost the runtime layers on first assignment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant