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
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "AnimGraphNode_Base.h"
|
|
|
|
|
#include "AnimGraphNode_SkeletalControlBase.generated.h"
|
|
|
|
|
|
2015-04-10 03:30:54 -04:00
|
|
|
struct HActor;
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
UCLASS(Abstract, MinimalAPI)
|
|
|
|
|
class UAnimGraphNode_SkeletalControlBase : public UAnimGraphNode_Base
|
|
|
|
|
{
|
2015-03-17 06:17:32 -04:00
|
|
|
GENERATED_UCLASS_BODY()
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// UEdGraphNode interface
|
2014-06-13 06:14:46 -04:00
|
|
|
ANIMGRAPH_API virtual FLinearColor GetNodeTitleColor() const override;
|
2014-09-03 18:14:09 -04:00
|
|
|
ANIMGRAPH_API virtual FText GetTooltipText() const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End of UEdGraphNode interface
|
|
|
|
|
|
|
|
|
|
// UAnimGraphNode_Base interface
|
2014-06-13 06:14:46 -04:00
|
|
|
ANIMGRAPH_API virtual FString GetNodeCategory() const override;
|
|
|
|
|
ANIMGRAPH_API virtual void CreateOutputPins() override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End of UAnimGraphNode_Base interface
|
|
|
|
|
|
|
|
|
|
// Draw function for supporting visualization
|
2014-11-14 05:00:37 -05:00
|
|
|
ANIMGRAPH_API virtual void Draw(FPrimitiveDrawInterface* PDI, USkeletalMeshComponent * PreviewSkelMeshComp) const {};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* methods related to widget control
|
|
|
|
|
*/
|
|
|
|
|
ANIMGRAPH_API virtual FVector GetWidgetLocation(const USkeletalMeshComponent* SkelComp, struct FAnimNode_SkeletalControlBase* AnimNode)
|
|
|
|
|
{
|
|
|
|
|
return FVector::ZeroVector;
|
|
|
|
|
}
|
|
|
|
|
// to keep data consistency between anim nodes
|
|
|
|
|
ANIMGRAPH_API virtual void CopyNodeDataTo(FAnimNode_Base* OutAnimNode){}
|
|
|
|
|
ANIMGRAPH_API virtual void CopyNodeDataFrom(const FAnimNode_Base* NewAnimNode){}
|
2015-02-18 03:59:11 -05:00
|
|
|
|
|
|
|
|
/** Are we currently showing this pin */
|
|
|
|
|
ANIMGRAPH_API bool IsPinShown(const FString& PinName) const;
|
2014-11-14 05:00:37 -05:00
|
|
|
|
|
|
|
|
// return current widget mode this anim graph node supports
|
2014-11-14 10:55:42 -05:00
|
|
|
ANIMGRAPH_API virtual int32 GetWidgetMode(const USkeletalMeshComponent* SkelComp);
|
2014-12-01 21:27:36 -05:00
|
|
|
// called when the user changed widget mode by pressing "Space" key
|
|
|
|
|
ANIMGRAPH_API virtual int32 ChangeToNextWidgetMode(const USkeletalMeshComponent* SkelComp, int32 CurWidgetMode);
|
|
|
|
|
// called when the user set widget mode directly, returns true if InWidgetMode is available
|
|
|
|
|
ANIMGRAPH_API virtual bool SetWidgetMode(const USkeletalMeshComponent* SkelComp, int32 InWidgetMode){ return false; }
|
|
|
|
|
|
2014-11-14 05:00:37 -05:00
|
|
|
//
|
2014-11-14 10:55:42 -05:00
|
|
|
ANIMGRAPH_API virtual FName FindSelectedBone();
|
2014-11-14 05:00:37 -05:00
|
|
|
|
|
|
|
|
// if anim graph node needs other actors to select other bones, move actor's positions when this is called
|
|
|
|
|
ANIMGRAPH_API virtual void MoveSelectActorLocation(const USkeletalMeshComponent* SkelComp, FAnimNode_SkeletalControlBase* InAnimNode){}
|
|
|
|
|
|
|
|
|
|
ANIMGRAPH_API virtual bool IsActorClicked(HActor* ActorHitProxy){ return false; }
|
|
|
|
|
ANIMGRAPH_API virtual void ProcessActorClick(HActor* ActorHitProxy){}
|
|
|
|
|
// if it has select-actors, should hide all actors when de-select is called
|
|
|
|
|
ANIMGRAPH_API virtual void DeselectActor(USkeletalMeshComponent* SkelComp){}
|
|
|
|
|
|
|
|
|
|
// called when the widget is dragged in translation mode
|
|
|
|
|
ANIMGRAPH_API virtual void DoTranslation(const USkeletalMeshComponent* SkelComp, FVector& Drag, FAnimNode_Base* InOutAnimNode){}
|
|
|
|
|
// called when the widget is dragged in rotation mode
|
|
|
|
|
ANIMGRAPH_API virtual void DoRotation(const USkeletalMeshComponent* SkelComp, FRotator& Rotation, FAnimNode_Base* InOutAnimNode){}
|
|
|
|
|
// called when the widget is dragged in scale mode
|
|
|
|
|
ANIMGRAPH_API virtual void DoScale(const USkeletalMeshComponent* SkelComp, FVector& Scale, FAnimNode_Base* InOutAnimNode){}
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
protected:
|
|
|
|
|
// Returns the short descriptive name of the controller
|
2014-08-05 14:26:04 -04:00
|
|
|
ANIMGRAPH_API virtual FText GetControllerDescription() const;
|
2014-11-14 05:00:37 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* helper functions for bone control preview
|
|
|
|
|
*/
|
|
|
|
|
// local conversion function for drawing
|
|
|
|
|
void ConvertToComponentSpaceTransform(const USkeletalMeshComponent* SkelComp, const FTransform & InTransform, FTransform & OutCSTransform, int32 BoneIndex, EBoneControlSpace Space) const;
|
|
|
|
|
// convert drag vector in component space to bone space
|
2015-05-19 06:19:22 -04:00
|
|
|
FVector ConvertCSVectorToBoneSpace(const USkeletalMeshComponent* SkelComp, FVector& InCSVector, FCSPose<FCompactPose>& MeshBases, const FName& BoneName, const EBoneControlSpace Space);
|
2014-11-14 05:00:37 -05:00
|
|
|
// convert rotator in component space to bone space
|
2015-05-19 06:19:22 -04:00
|
|
|
FQuat ConvertCSRotationToBoneSpace(const USkeletalMeshComponent* SkelComp, FRotator& InCSRotator, FCSPose<FCompactPose>& MeshBases, const FName& BoneName, const EBoneControlSpace Space);
|
2014-11-14 05:00:37 -05:00
|
|
|
// convert widget location according to bone control space
|
2015-05-19 06:19:22 -04:00
|
|
|
FVector ConvertWidgetLocation(const USkeletalMeshComponent* InSkelComp, FCSPose<FCompactPose>& InMeshBases, const FName& BoneName, const FVector& InLocation, const EBoneControlSpace Space);
|
2014-11-14 05:00:37 -05:00
|
|
|
// set literal value for FVector
|
2015-02-18 03:59:11 -05:00
|
|
|
void SetDefaultValue(const FString& InDefaultValueName, const FVector& InValue);
|
|
|
|
|
// get literal value for vector
|
|
|
|
|
void GetDefaultValue(const FString& UpdateDefaultValueName, FVector& OutVec);
|
|
|
|
|
|
|
|
|
|
void GetDefaultValue(const FString& PropName, FRotator& OutValue)
|
|
|
|
|
{
|
|
|
|
|
FVector Value;
|
|
|
|
|
GetDefaultValue(PropName, Value);
|
|
|
|
|
OutValue.Pitch = Value.X;
|
|
|
|
|
OutValue.Yaw = Value.Y;
|
|
|
|
|
OutValue.Roll = Value.Z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class ValueType>
|
|
|
|
|
ValueType GetNodeValue(const FString& PropName, const ValueType& CompileNodeValue)
|
|
|
|
|
{
|
|
|
|
|
if (IsPinShown(PropName))
|
|
|
|
|
{
|
|
|
|
|
ValueType Val;
|
|
|
|
|
GetDefaultValue(PropName, Val);
|
|
|
|
|
return Val;
|
|
|
|
|
}
|
|
|
|
|
return CompileNodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetDefaultValue(const FString& PropName, const FRotator& InValue)
|
|
|
|
|
{
|
|
|
|
|
FVector VecValue(InValue.Pitch, InValue.Yaw, InValue.Roll);
|
|
|
|
|
SetDefaultValue(PropName, VecValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template<class ValueType>
|
|
|
|
|
void SetNodeValue(const FString& PropName, ValueType& CompileNodeValue, const ValueType& InValue)
|
|
|
|
|
{
|
|
|
|
|
if (IsPinShown(PropName))
|
|
|
|
|
{
|
|
|
|
|
SetDefaultValue(PropName, InValue);
|
|
|
|
|
}
|
|
|
|
|
CompileNodeValue = InValue;
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|