Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/AnimNodes/AnimNode_PoseHandler.h
koray hagen 26af906499 Graph-driven pose warping, with root motion delta flow:
1) Root motion delta flow supported through all anim nodes deriving from FAnimNode_AssetPlayerBase and montages.
2) Stride/Orientation warping feature graph-driven evaluation modes which leverage root motion delta flow (graph-driven slope warping currently disabled).
3) Root motion flow connected to the Animation Warping plugin.
4) Pose Warping test map featuring various motion "styles" connected to pose warping (Motion Matching, Blend Space Graphs/Assets, Sequence Players, Evaluators).

#preflight 6092380a58c4790001a3e9b6
#rb aaron.cox, braeden.shosa, thomas.sarkanen
#jira none
#fyi laurent.delayen

[CL 16208667 by koray hagen in ue5-main branch]
2021-05-05 12:18:35 -04:00

70 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Animation/AnimationAsset.h"
#include "Animation/PoseAsset.h"
#include "Animation/AnimNode_AssetPlayerBase.h"
#include "AnimNode_PoseHandler.generated.h"
// Evaluates a point in an anim sequence, using a specific time input rather than advancing time internally.
// Typically the playback position of the animation for this node will represent something other than time, like jump height.
// This node will not trigger any notifies present in the associated sequence.
USTRUCT(BlueprintInternalUseOnly)
struct ANIMGRAPHRUNTIME_API FAnimNode_PoseHandler : public FAnimNode_AssetPlayerBase
{
GENERATED_USTRUCT_BODY()
public:
// The animation sequence asset to evaluate
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Settings, meta = (PinHiddenByDefault))
TObjectPtr<UPoseAsset> PoseAsset;
public:
FAnimNode_PoseHandler()
:PoseAsset(nullptr)
{
}
// FAnimNode_AssetPlayerBase interface
virtual float GetCurrentAssetTime() const { return 0.f; }
virtual float GetCurrentAssetLength() const { return 0.f; }
// End of FAnimNode_AssetPlayerBase interface
// FAnimNode_Base interface
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
virtual void UpdateAssetPlayer(const FAnimationUpdateContext& Context) override;
virtual void GatherDebugData(FNodeDebugData& DebugData) override;
// End of FAnimNode_Base interface
// FAnimNode_AssetPlayerBase Interface
virtual float GetAccumulatedTime() const {return 0.f;}
virtual void SetAccumulatedTime(float NewTime) {}
virtual UAnimationAsset* GetAnimAsset() const {return PoseAsset;}
// End of FAnimNode_AssetPlayerBase Interface
#if WITH_EDITORONLY_DATA
// Set the pose asset to use for this node
void SetPoseAsset(UPoseAsset* InPoseAsset);
#endif
protected:
/** Called after CurrentPoseAsset is changed. */
virtual void OnPoseAssetChange() {}
TWeakObjectPtr<UPoseAsset> CurrentPoseAsset;
FAnimExtractContext PoseExtractContext;
// weight to blend pose per joint - has to be cached whenever cache bones for LOD
// note this is for mesh bone
TArray<float> BoneBlendWeights;
/* Rebuild pose list */
virtual void RebuildPoseList(const FBoneContainer& InBoneContainer, const UPoseAsset* InPoseAsset);
private:
void UpdatePoseAssetProperty(struct FAnimInstanceProxy* InstanceProxy);
};