From 9dfa0dae23d9d4aa6e80e9c9d691e363dc297fdc Mon Sep 17 00:00:00 2001 From: nekobako Date: Mon, 23 Sep 2024 05:42:31 +0900 Subject: [PATCH] fix: remove unnecessory exit transitions for reactive components (#1161) --- .../AnimationGeneration/ReactiveObjectPass.cs | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs index ed4fd727..b3e49145 100644 --- a/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs +++ b/Editor/ReactiveObjects/AnimationGeneration/ReactiveObjectPass.cs @@ -295,7 +295,8 @@ namespace nadena.dev.modular_avatar.core.editor var transitionBuffer = new List<(AnimatorState, List)>(); var entryTransitions = new List(); - transitionBuffer.Add((initialState, new List())); + var initialStateTransitionList = new List(); + transitionBuffer.Add((initialState, initialStateTransitionList)); foreach (var group in info.actionGroups.Skip(lastConstant)) { @@ -315,33 +316,30 @@ namespace nadena.dev.modular_avatar.core.editor var conditions = GetTransitionConditions(asc, group); - foreach (var (st, transitions) in transitionBuffer) + if (!group.Inverted) { - if (!group.Inverted) + var transition = new AnimatorStateTransition { - var transition = new AnimatorStateTransition + 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 { isExit = true, hasExitTime = false, duration = 0, hasFixedDuration = true, - 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) } - }); - } + conditions = new[] { InvertCondition(cond) } + }); } }