mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-17 11:50:11 +08:00
prof: add some profiling annotations (#1183)
This commit is contained in:
parent
7bf5106246
commit
5090d45cfe
@ -98,11 +98,13 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
|
|
||||||
internal void Commit()
|
internal void Commit()
|
||||||
{
|
{
|
||||||
|
Profiler.BeginSample("AnimationDatabase.Commit");
|
||||||
foreach (var clip in _clips)
|
foreach (var clip in _clips)
|
||||||
{
|
{
|
||||||
if (clip.IsProxyAnimation) clip.CurrentClip = clip.OriginalClip;
|
if (clip.IsProxyAnimation) clip.CurrentClip = clip.OriginalClip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profiler.BeginSample("UpdateClipProperties");
|
||||||
foreach (var clip in _clips)
|
foreach (var clip in _clips)
|
||||||
{
|
{
|
||||||
// Changing the "high quality curve" setting can result in behavior changes (but can happen accidentally
|
// 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)
|
foreach (var action in _clipCommitActions)
|
||||||
{
|
{
|
||||||
action();
|
action();
|
||||||
}
|
}
|
||||||
|
Profiler.EndSample();
|
||||||
|
|
||||||
|
Profiler.EndSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnActivate(BuildContext context)
|
internal void OnActivate(BuildContext context)
|
||||||
|
@ -8,6 +8,7 @@ using nadena.dev.ndmf.util;
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Profiling;
|
||||||
#if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER
|
#if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -337,8 +338,10 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
|
|
||||||
internal void OnDeactivate(BuildContext context)
|
internal void OnDeactivate(BuildContext context)
|
||||||
{
|
{
|
||||||
|
Profiler.BeginSample("PathMappings.OnDeactivate");
|
||||||
Dictionary<AnimationClip, AnimationClip> clipCache = new Dictionary<AnimationClip, AnimationClip>();
|
Dictionary<AnimationClip, AnimationClip> clipCache = new Dictionary<AnimationClip, AnimationClip>();
|
||||||
|
|
||||||
|
Profiler.BeginSample("ApplyMappingsToClip");
|
||||||
_animationDatabase.ForeachClip(holder =>
|
_animationDatabase.ForeachClip(holder =>
|
||||||
{
|
{
|
||||||
if (holder.CurrentClip is AnimationClip clip)
|
if (holder.CurrentClip is AnimationClip clip)
|
||||||
@ -346,23 +349,29 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
holder.CurrentClip = ApplyMappingsToClip(clip, clipCache);
|
holder.CurrentClip = ApplyMappingsToClip(clip, clipCache);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Profiler.EndSample();
|
||||||
|
|
||||||
#if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER
|
#if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER
|
||||||
|
Profiler.BeginSample("MapPlayAudio");
|
||||||
_animationDatabase.ForeachPlayAudio(playAudio =>
|
_animationDatabase.ForeachPlayAudio(playAudio =>
|
||||||
{
|
{
|
||||||
if (playAudio == null) return;
|
if (playAudio == null) return;
|
||||||
playAudio.SourcePath = MapPath(playAudio.SourcePath, true);
|
playAudio.SourcePath = MapPath(playAudio.SourcePath, true);
|
||||||
});
|
});
|
||||||
|
Profiler.EndSample();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Profiler.BeginSample("InvokeIOnCommitObjectRenamesCallbacks");
|
||||||
foreach (var listener in context.AvatarRootObject.GetComponentsInChildren<IOnCommitObjectRenames>())
|
foreach (var listener in context.AvatarRootObject.GetComponentsInChildren<IOnCommitObjectRenames>())
|
||||||
{
|
{
|
||||||
listener.OnCommitObjectRenames(context, this);
|
listener.OnCommitObjectRenames(context, this);
|
||||||
}
|
}
|
||||||
|
Profiler.EndSample();
|
||||||
|
|
||||||
var layers = context.AvatarDescriptor.baseAnimationLayers
|
var layers = context.AvatarDescriptor.baseAnimationLayers
|
||||||
.Concat(context.AvatarDescriptor.specialAnimationLayers);
|
.Concat(context.AvatarDescriptor.specialAnimationLayers);
|
||||||
|
|
||||||
|
Profiler.BeginSample("ApplyMappingsToAvatarMasks");
|
||||||
foreach (var layer in layers)
|
foreach (var layer in layers)
|
||||||
{
|
{
|
||||||
ApplyMappingsToAvatarMask(layer.mask);
|
ApplyMappingsToAvatarMask(layer.mask);
|
||||||
@ -373,6 +382,9 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
foreach (var acLayer in ac.layers)
|
foreach (var acLayer in ac.layers)
|
||||||
ApplyMappingsToAvatarMask(acLayer.avatarMask);
|
ApplyMappingsToAvatarMask(acLayer.avatarMask);
|
||||||
}
|
}
|
||||||
|
Profiler.EndSample();
|
||||||
|
|
||||||
|
Profiler.EndSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject PathToObject(string path)
|
public GameObject PathToObject(string path)
|
||||||
|
Loading…
Reference in New Issue
Block a user