perf: skip rename processing when there are no relevant mappings (#799)

This commit is contained in:
bd_ 2024-03-25 10:09:51 +00:00 committed by GitHub
parent 0024be06e0
commit cb3ada9072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -480,6 +480,8 @@ namespace nadena.dev.modular_avatar.core.editor
private void ProcessAnimator(ref AnimatorController controller, ImmutableDictionary<(ParameterNamespace, string), ParameterMapping> remaps)
{
if (remaps.IsEmpty) return;
var visited = new HashSet<AnimatorStateMachine>();
var queue = new Queue<AnimatorStateMachine>();
@ -614,32 +616,19 @@ namespace nadena.dev.modular_avatar.core.editor
}
}
private void ProcessTransition(AnimatorStateTransition t, ImmutableDictionary<(ParameterNamespace, string), ParameterMapping> remaps)
private void ProcessTransition(AnimatorTransitionBase t, ImmutableDictionary<(ParameterNamespace, string), ParameterMapping> remaps)
{
bool dirty = false;
var conditions = t.conditions;
for (int i = 0; i < conditions.Length; i++)
{
var cond = conditions[i];
cond.parameter = remap(remaps, cond.parameter);
cond.parameter = remap(remaps, cond.parameter, ref dirty);
conditions[i] = cond;
}
t.conditions = conditions;
}
private void ProcessTransition(AnimatorTransition t, ImmutableDictionary<(ParameterNamespace, string), ParameterMapping> remaps)
{
var conditions = t.conditions;
for (int i = 0; i < conditions.Length; i++)
{
var cond = conditions[i];
cond.parameter = remap(remaps, cond.parameter);
conditions[i] = cond;
}
t.conditions = conditions;
if (dirty) t.conditions = conditions;
}
private ImmutableDictionary<string, ParameterInfo> CollectParameters(ModularAvatarParameters p,