You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Tweaks to the rendering of blendspaces, including separating the graph from the buttons Context menu changes for the sample details Changes to AnimationBlueprintLibrary and AnimPose from Jurre to help get the poses during analysis #jira UE-114512 #rb thomas.sarkanen #ROBOMERGE-SOURCE: CL 16356830 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228) [CL 16356839 by danny chapman in ue5-release-engine-test branch]
117 lines
4.4 KiB
C++
117 lines
4.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
/**
|
|
* Abstract base class for a skeletal controller.
|
|
* A SkelControl is a module that can modify the position or orientation of a set of bones in a skeletal mesh in some programmatic way.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "BonePose.h"
|
|
#include "Animation/BoneSocketReference.h"
|
|
#include "Animation/AnimNodeBase.h"
|
|
#include "Animation/InputScaleBias.h"
|
|
#include "AnimNode_SkeletalControlBase.generated.h"
|
|
|
|
class USkeletalMeshComponent;
|
|
|
|
USTRUCT(BlueprintInternalUseOnly)
|
|
struct ANIMGRAPHRUNTIME_API FAnimNode_SkeletalControlBase : public FAnimNode_Base
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
// Input link
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Links)
|
|
FComponentSpacePoseLink ComponentPose;
|
|
|
|
/*
|
|
* Max LOD that this node is allowed to run
|
|
* For example if you have LODThreadhold to be 2, it will run until LOD 2 (based on 0 index)
|
|
* when the component LOD becomes 3, it will stop update/evaluate
|
|
* currently transition would be issue and that has to be re-visited
|
|
*/
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Performance, meta = (DisplayName = "LOD Threshold"))
|
|
int32 LODThreshold;
|
|
|
|
UPROPERTY(Transient)
|
|
float ActualAlpha;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
EAnimAlphaInputType AlphaInputType;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault, DisplayName = "bEnabled"))
|
|
bool bAlphaBoolEnabled;
|
|
|
|
// Current strength of the skeletal control
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
|
|
float Alpha;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
FInputScaleBias AlphaScaleBias;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (DisplayName = "Blend Settings"))
|
|
FInputAlphaBoolBlend AlphaBoolBlend;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha, meta = (PinShownByDefault))
|
|
FName AlphaCurveName;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Alpha)
|
|
FInputScaleBiasClamp AlphaScaleBiasClamp;
|
|
|
|
public:
|
|
|
|
FAnimNode_SkeletalControlBase()
|
|
: LODThreshold(INDEX_NONE)
|
|
, ActualAlpha(0.f)
|
|
, AlphaInputType(EAnimAlphaInputType::Float)
|
|
, bAlphaBoolEnabled(true)
|
|
, Alpha(1.0f)
|
|
{
|
|
}
|
|
|
|
public:
|
|
#if WITH_EDITORONLY_DATA
|
|
// forwarded pose data from the wired node which current node's skeletal control is not applied yet
|
|
FCSPose<FCompactHeapPose> ForwardedPose;
|
|
#endif //#if WITH_EDITORONLY_DATA
|
|
|
|
// FAnimNode_Base interface
|
|
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
|
|
virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
|
|
virtual void Update_AnyThread(const FAnimationUpdateContext& Context) final;
|
|
virtual void EvaluateComponentSpace_AnyThread(FComponentSpacePoseContext& Output) final;
|
|
virtual int32 GetLODThreshold() const override { return LODThreshold; }
|
|
// End of FAnimNode_Base interface
|
|
|
|
protected:
|
|
// Interface for derived skeletal controls to implement
|
|
// use this function to update for skeletal control base
|
|
virtual void UpdateInternal(const FAnimationUpdateContext& Context);
|
|
|
|
// Update incoming component pose.
|
|
virtual void UpdateComponentPose_AnyThread(const FAnimationUpdateContext& Context);
|
|
|
|
// Evaluate incoming component pose.
|
|
virtual void EvaluateComponentPose_AnyThread(FComponentSpacePoseContext& Output);
|
|
|
|
// use this function to evaluate for skeletal control base
|
|
virtual void EvaluateComponentSpaceInternal(FComponentSpacePoseContext& Context);
|
|
UE_DEPRECATED(4.16, "Please use EvaluateSkeletalControl_AnyThread.")
|
|
virtual void EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, FCSPose<FCompactPose>& MeshBases, TArray<FBoneTransform>& OutBoneTransforms) {}
|
|
// Evaluate the new component-space transforms for the affected bones.
|
|
virtual void EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms);
|
|
// return true if it is valid to Evaluate
|
|
virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) { return false; }
|
|
// initialize any bone references you have
|
|
virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones){};
|
|
|
|
/** Allow base to add info to the node debug output */
|
|
void AddDebugNodeData(FString& OutDebugData);
|
|
private:
|
|
|
|
// Resused bone transform array to avoid reallocating in skeletal controls
|
|
TArray<FBoneTransform> BoneTransforms;
|
|
};
|