Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Private/EditModes/TwoBoneIKEditMode.h
thomas sarkanen 9e7c191aca Anim blueprint editor modes now display transform toolbar
Deferred to the active editor modes when determining transform toolbar visibility
Updated existing edit modes to correctly update their available widget modes

#rb Nick.Brett
#preflight 61ba0002590498f205a19fb2

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 18467669 via CL 18467672 via CL 18467673 via CL 18468089 via CL 18468141
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18468161 by thomas sarkanen in ue5-release-engine-test branch]
2021-12-15 12:17:40 -05:00

64 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UnrealWidgetFwd.h"
#include "AnimNodeEditMode.h"
#include "AnimGraphNode_TwoBoneIK.h"
class FEditorViewportClient;
class FPrimitiveDrawInterface;
class USkeletalMeshComponent;
struct FViewportClick;
class FTwoBoneIKEditMode : public FAnimNodeEditMode
{
public:
/** Bone selection mode */
enum BoneSelectModeType
{
BSM_EndEffector,
BSM_JointTarget,
BSM_Max
};
FTwoBoneIKEditMode();
/** IAnimNodeEditMode interface */
virtual void EnterMode(class UAnimGraphNode_Base* InEditorNode, struct FAnimNode_Base* InRuntimeNode) override;
virtual void ExitMode() override;
virtual FVector GetWidgetLocation() const override;
virtual UE::Widget::EWidgetMode GetWidgetMode() const override;
virtual bool UsesTransformWidget(UE::Widget::EWidgetMode InWidgetMode) const override;
FBoneSocketTarget GetSelectedTarget() const;
virtual void DoTranslation(FVector& InTranslation) override;
/** FEdMode interface */
virtual void Render(const FSceneView* View, FViewport* Viewport, FPrimitiveDrawInterface* PDI) override;
virtual bool HandleClick(FEditorViewportClient* InViewportClient, HHitProxy* HitProxy, const FViewportClick& Click) override;
virtual void Tick(FEditorViewportClient* ViewportClient, float DeltaTime) override;
protected:
void OnExternalNodePropertyChange(FPropertyChangedEvent& InPropertyEvent);
FDelegateHandle NodePropertyDelegateHandle;
private:
/** Helper function for Render() */
void DrawTargetLocation(FPrimitiveDrawInterface* PDI, BoneSelectModeType InBoneSelectMode, const FColor& TargetColor, const FColor& BoneColor) const;
/** Helper funciton for GetWidgetLocation() and joint rendering */
FVector GetWidgetLocation(BoneSelectModeType InBoneSelectMode) const;
private:
/** Cache the typed nodes */
struct FAnimNode_TwoBoneIK* TwoBoneIKRuntimeNode;
UAnimGraphNode_TwoBoneIK* TwoBoneIKGraphNode;
/** The current bone selection mode */
BoneSelectModeType BoneSelectMode;
/** The bone space we last saw for the current node */
EBoneControlSpace PreviousBoneSpace;
};