Fix duplicate display name for aliased animation clips - #1247
Merged
Merged
Conversation
registerRuntimeAnimationClips registers a single-clip asset under both its embedded name and the caller's preferred name when they differ, pointing both keys at the same AnimationClip so changeAnimation keeps working with either. getAllAnimationClips and removeAnimationClip treated every key as an independent clip, so the editor listed one animation twice and removing one name could leave the other dangling. AnimationComponent now tracks which keys are internal aliases so getAllAnimationClips reports the preferred name once, and removeAnimationClip removes every key sharing the same clip identity. Re-registering a preferred name against a clip with a different embedded name (asset re-export) prunes the old clip's stale alias too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
registerRuntimeAnimationClipsregisters a single-clip asset under both its embedded name (e.g.Anim) and the caller's preferred filename-derived name (e.g.hol_idle_anim) when they differ, pointing both keys at the sameAnimationClipinstance sochangeAnimationkeeps working with either name.getAllAnimationClips/removeAnimationCliptreated every dictionary key as an independent clip, so the editor listed one logical animation twice, and removing one name could leave the other dangling.AnimationComponentnow tracks which keys are internal aliases (hiddenClipAliases) sogetAllAnimationClipsreports one display name per logical clip (the preferred name), andremoveAnimationClipremoves every key sharing the same clip identity.changeAnimationand other lookups are unaffected: both names remain live keys inanimationClips, preserving backward compatibility.Test plan
Tests/UntoldEngineTests/AnimationClipAliasTests.swift(11 tests) covering: alias creation/skip, multi-clip assets, independently-exported clips sharing an embedded name, re-registration/replacement pruning, removal cascading via either name, and engine-levelchangeAnimation/getAllAnimationClips/removeAnimationClipthrough aliases.swift test --filter Animation— all suites pass (98 + 9 tests, 0 failures).swift build— clean build.