From 81b044dfde2a9adfa69841f02cb89e3041f8a758 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 8 Dec 2024 15:43:55 +0900 Subject: [PATCH 1/2] fix: Errors if exactly same AnimatorController is specified for playable layers --- Editor/Processors/InitializeAnimatorOptimizer.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Editor/Processors/InitializeAnimatorOptimizer.cs b/Editor/Processors/InitializeAnimatorOptimizer.cs index 08aa0b05..3f4ffc55 100644 --- a/Editor/Processors/InitializeAnimatorOptimizer.cs +++ b/Editor/Processors/InitializeAnimatorOptimizer.cs @@ -46,14 +46,14 @@ protected override void Execute(BuildContext context, TraceAndOptimizeState stat switch (component) { case Animator animator: - animator.runtimeAnimatorController = ProcessController(animator.runtimeAnimatorController, component.gameObject); + ProcessController(animator.runtimeAnimatorController, component.gameObject); break; #if AAO_VRCSDK3_AVATARS case VRCAvatarDescriptor avatarDescriptor: foreach (ref var layer in avatarDescriptor.baseAnimationLayers.AsSpan()) - layer.animatorController = ProcessController(layer.animatorController, component.gameObject); + ProcessController(layer.animatorController, component.gameObject); foreach (ref var layer in avatarDescriptor.specialAnimationLayers.AsSpan()) - layer.animatorController = ProcessController(layer.animatorController, component.gameObject); + ProcessController(layer.animatorController, component.gameObject); #endif break; // do not run animator optimizer with unknown components @@ -62,14 +62,14 @@ protected override void Execute(BuildContext context, TraceAndOptimizeState stat } } - AnimatorController? ProcessController(RuntimeAnimatorController? runtimeController, + void ProcessController(RuntimeAnimatorController? runtimeController, GameObject rootGameObject) { - if (runtimeController == null) return null; + if (runtimeController == null) return; var cloned = (AnimatorController)runtimeController; var wrapper = new AOAnimatorController(cloned, rootGameObject); animatorState.Add(wrapper); - clonedToController.Add(cloned, wrapper); + if (!clonedToController.TryAdd(cloned, wrapper)) return; #if AAO_VRCSDK3_AVATARS foreach (var behaviour in ACUtils.StateMachineBehaviours(cloned)) @@ -83,7 +83,6 @@ protected override void Execute(BuildContext context, TraceAndOptimizeState stat } } #endif - return cloned; } #if AAO_VRCSDK3_AVATARS From 15b3ee9beed090d58c701db11e57ac869e633fc0 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 8 Dec 2024 15:46:31 +0900 Subject: [PATCH 2/2] docs(changelog): Errors if exactly same AnimatorController is specified for multiple playable layers --- CHANGELOG-PRERELEASE.md | 1 + CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG-PRERELEASE.md b/CHANGELOG-PRERELEASE.md index 11466de6..f25e8c8d 100644 --- a/CHANGELOG-PRERELEASE.md +++ b/CHANGELOG-PRERELEASE.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog]. ### Fixed - Errors with models with UV at very edge `#1363` +- Errors if exactly same AnimatorController is specified for multiple playable layers `#1366` ### Security diff --git a/CHANGELOG.md b/CHANGELOG.md index 722090f0..5e4f947f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog]. ### Fixed - Errors with models with UV at very edge `#1363` +- Errors if exactly same AnimatorController is specified for multiple playable layers `#1366` ### Security