mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-08 14:52:49 +08:00
Fix quadratic time behavior on exception
Previously, processing would abort before clearing AvatarTagComponents when an exception is thrown. This would result in unprocessed AvatarTagComponents re-triggering processing as part of their Awake callback, causing O(n^2) behavior.
This commit is contained in:
parent
7ed1593bda
commit
d2f8c22ac8
@ -109,6 +109,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
BoneDatabase.ResetBones();
|
||||
PathMappings.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
new RenameParametersHook().OnPreprocessAvatar(avatarGameObject);
|
||||
new MenuInstallHook().OnPreprocessAvatar(avatarGameObject);
|
||||
new MergeArmatureHook().OnPreprocessAvatar(avatarGameObject);
|
||||
@ -119,11 +121,16 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
new BlendshapeSyncAnimationProcessor().OnPreprocessAvatar(avatarGameObject);
|
||||
|
||||
AfterProcessing?.Invoke(avatarGameObject);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Ensure that we clean up AvatarTagComponents after failed processing. This ensures we don't re-enter
|
||||
// processing from the Awake method on the unprocessed AvatarTagComponents
|
||||
foreach (var component in avatarGameObject.GetComponentsInChildren<AvatarTagComponent>(true))
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(component);
|
||||
}
|
||||
}
|
||||
|
||||
// The VRCSDK captures some debug information about animators as part of the build process, prior to invoking
|
||||
// hooks. For some reason this happens in the ValidateFeatures call on the SDK builder. Reinvoke it to
|
||||
|
Loading…
Reference in New Issue
Block a user