Add events tracing feature to Animated Model for animation playback insights

This commit is contained in:
Wojtek Figat
2024-01-05 21:42:28 +01:00
parent b6337c748c
commit 6d58883454
5 changed files with 65 additions and 0 deletions

View File

@@ -200,6 +200,21 @@ struct FLAXENGINE_API AnimGraphSlot
bool Reset = false;
};
/// <summary>
/// The animation graph state container for a single node playback trace (eg. animation sample info or state transition). Can be used by Anim Graph debugging or custom scripting.
/// </summary>
API_STRUCT() struct FLAXENGINE_API AnimGraphTraceEvent
{
DECLARE_SCRIPTING_TYPE_MINIMAL(AnimGraphTraceEvent);
// Contextual asset used. For example, sampled animation.
API_FIELD() Asset* Asset = nullptr;
// Generic value contextual to playback type (eg. animation sample position).
API_FIELD() float Value = 0;
// Identifier of the node in the graph.
API_FIELD() uint32 NodeId = 0;
};
/// <summary>
/// The animation graph instance data storage. Required to update the animation graph.
/// </summary>
@@ -358,6 +373,12 @@ public:
/// </summary>
void InvokeAnimEvents();
public:
// Anim Graph logic tracing feature that allows to collect insights of animations sampling and skeleton poses operations.
bool EnableTracing = false;
// Trace events collected when using EnableTracing option.
Array<AnimGraphTraceEvent> TraceEvents;
private:
struct OutgoingEvent
{