Files
UnrealEngineUWP/Engine/Source/Runtime/InteractiveToolsFramework/Public/InteractiveGizmo.h
Ryan Schmidt 4bf9cf5c0b ToolsFramework: rename modeling-mode UTransformGizmo to UCombinedTransformGizmo so that Editor can use this class name, update all usage
#rb none
#rnx
#jira none
#preflight 6154a3e0475173000105df9b

#ushell-cherrypick of 17666089 by Ryan.Schmidt

[CL 17672826 by Ryan Schmidt in ue5-main branch]
2021-09-29 23:19:52 -04:00

132 lines
3.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "InputBehaviorSet.h"
#include "ToolContextInterfaces.h"
#include "InteractiveGizmo.generated.h"
class UInteractiveGizmoManager;
class FCanvas;
/**
* UInteractiveGizmo is the base class for all Gizmos in the InteractiveToolsFramework.
*
* @todo callback/delegate for if/when .InputBehaviors changes
* @todo callback/delegate for when Gizmo properties change
*/
UCLASS(Transient)
class INTERACTIVETOOLSFRAMEWORK_API UInteractiveGizmo : public UObject, public IInputBehaviorSource
{
GENERATED_BODY()
public:
UInteractiveGizmo();
/**
* Called by GizmoManager to initialize the Gizmo *after* GizmoBuilder::BuildGizmo() has been called
*/
virtual void Setup();
/**
* Called by GizmoManager to shut down the Gizmo
*/
virtual void Shutdown();
/**
* Allow the Gizmo to do any custom drawing (ie via PDI/RHI)
* @param RenderAPI Abstraction that provides access to Rendering in the current ToolsContext
*/
virtual void Render(IToolsContextRenderAPI* RenderAPI);
/**
* Allow the Gizmo to do any custom screen space drawing
* @param Canvas the FCanvas to use to do the drawing
* @param RenderAPI Abstraction that provides access to Rendering in the current ToolsContext
*/
virtual void DrawHUD( FCanvas* Canvas, IToolsContextRenderAPI* RenderAPI );
/**
* Allow the Gizmo to do any necessary processing on Tick
* @param DeltaTime the time delta since last tick
*/
virtual void Tick(float DeltaTime);
/**
* @return GizmoManager that owns this Gizmo
*/
virtual UInteractiveGizmoManager* GetGizmoManager() const;
//
// Input Behaviors support
//
/**
* Add an input behavior for this Gizmo
* @param Behavior behavior to add
*/
virtual void AddInputBehavior(UInputBehavior* Behavior);
/**
* @return Current input behavior set.
*/
virtual const UInputBehaviorSet* GetInputBehaviors() const;
protected:
/** The current set of InputBehaviors provided by this Gizmo */
UPROPERTY()
TObjectPtr<UInputBehaviorSet> InputBehaviors;
};
/**
* ETransformGizmoSubElements identifies the sub-elements of a standard 3-axis transformation Gizmo.
* Used by GizmoManager to customize UCombinedTransformGizmo instances.
*/
UENUM()
enum class ETransformGizmoSubElements
{
None = 0,
TranslateAxisX = 1<<1,
TranslateAxisY = 1<<2,
TranslateAxisZ = 1<<3,
TranslateAllAxes = TranslateAxisX | TranslateAxisY | TranslateAxisZ,
TranslatePlaneXY = 1<<4,
TranslatePlaneXZ = 1<<5,
TranslatePlaneYZ = 1<<6,
TranslateAllPlanes = TranslatePlaneXY | TranslatePlaneXZ | TranslatePlaneYZ,
RotateAxisX = 1<<7,
RotateAxisY = 1<<8,
RotateAxisZ = 1<<9,
RotateAllAxes = RotateAxisX | RotateAxisY | RotateAxisZ,
ScaleAxisX = 1<<10,
ScaleAxisY = 1<<11,
ScaleAxisZ = 1<<12,
ScaleAllAxes = ScaleAxisX | ScaleAxisY | ScaleAxisZ,
ScalePlaneYZ = 1<<13,
ScalePlaneXZ = 1<<14,
ScalePlaneXY = 1<<15,
ScaleAllPlanes = ScalePlaneXY | ScalePlaneXZ | ScalePlaneYZ,
ScaleUniform = 1<<16,
StandardTranslateRotate = TranslateAllAxes | TranslateAllPlanes | RotateAllAxes,
TranslateRotateUniformScale = TranslateAllAxes | TranslateAllPlanes | RotateAllAxes | ScaleUniform,
FullTranslateRotateScale = TranslateAllAxes | TranslateAllPlanes | RotateAllAxes | ScaleAllAxes | ScaleAllPlanes | ScaleUniform
};
ENUM_CLASS_FLAGS(ETransformGizmoSubElements);