Skip to content

[break] fix(animation): separate scene dirty state from clip dirty state - #822

Open
knoxHuang wants to merge 4 commits into
cocos:mainfrom
knoxHuang:codex/animation-dirty-state-separation
Open

[break] fix(animation): separate scene dirty state from clip dirty state#822
knoxHuang wants to merge 4 commits into
cocos:mainfrom
knoxHuang:codex/animation-dirty-state-separation

Conversation

@knoxHuang

@knoxHuang knoxHuang commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📌 Background

Animation Editor edits are scoped to an Animation Clip, but the previous dirty-state reporting and save behavior could treat the shared scene undo state as the clip state. This made it difficult for the host editor to distinguish unsaved clip changes from unsaved scene changes and could route Animation Editor saves through scene saving.

✨ Changes

  • Expose sceneDirty separately from Animation Clip dirty in IAnimationStateInfo.
  • Calculate scene dirty state from the active animation session baseline while excluding the current animation scope.
  • Keep Animation Clip saves isolated from Scene saves.
  • Support saving a clip copy to an explicit target path for Animation Clip Save As without saving the Scene.
  • Report whether a successful animation operation actually recorded animation-scoped Undo history.
  • Keep successful no-history operations distinguishable from history-producing operations.
  • Add regression coverage for independent dirty-state reporting, regular clip saves, target saves, animation-session refresh behavior, and undo-history reporting.

💡 Design Notes

sceneDirty is owned by the Animation service because it depends on the active animation session, its entry baseline, and the animation undo scope. The generic Undo service remains generic; the Animation service exposes the scope-aware result through animation.query-state().

The Animation service is also the source of truth for whether an operation pushed animation-scoped Undo history; consumers must not infer this from operation success alone.

🧪 QA Steps

  1. Open a scene containing an editable animation clip and enter the Animation Editor.
  2. Change a keyframe, then focus the Scene View and choose Save. Verify that the Animation Clip is saved while the Scene is not saved through the Scene save path.
  3. Make another animation edit, focus the Animation Editor, and choose Save. Verify that the Animation Clip is saved and the Scene save path is not invoked.
  4. Use Save As from the Animation Editor and choose an .anim target. Verify that a clip asset is created at the selected target and the Scene is not saved.
  5. Leave the Animation Editor or refresh it with a dirty Scene. Verify that the existing Scene dirty-save behavior still applies during exit/refresh.
  6. In a PinK integration that consumes the new result, apply an animation operation that produces no change or disables Undo recording. Verify that a subsequent Undo does not revert an earlier unrelated edit.

Risks

Focused CLI validation passed: 2 suites and 26 tests for the dirty-state/save behavior. Focused coverage for the newly included undo-history contract is blocked locally because the installed native gl binary was built for a different Node.js ABI; full-suite CI validation is still required.

@knoxHuang knoxHuang changed the title fix(animation): separate scene dirty state from clip dirty state [break] fix(animation): separate scene dirty state from clip dirty state Aug 4, 2026
@knoxHuang
knoxHuang force-pushed the codex/animation-dirty-state-separation branch from 2addb85 to 7b4308f Compare August 4, 2026 10:00
@knoxHuang
knoxHuang force-pushed the codex/animation-dirty-state-separation branch from 6436ea4 to ad6a305 Compare August 6, 2026 02:31
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.

2 participants