2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2017-06-21 10:25:35 -04:00
|
|
|
|
|
|
|
|
#include "AnimNodes/AnimNode_MakeDynamicAdditive.h"
|
|
|
|
|
#include "AnimationRuntime.h"
|
2023-06-21 09:46:47 -04:00
|
|
|
#include "Animation/AnimStats.h"
|
2019-12-13 11:07:03 -05:00
|
|
|
#include "Animation/AnimTrace.h"
|
2017-06-21 10:25:35 -04:00
|
|
|
|
2022-09-24 13:57:58 -04:00
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(AnimNode_MakeDynamicAdditive)
|
|
|
|
|
|
2017-06-21 10:25:35 -04:00
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// FAnimNode_MakeDynamicAdditive
|
|
|
|
|
|
|
|
|
|
FAnimNode_MakeDynamicAdditive::FAnimNode_MakeDynamicAdditive()
|
2018-05-23 21:04:31 -04:00
|
|
|
: bMeshSpaceAdditive(false)
|
2017-06-21 10:25:35 -04:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAnimNode_MakeDynamicAdditive::Initialize_AnyThread(const FAnimationInitializeContext& Context)
|
|
|
|
|
{
|
2019-07-16 11:49:59 -04:00
|
|
|
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(Initialize_AnyThread)
|
2017-06-21 10:25:35 -04:00
|
|
|
FAnimNode_Base::Initialize_AnyThread(Context);
|
|
|
|
|
|
|
|
|
|
Base.Initialize(Context);
|
|
|
|
|
Additive.Initialize(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAnimNode_MakeDynamicAdditive::CacheBones_AnyThread(const FAnimationCacheBonesContext& Context)
|
|
|
|
|
{
|
2019-07-16 11:49:59 -04:00
|
|
|
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(CacheBones_AnyThread)
|
2017-06-21 10:25:35 -04:00
|
|
|
Base.CacheBones(Context);
|
|
|
|
|
Additive.CacheBones(Context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAnimNode_MakeDynamicAdditive::Update_AnyThread(const FAnimationUpdateContext& Context)
|
|
|
|
|
{
|
2019-07-16 11:49:59 -04:00
|
|
|
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(Update_AnyThread)
|
2017-06-21 10:25:35 -04:00
|
|
|
Base.Update(Context.FractionalWeight(1.f));
|
|
|
|
|
Additive.Update(Context.FractionalWeight(1.f));
|
2019-12-13 11:07:03 -05:00
|
|
|
|
|
|
|
|
TRACE_ANIM_NODE_VALUE(Context, TEXT("Mesh Space Additive"), bMeshSpaceAdditive);
|
2017-06-21 10:25:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAnimNode_MakeDynamicAdditive::Evaluate_AnyThread(FPoseContext& Output)
|
|
|
|
|
{
|
2019-07-16 11:49:59 -04:00
|
|
|
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(Evaluate_AnyThread)
|
2023-06-06 10:07:01 -04:00
|
|
|
ANIM_MT_SCOPE_CYCLE_COUNTER_VERBOSE(MakeDynamicAdditive, !IsInGameThread());
|
|
|
|
|
|
2022-09-02 12:35:22 -04:00
|
|
|
FScopedExpectsAdditiveOverride ScopedExpectsAdditiveOverride(Output, false);
|
2017-06-21 10:25:35 -04:00
|
|
|
FPoseContext BaseEvalContext(Output);
|
|
|
|
|
|
|
|
|
|
Base.Evaluate(BaseEvalContext);
|
|
|
|
|
Additive.Evaluate(Output);
|
|
|
|
|
|
|
|
|
|
if (bMeshSpaceAdditive)
|
|
|
|
|
{
|
|
|
|
|
FAnimationRuntime::ConvertPoseToMeshRotation(Output.Pose);
|
|
|
|
|
FAnimationRuntime::ConvertPoseToMeshRotation(BaseEvalContext.Pose);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FAnimationRuntime::ConvertPoseToAdditive(Output.Pose, BaseEvalContext.Pose);
|
|
|
|
|
Output.Curve.ConvertToAdditive(BaseEvalContext.Curve);
|
2020-09-24 00:43:27 -04:00
|
|
|
|
2021-03-02 09:04:09 -04:00
|
|
|
UE::Anim::Attributes::ConvertToAdditive(BaseEvalContext.CustomAttributes, Output.CustomAttributes);
|
2017-06-21 10:25:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FAnimNode_MakeDynamicAdditive::GatherDebugData(FNodeDebugData& DebugData)
|
|
|
|
|
{
|
2019-07-16 11:49:59 -04:00
|
|
|
DECLARE_SCOPE_HIERARCHICAL_COUNTER_ANIMNODE(GatherDebugData)
|
2017-06-21 10:25:35 -04:00
|
|
|
FString DebugLine = DebugData.GetNodeName(this);
|
|
|
|
|
DebugLine += FString::Printf(TEXT("(Mesh Space Additive: %s)"), bMeshSpaceAdditive ? TEXT("true") : TEXT("false"));
|
|
|
|
|
|
|
|
|
|
DebugData.AddDebugItem(DebugLine);
|
|
|
|
|
Base.GatherDebugData(DebugData.BranchFlow(1.f));
|
|
|
|
|
Additive.GatherDebugData(DebugData.BranchFlow(1.f));
|
|
|
|
|
}
|
2022-09-24 13:57:58 -04:00
|
|
|
|