Files
UnrealEngineUWP/Engine/Source/Runtime/AnimGraphRuntime/Public/BoneControllers/AnimNode_SpringBone.h

104 lines
3.6 KiB
C
Raw Normal View History

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AnimNode_SkeletalControlBase.h"
#include "AnimNode_SpringBone.generated.h"
/**
* Simple controller that replaces or adds to the translation/rotation of a single bone.
*/
USTRUCT()
struct ANIMGRAPHRUNTIME_API FAnimNode_SpringBone : public FAnimNode_SkeletalControlBase
{
GENERATED_USTRUCT_BODY()
/** Name of bone to control. This is the main bone chain to modify from. **/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring)
FBoneReference SpringBone;
/** Limit the amount that a bone can stretch from its ref-pose length. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring)
bool bLimitDisplacement;
/** If bLimitDisplacement is true, this indicates how long a bone can stretch beyond its length in the ref-pose. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring, meta=(EditCondition="bLimitDisplacement"))
float MaxDisplacement;
/** Stiffness of spring */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring)
float SpringStiffness;
/** Damping of spring */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring)
float SpringDamping;
/** If spring stretches more than this, reset it. Useful for catching teleports etc */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Spring)
float ErrorResetThresh;
/** If true, Z position is always correct, no spring applied */
UPROPERTY()
bool bNoZSpring_DEPRECATED;
/** If true take the spring calculation for translation in X */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bTranslateX;
/** If true take the spring calculation for translation in Y */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bTranslateY;
/** If true take the spring calculation for translation in Z */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bTranslateZ;
/** If true take the spring calculation for rotation in X */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bRotateX;
/** If true take the spring calculation for rotation in Y */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bRotateY;
/** If true take the spring calculation for rotation in Z */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=FilterChannels)
bool bRotateZ;
/** Internal use - Amount of time we need to simulate. */
float RemainingTime;
/** Internal use - Current timestep */
float FixedTimeStep;
/** Did we have a non-zero ControlStrength last frame. */
bool bHadValidStrength;
/** World-space location of the bone. */
FVector BoneLocation;
/** World-space velocity of the bone. */
FVector BoneVelocity;
public:
FAnimNode_SpringBone();
// FAnimNode_Base interface
virtual void Initialize(const FAnimationInitializeContext& Context) override;
virtual void CacheBones(const FAnimationCacheBonesContext& Context) override;
virtual void Update(const FAnimationUpdateContext& Context) override;
virtual void GatherDebugData(FNodeDebugData& DebugData) override;
// End of FAnimNode_Base interface
// FAnimNode_SkeletalControlBase interface
Added FCompactPose, contains only the bone transforms needed by RequiredBones. Allows us to do animation evaluation without having to refer to required bones array all the time API Breaking Changes Removed Functions: FA2CSPose::SafeSetCSBoneTransforms FA2CSPose::LocalBlendCSBoneTransforms Member Type Changes: - int32 -> FCompactPoseBoneIndex --- FBoneTransform::BoneIndex --- FABRIKChainLink::BoneIndex - FA2CSPose -> FCSPose<FCompactPose> --- FAnimNode_SkeletalControlBase::ForwardedPose --- FComponentSpacePoseContext::Pose - FA2Pose -> FCompactPose --- FSlotEvaluationPose::Pose --- FAnimNode_TransitionPoseEvaluator::CachedPose --- FAnimNode_SaveCachedPose::CachedPose --- FPoseContext::Pose Paramater Changes: - FA2Pose& -> FCompactPose& --- UAnimSingleNodeInstance::InternalBlendSpaceEvaluatePose (FA2Pose& Pose -> FCompactPose&) --- UAnimInstance::SequenceEvaluatePose --- UAnimInstance::BlendSequences --- UAnimInstance::CopyPose --- UAnimInstance::ApplyAdditiveSequence --- UAnimInstance::BlendSpaceEvaluatePose --- UAnimInstance::BlendRotationOffset --- UAnimInstance::GetSlotWeight --- UAnimInstance::SlotEvaluatePose - FA2CSPose& -> FCSPose<FCompactPose>& --- FAnimNode_SkeletalControlBase::EvaluateBoneTransforms --- UAnimGraphNode_SkeletalControlBase::ConvertCSVectorToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertCSRotationToBoneSpace --- UAnimGraphNode_SkeletalControlBase::ConvertWidgetLocation --- UAnimPreviewInstance::ApplyBoneControllers - TArray<FTransform> -> FCompactPose --- UAnimPreviewInstance::SetKeyImplementation --- UAnimSequence::GetAnimationPose --- UAnimSequence::GetBonePose --- UAnimSequence::GetBonePose_Additive --- UAnimSequence::GetAdditiveBasePose --- UAnimSequence::GetBonePose_AdditiveMeshRotationOnly --- FAnimationRuntime::BlendPosesTogether ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBone ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesTogetherPerBoneInMeshSpace ( + Removed NumPoses and RequiredBones ) --- FAnimationRuntime::BlendPosesPerBoneFilter ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::GetPoseFromSequence ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromAnimTrack ( + Removed RequiredBones ) --- FAnimationRuntime::FillWithRetargetBaseRefPose ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToAdditive ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertPoseToMeshRotation ( + Removed RequiredBones ) --- FAnimationRuntime::BlendPosesAccumulate ( + Removed RequiredBones ) --- FAnimationRuntime::BlendAdditivePose ( + Removed RequiredBones ) --- FAnimationRuntime::GetPoseFromBlendSpace ( + Removed RequiredBones ) --- FAnimationRuntime::ConvertCSTransformToBoneSpace --- FAnimationRuntime::ConvertBoneSpaceTransformToCS --- FAnimationRuntime::BlendMeshPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) --- FAnimationRuntime::BlendLocalPosesPerBoneWeights ( + Removed Skeleton and RequiredBones ) - TArray<FTransform> -> FTransform --- UAnimSequence::ResetRootBoneForRootMotion - int32 -> FCompactPoseBoneIndex --- UAnimSequence::RetargetBoneTransform FAnimationRuntime: Many changes to animation operation functions, removal of NumPoses and RequiredBones, conversion of TArray<FTransform> to FCompactPose Removed USTRUCT markup from FBoneTransform Removed UPROPERTY markup from FAnimNode_TransitionPoseEvaluator::CachedPose [CL 2556671 by Martin Wilson in Main branch]
2015-05-19 06:19:22 -04:00
virtual void EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, FCSPose<FCompactPose>& MeshBases, TArray<FBoneTransform>& OutBoneTransforms) override;
virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) override;
// End of FAnimNode_SkeletalControlBase interface
private:
// FAnimNode_SkeletalControlBase interface
virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones) override;
// End of FAnimNode_SkeletalControlBase interface
};