You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This is a huge change with the focus on improving compile times. It SHOULDN'T have any behavior changes since it is "only" splitting up large files in multiple smaller files and forward declare lots of types. This change is based on compile score results. Highlights * Moved lots and lots of types out of FortTypes.h and in to their own files to be able to avoid including FortTypes.h * Removed FortTypes.h includes from lots of files * Identified critical paths for includes and cut them off using forward declares or moving types out of big files * Lots of adding of includes to be able to handle a large UE change that cut off dependencies in lots of engine files (will be submitted separately Also fixed a bunch of linux non-monolithic build errors just to be able to verify that these changes worked Reviewed in spirit by Marc Audy :-) #rb none #preflight 634350bcc272487ed4323f00 [CL 22427442 by marc audy in ue5-main branch]
156 lines
5.3 KiB
C++
156 lines
5.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "BoneIndices.h"
|
|
#include "BoneContainer.h"
|
|
#include "BonePose.h"
|
|
#include "BoneControllers/AnimNode_SkeletalControlBase.h"
|
|
#include "CommonAnimTypes.h"
|
|
#include "EngineDefines.h"
|
|
#include "AnimNode_LookAt.generated.h"
|
|
|
|
class FPrimitiveDrawInterface;
|
|
class USkeletalMeshComponent;
|
|
|
|
UENUM()
|
|
/** Various ways to interpolate TAlphaBlend. */
|
|
namespace EInterpolationBlend
|
|
{
|
|
enum Type
|
|
{
|
|
Linear,
|
|
Cubic,
|
|
Sinusoidal,
|
|
EaseInOutExponent2,
|
|
EaseInOutExponent3,
|
|
EaseInOutExponent4,
|
|
EaseInOutExponent5,
|
|
MAX
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Simple controller that make a bone to look at the point or another bone
|
|
*/
|
|
USTRUCT(BlueprintInternalUseOnly)
|
|
struct ANIMGRAPHRUNTIME_API FAnimNode_LookAt : public FAnimNode_SkeletalControlBase
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
/** Name of bone to control. This is the main bone chain to modify from. **/
|
|
UPROPERTY(EditAnywhere, Category=SkeletalControl)
|
|
FBoneReference BoneToModify;
|
|
|
|
/** Target socket to look at. Used if LookAtBone is empty. - You can use LookAtLocation if you need offset from this point. That location will be used in their local space. **/
|
|
UPROPERTY(EditAnywhere, Category = Target)
|
|
FBoneSocketTarget LookAtTarget;
|
|
|
|
/** Target Offset. It's in world space if LookAtBone is empty or it is based on LookAtBone or LookAtSocket in their local space*/
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Target, meta = (PinHiddenByDefault))
|
|
FVector LookAtLocation;
|
|
|
|
UPROPERTY(EditAnywhere, Category = SkeletalControl)
|
|
FAxis LookAt_Axis;
|
|
|
|
/** Whether or not to use Look up axis */
|
|
UPROPERTY(EditAnywhere, Category=SkeletalControl)
|
|
bool bUseLookUpAxis;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalControl, meta=(PinHiddenByDefault))
|
|
TEnumAsByte<EInterpolationBlend::Type> InterpolationType;
|
|
|
|
UPROPERTY(EditAnywhere, Category = SkeletalControl)
|
|
FAxis LookUp_Axis;
|
|
|
|
/** Look at Clamp value in degrees - if your look at axis is Z, only X, Y degree of clamp will be used */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalControl, meta=(PinHiddenByDefault))
|
|
float LookAtClamp;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalControl, meta=(PinHiddenByDefault))
|
|
float InterpolationTime;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SkeletalControl, meta=(PinHiddenByDefault))
|
|
float InterpolationTriggerThreashold;
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
/** Target Bone to look at - You can use LookAtLocation if you need offset from this point. That location will be used in their local space. **/
|
|
UPROPERTY()
|
|
FBoneReference LookAtBone_DEPRECATED;
|
|
|
|
UPROPERTY()
|
|
FName LookAtSocket_DEPRECATED;
|
|
|
|
/** Look at axis, which axis to align to look at point */
|
|
UPROPERTY()
|
|
TEnumAsByte<EAxisOption::Type> LookAtAxis_DEPRECATED;
|
|
|
|
/** Custom look up axis in local space. Only used if LookAtAxis==EAxisOption::Custom */
|
|
UPROPERTY()
|
|
FVector CustomLookAtAxis_DEPRECATED;
|
|
|
|
/** Look up axis in local space */
|
|
UPROPERTY()
|
|
TEnumAsByte<EAxisOption::Type> LookUpAxis_DEPRECATED;
|
|
|
|
/** Custom look up axis in local space. Only used if LookUpAxis==EAxisOption::Custom */
|
|
UPROPERTY()
|
|
FVector CustomLookUpAxis_DEPRECATED;
|
|
#endif
|
|
|
|
// in the future, it would be nice to have more options, -i.e. lag, interpolation speed
|
|
FAnimNode_LookAt();
|
|
|
|
// FAnimNode_Base interface
|
|
virtual void GatherDebugData(FNodeDebugData& DebugData) override;
|
|
virtual void UpdateInternal(const FAnimationUpdateContext& Context) override;
|
|
virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
|
|
// End of FAnimNode_Base interface
|
|
|
|
// FAnimNode_SkeletalControlBase interface
|
|
virtual void EvaluateComponentSpaceInternal(FComponentSpacePoseContext& Context) override;
|
|
virtual void EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms) override;
|
|
virtual bool IsValidToEvaluate(const USkeleton* Skeleton, const FBoneContainer& RequiredBones) override;
|
|
// End of FAnimNode_SkeletalControlBase interface
|
|
|
|
FVector GetCachedTargetLocation() const { return CachedCurrentTargetLocation; }
|
|
|
|
#if WITH_EDITOR
|
|
void ConditionalDebugDraw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent* MeshComp) const;
|
|
#endif // WITH_EDITOR
|
|
|
|
private:
|
|
// FAnimNode_SkeletalControlBase interface
|
|
virtual void InitializeBoneReferences(const FBoneContainer& RequiredBones) override;
|
|
// End of FAnimNode_SkeletalControlBase interface
|
|
|
|
/** Turn a linear interpolated alpha into the corresponding AlphaBlendType */
|
|
static float AlphaToBlendType(float InAlpha, EInterpolationBlend::Type BlendType);
|
|
|
|
/** Debug transient data */
|
|
FVector CurrentLookAtLocation;
|
|
|
|
/** Current Target Location */
|
|
FVector CurrentTargetLocation;
|
|
FVector PreviousTargetLocation;
|
|
|
|
/** Current Alpha */
|
|
float AccumulatedInterpoolationTime;
|
|
|
|
|
|
#if UE_ENABLE_DEBUG_DRAWING
|
|
/** Debug draw cached data */
|
|
FTransform CachedOriginalTransform;
|
|
FTransform CachedLookAtTransform;
|
|
FTransform CachedTargetCoordinate;
|
|
FVector CachedPreviousTargetLocation;
|
|
FVector CachedCurrentLookAtLocation;
|
|
#endif // UE_ENABLE_DEBUG_DRAWING
|
|
FVector CachedCurrentTargetLocation;
|
|
|
|
protected:
|
|
virtual void ModifyPoseFromDeltaRotation(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms, FTransform& InOutBoneToModifyTransform, const FQuat& DeltaRotation);
|
|
};
|