1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2026-10-10 04:53:15 +08:00

Append new animations instead of discarding the previous ones when refreshing the animators.

This commit is contained in:
originalnicodr
2024-06-12 19:00:19 -03:00
parent 448ab66f5b
commit 171ee3f0d8
+9 -1
View File
@@ -68,8 +68,16 @@ namespace UnityExplorer.UI.Panels
{
if (animators[i].animator.wrappedObject != null){
int newAnimatorsIndex = newAnimators.FindIndex(a => a.animator.wrappedObject == animators[i].animator.wrappedObject);
if (newAnimatorsIndex != -1)
if (newAnimatorsIndex != -1) {
// If refreshing the animator gives us new animations, add them to the already existing ones.
// Might break stuff.
foreach (IAnimationClip animationClip in newAnimators[newAnimatorsIndex].animations) {
// TODO: Refactor AnimatorPlayer.animations from List<IAnimationClip> to HashSet<IAnimationClip> to avoid checking this
if (!animators[i].animations.Contains(animationClip))
animators[i].animations.Add(animationClip);
}
newAnimators[newAnimatorsIndex] = animators[i];
}
}
}
animators = newAnimators;