From 02204c272f4d326e81baea3ba5e65538d5611b0c Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 2 Oct 2024 19:03:44 -0700 Subject: [PATCH] Revert "fix: remove unnecessory exit transitions for reactive components (#1161)" (#1248) This reverts commit 9dfa0dae23d9d4aa6e80e9c9d691e363dc297fdc. Those transitions are needed when controlling the same object from multiple parameters. Closes: #1233 --- .../AnimationGeneration/ReactiveObjectPass.cs | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs index 793fba66..69a0ede7 100644 --- a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs +++ b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs @@ -300,8 +300,7 @@ namespace nadena.dev.modular_avatar.core.editor var transitionBuffer = new List<(AnimatorState, List)>(); var entryTransitions = new List(); - var initialStateTransitionList = new List(); - transitionBuffer.Add((initialState, initialStateTransitionList)); + transitionBuffer.Add((initialState, new List())); foreach (var group in info.actionGroups.Skip(lastConstant)) { @@ -321,30 +320,33 @@ namespace nadena.dev.modular_avatar.core.editor var conditions = GetTransitionConditions(asc, group); - if (!group.Inverted) + foreach (var (st, transitions) in transitionBuffer) { - var transition = new AnimatorStateTransition + if (!group.Inverted) { - isExit = true, - hasExitTime = false, - duration = 0, - hasFixedDuration = true, - conditions = (AnimatorCondition[])conditions.Clone() - }; - initialStateTransitionList.Add(transition); - } - else - { - foreach (var cond in conditions) - { - initialStateTransitionList.Add(new AnimatorStateTransition + var transition = new AnimatorStateTransition { isExit = true, hasExitTime = false, duration = 0, hasFixedDuration = true, - conditions = new[] { InvertCondition(cond) } - }); + conditions = (AnimatorCondition[])conditions.Clone() + }; + transitions.Add(transition); + } + else + { + foreach (var cond in conditions) + { + transitions.Add(new AnimatorStateTransition + { + isExit = true, + hasExitTime = false, + duration = 0, + hasFixedDuration = true, + conditions = new[] { InvertCondition(cond) } + }); + } } }