diff --git a/Editor/Animation/AnimationDatabase.cs b/Editor/Animation/AnimationDatabase.cs index f9ef2335..bf788923 100644 --- a/Editor/Animation/AnimationDatabase.cs +++ b/Editor/Animation/AnimationDatabase.cs @@ -98,11 +98,13 @@ namespace nadena.dev.modular_avatar.animation internal void Commit() { + Profiler.BeginSample("AnimationDatabase.Commit"); foreach (var clip in _clips) { if (clip.IsProxyAnimation) clip.CurrentClip = clip.OriginalClip; } + Profiler.BeginSample("UpdateClipProperties"); foreach (var clip in _clips) { // Changing the "high quality curve" setting can result in behavior changes (but can happen accidentally @@ -122,11 +124,16 @@ namespace nadena.dev.modular_avatar.animation } } } + Profiler.EndSample(); + Profiler.BeginSample("ClipCommitActions"); foreach (var action in _clipCommitActions) { action(); } + Profiler.EndSample(); + + Profiler.EndSample(); } internal void OnActivate(BuildContext context) diff --git a/Editor/Animation/PathMappings.cs b/Editor/Animation/PathMappings.cs index bbd6648b..9546a063 100644 --- a/Editor/Animation/PathMappings.cs +++ b/Editor/Animation/PathMappings.cs @@ -8,6 +8,7 @@ using nadena.dev.ndmf.util; using UnityEditor; using UnityEditor.Animations; using UnityEngine; +using UnityEngine.Profiling; #if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER #endif @@ -337,8 +338,10 @@ namespace nadena.dev.modular_avatar.animation internal void OnDeactivate(BuildContext context) { + Profiler.BeginSample("PathMappings.OnDeactivate"); Dictionary clipCache = new Dictionary(); - + + Profiler.BeginSample("ApplyMappingsToClip"); _animationDatabase.ForeachClip(holder => { if (holder.CurrentClip is AnimationClip clip) @@ -346,23 +349,29 @@ namespace nadena.dev.modular_avatar.animation holder.CurrentClip = ApplyMappingsToClip(clip, clipCache); } }); + Profiler.EndSample(); #if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER + Profiler.BeginSample("MapPlayAudio"); _animationDatabase.ForeachPlayAudio(playAudio => { if (playAudio == null) return; playAudio.SourcePath = MapPath(playAudio.SourcePath, true); }); + Profiler.EndSample(); #endif + Profiler.BeginSample("InvokeIOnCommitObjectRenamesCallbacks"); foreach (var listener in context.AvatarRootObject.GetComponentsInChildren()) { listener.OnCommitObjectRenames(context, this); } + Profiler.EndSample(); var layers = context.AvatarDescriptor.baseAnimationLayers .Concat(context.AvatarDescriptor.specialAnimationLayers); + Profiler.BeginSample("ApplyMappingsToAvatarMasks"); foreach (var layer in layers) { ApplyMappingsToAvatarMask(layer.mask); @@ -373,6 +382,9 @@ namespace nadena.dev.modular_avatar.animation foreach (var acLayer in ac.layers) ApplyMappingsToAvatarMask(acLayer.avatarMask); } + Profiler.EndSample(); + + Profiler.EndSample(); } public GameObject PathToObject(string path)