2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
|
2015-06-10 10:57:15 -04:00
|
|
|
#include "Animation/AnimNodeBase.h"
|
|
|
|
|
#include "Animation/InputScaleBias.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "AnimNode_SkeletalControlBase.generated.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USTRUCT()
|
2015-06-10 10:57:15 -04:00
|
|
|
struct ANIMGRAPHRUNTIME_API FAnimNode_SkeletalControlBase : public FAnimNode_Base
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-03-17 05:38:32 -04:00
|
|
|
GENERATED_USTRUCT_BODY()
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
// Input link
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Links)
|
|
|
|
|
FComponentSpacePoseLink ComponentPose;
|
|
|
|
|
|
|
|
|
|
// Current strength of the skeletal control
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Settings, meta=(PinShownByDefault))
|
|
|
|
|
mutable float Alpha;
|
|
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Settings)
|
|
|
|
|
FInputScaleBias AlphaScaleBias;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
FAnimNode_SkeletalControlBase()
|
|
|
|
|
: Alpha(1.0f)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
2014-11-14 05:00:37 -05:00
|
|
|
#if WITH_EDITORONLY_DATA
|
|
|
|
|
// forwarded pose data from the wired node which current node's skeletal control is not applied yet
|
2015-05-19 06:19:22 -04:00
|
|
|
FCSPose<FCompactPose> ForwardedPose;
|
2014-11-14 05:00:37 -05:00
|
|
|
#endif //#if WITH_EDITORONLY_DATA
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
// FAnimNode_Base interface
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void Initialize(const FAnimationInitializeContext& Context) override;
|
2014-10-01 14:45:04 -04:00
|
|
|
virtual void CacheBones(const FAnimationCacheBonesContext& Context) override;
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void Update(const FAnimationUpdateContext& Context) override;
|
|
|
|
|
virtual void EvaluateComponentSpace(FComponentSpacePoseContext& Output) override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End of FAnimNode_Base interface
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
// Interface for derived skeletal controls to implement
|
|
|
|
|
|
|
|
|
|
// Evaluate the new component-space transforms for the affected bones.
|
2015-05-19 06:19:22 -04:00
|
|
|
virtual void EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, FCSPose<FCompactPose>& MeshBases, TArray<FBoneTransform>& OutBoneTransforms) {}
|
2014-03-14 14:13:41 -04:00
|
|
|
// return true if it is valid to Evaluate
|
2014-10-01 14:45:04 -04:00
|
|
|
virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) { return false; }
|
2014-03-14 14:13:41 -04:00
|
|
|
// initialize any bone references you have
|
2014-10-01 14:45:04 -04:00
|
|
|
virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones){};
|
2014-04-23 18:35:21 -04:00
|
|
|
|
|
|
|
|
/** Allow base to add info to the node debug output */
|
|
|
|
|
void AddDebugNodeData(FString& OutDebugData);
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|