Refactor AnimGraph debug flows to use scripting API event

This commit is contained in:
Wojtek Figat
2021-06-10 19:10:39 +02:00
parent 544cb1ff6d
commit b8ad4bdd2a
8 changed files with 32 additions and 71 deletions

View File

@@ -1,6 +1,7 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#include "Animations.h"
#include "Engine/Engine/Engine.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Level/Actors/AnimatedModel.h"
#include "Engine/Engine/Time.h"
@@ -22,6 +23,7 @@ public:
};
AnimationsService AnimationManagerInstance;
Delegate<Asset*, ScriptingObject*, uint32, uint32> Animations::DebugFlow;
void AnimationsService::Update()
{

View File

@@ -2,14 +2,23 @@
#pragma once
#include "Engine/Scripting/ScriptingType.h"
#include "Engine/Core/Delegate.h"
class AnimatedModel;
class Asset;
/// <summary>
/// The animations service.
/// The animations playback service.
/// </summary>
class FLAXENGINE_API Animations
API_CLASS(Static) class FLAXENGINE_API Animations
{
public:
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Content);
#if USE_EDITOR
// Custom event that is called every time the Anim Graph signal flows over the graph (including the data connections). Can be used to read and visualize the animation blending logic. Args are: anim graph asset, animated object, node id, box id
API_EVENT() static Delegate<Asset*, ScriptingObject*, uint32, uint32> DebugFlow;
#endif
/// <summary>
/// Adds an animated model to update.

View File

@@ -80,10 +80,6 @@ namespace AnimGraphInternal
}
}
#if USE_EDITOR
Delegate<Asset*, ScriptingObject*, uint32, uint32> AnimGraphExecutor::DebugFlow;
#endif
void AnimGraphExecutor::initRuntime()
{
ADD_INTERNAL_CALL("FlaxEngine.AnimationGraph::Internal_HasConnection", &AnimGraphInternal::HasConnection);

View File

@@ -312,7 +312,7 @@ VisjectExecutor::Value AnimGraphExecutor::eatBox(Node* caller, Box* box)
_callStack.Add(caller);
#if USE_EDITOR
DebugFlow(_graph._owner, _data->Object, box->GetParent<Node>()->ID, box->ID);
Animations::DebugFlow(_graph._owner, context.Data->Object, box->GetParent<Node>()->ID, box->ID);
#endif
// Call per group custom processing event

View File

@@ -828,10 +828,6 @@ private:
public:
#if USE_EDITOR
// Custom event that is called every time the Anim Graph signal flows over the graph (including the data connections). Can be used to read and visualize the animation blending logic.
static Delegate<Asset*, ScriptingObject*, uint32, uint32> DebugFlow;
#endif
/// <summary>
/// Initializes the managed runtime calls.