UTransformGizmo

[UTransformGizmo](API\Editor\EditorInteractiveToolsFramework\EditorGizmos\UTransformGizmo) provides standard Transformation Gizmo interactions, applied to a [UTransformProxy](API\Runtime\InteractiveToolsFramework\BaseGizmos\UTransformProxy) target object.

Unreal Engine C++ API Reference > Editor > EditorInteractiveToolsFramework > EditorGizmos

Inheritance Hierarchy

References

   
Module EditorInteractiveToolsFramework
Header /Engine/Source/Editor/Experimental/EditorInteractiveToolsFramework/Public/EditorGizmos/TransformGizmo.h
Include #include "EditorGizmos/TransformGizmo.h"

Syntax

class UTransformGizmo :  
    public [UInteractiveGizmo](API\Runtime\InteractiveToolsFramework\UInteractiveGizmo),  
    public [IHoverBehaviorTarget](API\Runtime\InteractiveToolsFramework\BaseBehaviors\IHoverBehaviorTarget),  
    public [IClickDragBehaviorTarget](API\Runtime\InteractiveToolsFramework\BaseBehaviors\IClickDragBehaviorTarget)  

Remarks

UTransformGizmo provides standard Transformation Gizmo interactions, applied to a UTransformProxy target object. By default the Gizmo will be a standard XYZ translate/rotate Gizmo (axis and plane translation).

Variables

Type Name Description
TObjectPtr< UTr... ActiveTarget The active target object for the Gizmo
TObjectPtr< UMa... AxisMaterialX  
TObjectPtr< UMa... AxisMaterialY  
TObjectPtr< UMa... AxisMaterialZ  
bool bDisallowNegativeScaling  
bool bGridSizeIsExplicit Optional grid size which overrides the Context Grid
bool bInInteraction Whether gizmo is interacting.
bool bRotationGridSizeIsExplicit Optional grid size which overrides the Context Rotation Grid
bool bSnapToWorldGrid If true, then when using world frame, Axis and Plane translation snap to the world grid via the ContextQueriesAPI (in PositionSnapFunction)
bool bSnapToWorldRotGrid If true, then when using world frame, Axis and Plane translation snap to the world grid via the ContextQueriesAPI (in RotationSnapFunction)
bool bVisible Whether gizmo is visible.
TObjectPtr< UGi... CameraAxisSource Axis that points towards camera, X/Y plane tangents aligned to right/up.
TObjectPtr< UMa... CurrentAxisMaterial  
TEnumAsByte< EA... CurrentAxisToDraw Currently rendered axis list
EGizmoTransform... CurrentMode Currently rendered transform mode
FTransform CurrentTransform Current transform
TFunction< cons... CustomizationFunction Customization function (to override default material or increment gizmo size for example)
TUniqueFunction... DestinationAlignmentRayCaster  
FVector ExplicitGridSize  
FRotator ExplicitRotationGridSize  
TObjectPtr< UGi... GizmoElementRoot Root of renderable gizmo elements
TObjectPtr< UGi... GizmoViewContext Gizmo view context, needed for screen space interactions
TObjectPtr< UMa... GreyMaterial  
TObjectPtr< UMa... GridMaterial  
TObjectPtr< UGi... HitTarget The hit target object
float InteractionAxisCurrParam Active interaction current hit param (only valid between state target BeginModify/EndModify)
FVector InteractionAxisDirection Active world space axis (only valid between state target BeginModify/EndModify)
TEnumAsByte< EA... InteractionAxisList The values below are used in the context of a single click-drag interaction, ie if bInInteraction = true They otherwise should be considered uninitializedActive axis type (only valid between state target BeginModify/EndModify)
FVector InteractionAxisOrigin Active world space axis origin (only valid between state target BeginModify/EndModify)
float InteractionAxisStartParam Active interaction start hit param (only valid between state target BeginModify/EndModify)
float InteractionCurrAngle Active interaction rotation curr angle (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarAxisX Active world space axis X used for planar (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarAxisY Active world space axis Y used for planar (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarCurrPoint Active interaction current point planar (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarNormal Active world space normal used for planar (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarOrigin Active world space planar origin (only valid between state target BeginModify/EndModify)
FVector InteractionPlanarStartPoint Active interaction start point planar (only valid between state target BeginModify/EndModify)
FVector2D InteractionScreenAxisDirection Active interaction screen axis dir (only valid between state target BeginModify/EndModify)
FVector2D InteractionScreenCurrPos Active interaction screen current pos (only valid between state target BeginModify/EndModify)
FVector2D InteractionScreenEndPos Active interaction screen end pos (only valid between state target BeginModify/EndModify)
FVector2D InteractionScreenStartPos Active interaction screen start pos (only valid between state target BeginModify/EndModify)
float InteractionStartAngle Active interaction rotation start angle (only valid between state target BeginModify/EndModify)
ETransformGizmo... LastHitPart Last hit part
TObjectPtr< UCl... MouseBehavior The mouse click behavior of the gizmo is accessible so that it can be modified to use different mouse keys.
TArray< TFuncti... OnClickDragFunctions Array of function pointers, indexed by gizmo part id, to handle click drag behavior
TArray< TFuncti... OnClickPressFunctions Array of function pointers, indexed by gizmo part id, to handle click press behavior
TArray< TFuncti... OnClickReleaseFunctions Array of function pointers, indexed by gizmo part id, to handle click release behavior
TArray< TFuncti... OnUpdateHoverFunctions Array of function pointers, indexed by gizmo part id, to handle update hovering state
TArray< TFuncti... OnUpdateInteractingFunctions Array of function pointers, indexed by gizmo part id, to handle update interacting state
TObjectPtr< UMa... OpaquePlaneMaterialXY  
TObjectPtr< UGi... RotateArcballInnerElement Rotate arcball inner circle
TObjectPtr< UGi... RotateArcballOuterElement Rotate arcball outer circle
TObjectPtr< UGi... RotateOuterCircleElement Rotate outer circle
TObjectPtr< UGi... RotateScreenSpaceElement Rotate screen space circle
TObjectPtr< UGi... RotateXAxisElement Rotate X Axis
TObjectPtr< UGi... RotateYAxisElement Rotate Y Axis
TObjectPtr< UGi... RotateZAxisElement Rotate Z Axis
double ScaleMultiplier Percentage-based scale multiplier
TObjectPtr< UGi... ScalePlanarXYElement Scale planar XY handle
TObjectPtr< UGi... ScalePlanarXZElement Scale planar XZ handle
TObjectPtr< UGi... ScalePlanarYZElement Scale planar YZ handle
TObjectPtr< UGi... ScaleUniformElement Uniform scale object
TObjectPtr< UGi... ScaleXAxisElement Scale X Axis object
TObjectPtr< UGi... ScaleYAxisElement Scale Y Axis object
TObjectPtr< UGi... ScaleZAxisElement Scale Z Axis object
TUniqueFunction... ShouldAlignDestination These are used to let the translation subgizmos use raycasts into the scene to align the gizmo with scene geometry.
TScriptInterfac... StateTarget The state target is created internally during SetActiveTarget() if no one is provided.
TScriptInterfac... TransformGizmoSource Transform Gizmo Source
TObjectPtr< UGi... TranslatePlanarXYElement Translate planar XY handle
TObjectPtr< UGi... TranslatePlanarXZElement Translate planar XZ handle
TObjectPtr< UGi... TranslatePlanarYZElement Translate planar YZ handle
TObjectPtr< UGi... TranslateScreenSpaceElement Translate screen-space
TObjectPtr< UGi... TranslateXAxisElement Gizmo Objects, used for rendering and hit testingTranslate X Axis
TObjectPtr< UGi... TranslateYAxisElement Translate Y Axis
TObjectPtr< UGi... TranslateZAxisElement Translate Z Axis
TObjectPtr< UMa... TransparentVertexColorMaterial Materials and colors to be used when drawing the items for each axis
TObjectPtr< UMa... WhiteMaterial  

Functions

Type Name Description
void ApplyRotateDelta ( const FQuat& InRotateDelta ) Apply rotate delta to transform proxy
void ApplyScaleDelta ( const FVector& InScaleDelta ) Apply scale delta to transform proxy
void ApplyTranslateDelta ( const FVector& InTranslateDelta ) Apply transform delta methodsApply translate delta to transform proxy
void ClearActiveTarget () Clear the active target object for the Gizmo
FQuat ComputeAngularRotateDelta ( double InStartAngle, double InEndAngle ) Compute rotate delta based on start/end angles
FQuat ComputeAxisRotateDelta ( const FVector2D& InStartPos, const FVector2D& InEndPos ) Compute rotate delta based on screen-space start/end positions
FVector ComputeAxisTranslateDelta ( double InStartParam, double InEndParam ) Compute translate axis delta based on start/end params
FVector ComputePlanarTranslateDelta ( const FVector& InStartPoint, const FVector& InEndPoint ) Compute translate planar delta based on world space start/end points
FVector ComputeScaleDelta ( const FVector2D& InStartPos, const FVector2D& InEndPos, FVector2D& OutScreenDelta ) Compute scale delta based on screen space start/end positions
void EnableMode ( EGizmoTransformMode InGizmoMode, EAxisList::Type InAxisListToDraw ) Enable the given mode with the specified axes, EAxisList::Type::None will hide objects associated with mode
void EnablePlanarObjects ( bool bTranslate, bool bEnableX, bool bEnableY, bool bEnableZ ) Enable planar handles used by translate and scale
void EnableRotate ( EAxisList::Type InAxisListToDraw ) Enable rotate using specified axis list
void EnableScale ( EAxisList::Type InAxisListToDraw ) Enable scale using specified axis list
void EnableTranslate ( EAxisList::Type InAxisListToDraw ) Enable translate using specified axis list
FTransform GetGizmoTransform () Get gizmo transform based on cached current transform.
uint32 GetMaxPartIdentifier () Get max part identifier.
float GetNearestRayParamToInteractionAxis ( const FInputDeviceRay& InRay ) Get nearest param along input ray to the current interaction axis
bool GetRayParamIntersectionWithInteractionPlane ( const FInputDeviceRay& InRay, float& OutHitParam ) Return true if input ray intersects current interaction plane and return param along ray in OutHitParam
FVector2D GetScreenProjectedAxis ( const UGizmoViewContext* View, const FVector& InLocalAxis, const FTransform& InLocalToWorld ) Screen-space helper methodReturns 2D vector projection of input axis onto input view plane
FVector2D GetScreenRotateAxisDir ( const FVector& InAxis0, const FVector& InAxis1 ) Get screen-space axis for rotation drag
FVector GetWorldAxis ( const FVector& InAxis ) Get current interaction axis
UGizmoElemen... MakePlanarHandle ( ETransformGizmoPartIdentifier InPar..., const FVector& InUpDirection, const FVector& InSideDirection, const FVector& InPlaneNormal, UMaterialInterface* InMaterial, const FLinearColor& InVertexColor ) Construct planar axis handle
UGizmoElemen... MakeRotateAxis ( ETransformGizmoPartIdentifier InPar..., const FVector& TorusAxis0, const FVector& TorusAxis1, UMaterialInterface* InMaterial, UMaterialInterface* InCurrentM... ) Construct rotate axis handle
UGizmoElemen... MakeRotateCircleHandle ( ETransformGizmoPartIdentifier InPar..., float InRadius, const FLinearColor& InColor, float bFill ) Construct rotate screen space handle
UGizmoElemen... MakeScaleAxis ( ETransformGizmoPartIdentifier InPar..., const FVector& InAxisDir, const FVector& InSideDir, UMaterialInterface* InMaterial ) Construct scale axis handle
UGizmoElemen... MakeTranslateAxis ( ETransformGizmoPartIdentifier InPar..., const FVector& InAxisDir, const FVector& InSideDir, UMaterialInterface* InMaterial ) Construct translate axis handle
UGizmoElemen... MakeTranslateScreenSpaceHandle () Construct translate screen space handle
UGizmoElemen... MakeUniformScaleHandle () Construct uniform scale handle
void OnClickDragRotateAxis ( const FInputDeviceRay& DragPos ) Handle click drag for rotate axis
void OnClickDragScale ( const FInputDeviceRay& DragPos ) Handle click drag for all scale
void OnClickDragScaleAxis ( const FInputDeviceRay& DragPos ) Handle click drag for scale axes
void OnClickDragScalePlanar ( const FInputDeviceRay& DragPos ) Handle click drag for scale planar
void OnClickDragScaleXYZ ( const FInputDeviceRay& DragPos ) Handle click drag for uniform scale
void OnClickDragScreenSpaceRotate ( const FInputDeviceRay& DragPos ) Handle click drag for screen-space rotate
void OnClickDragScreenSpaceTranslate ( const FInputDeviceRay& DragPos ) Handle click drag for screen-space translate
void OnClickDragTranslateAxis ( const FInputDeviceRay& DragPos ) Handle click drag for translate axes
void OnClickDragTranslatePlanar ( const FInputDeviceRay& DragPos ) Handle click drag for translate planar
void OnClickPressAxis ( const FInputDeviceRay& PressPos ) Handle click press for translate axes
void OnClickPressPlanar ( const FInputDeviceRay& PressPos ) Handle click press for generic planar
void OnClickPressRotateXAxis ( const FInputDeviceRay& PressPos ) Rotate interaction methodsHandle click press for rotate X axis
void OnClickPressRotateYAxis ( const FInputDeviceRay& PressPos ) Handle click press for rotate Y axis
void OnClickPressRotateZAxis ( const FInputDeviceRay& PressPos ) Handle click press for rotate Z axis
void OnClickPressScale ( const FInputDeviceRay& PressPos ) Handle click press for all scale methods
void OnClickPressScaleXAxis ( const FInputDeviceRay& PressPos ) Scale click-drag handling methodsHandle click press for scale X axis
void OnClickPressScaleXYPlanar ( const FInputDeviceRay& PressPos ) Handle click press for scale XY planar
void OnClickPressScaleXYZ ( const FInputDeviceRay& PressPos ) Handle click press for uniform scale
void OnClickPressScaleXZPlanar ( const FInputDeviceRay& PressPos ) Handle click press for scale XZ planar
void OnClickPressScaleYAxis ( const FInputDeviceRay& PressPos ) Handle click press for scale Y axis
void OnClickPressScaleYZPlanar ( const FInputDeviceRay& PressPos ) Handle click press for scale YZ planar
void OnClickPressScaleZAxis ( const FInputDeviceRay& PressPos ) Handle click press for scale Z axis
void OnClickPressScreenSpaceRotate ( const FInputDeviceRay& PressPos ) Screen-space rotate interaction methodsHandle click press for screen-space rotate
void OnClickPressScreenSpaceTranslate ( const FInputDeviceRay& PressPos ) Screen-space translate interaction methodsHandle click press for screen-space translate
void OnClickPressTranslateXAxis ( const FInputDeviceRay& PressPos ) Translate axis click-drag handling methods Handle click press for translate X axis
void OnClickPressTranslateXYPlanar ( const FInputDeviceRay& PressPos ) Translate and scale planar click-drag handling methodsHandle click press for translate XY planar
void OnClickPressTranslateXZPlanar ( const FInputDeviceRay& PressPos ) Handle click press for translate XZ planar
void OnClickPressTranslateYAxis ( const FInputDeviceRay& PressPos ) Handle click press for translate Y axis
void OnClickPressTranslateYZPlanar ( const FInputDeviceRay& PressPos ) Handle click press for translate YZ planar
void OnClickPressTranslateZAxis ( const FInputDeviceRay& PressPos ) Handle click press for translate Z axis
void OnClickReleaseRotateAxis ( const FInputDeviceRay& ReleasePos ) Handle click release for rotate axes
void OnClickReleaseScaleAxis ( const FInputDeviceRay& ReleasePos ) Handle click release for scale axes
void OnClickReleaseScalePlanar ( const FInputDeviceRay& ReleasePos ) Handle click release for scale planar
void OnClickReleaseScaleXYZ ( const FInputDeviceRay& ReleasePos ) Handle click release for uniform scale
void OnClickReleaseScreenSpaceRotate ( const FInputDeviceRay& ReleasePos ) Handle click release for screen-space rotate
void OnClickReleaseScreenSpaceTranslate ( const FInputDeviceRay& ReleasePos ) Handle click release for screen-space translate
void OnClickReleaseTranslateAxis ( const FInputDeviceRay& ReleasePos ) Handle click release for translate axes
void OnClickReleaseTranslatePlanar ( const FInputDeviceRay& ReleasePos ) Handle click release for translate planar
bool PositionSnapFunction ( const FVector& WorldPosition, FVector& SnappedPositionOut ) Axis and Plane TransformSources use this function to execute worldgrid snap queries.
FQuat RotationSnapFunction ( const FQuat& DeltaRotation )  
void SetActiveTarget ( UTransformProxy* Target, IToolContextTransactionProvider..., IGizmoStateTarget* InStateTarg... ) Set the active target object for the Gizmo
void SetCustomizationFunction ( const TFunction< const FGizmoCustom... ) Set customization function for this Gizmo
void SetDisallowNegativeScaling ( bool bDisallow ) By default, the nonuniform scale components can scale negatively.
void SetNewChildScale ( const FVector& NewChildScale ) Explicitly set the child scale.
void SetupBehaviors () Setup behaviors
void SetupMaterials () Setup materials
void SetupOnClickFunctions () Setup on click functions
void SetVisibility ( bool bVisible ) Set visibility for this Gizmo
void UpdateCameraAxisSource () Internal function that updates CameraAxisSource by getting current view state from GizmoManager
FInputRayHit UpdateHoveredPart ( const FInputDeviceRay& DevicePos ) Determine hit part and update hover state based on current input ray
void UpdateHoverState ( bool bInHover, ETransformGizmoPartIdentifier InPar... ) Update hover state for given part id
void UpdateInteractingState ( bool bInInteracting, ETransformGizmoPartIdentifier InPar... ) Update interacting state for given part id
void UpdateMode () Update current gizmo mode based on transform source
bool VerifyPartIdentifier ( uint32 InPartIdentifier ) Verify part identifier is within recognized range of transform gizmo part ids.

Overridden from UInteractiveGizmo

Type Name Description
void Render ( IToolsContextRenderAPI* Render... ) Allow the Gizmo to do any custom drawing (ie via PDI/RHI)
void Setup () Called by GizmoManager to initialize the Gizmo after GizmoBuilder::BuildGizmo() has been called
void Shutdown () Called by GizmoManager to shut down the Gizmo
void Tick ( float DeltaTime ) Allow the Gizmo to do any necessary processing on Tick

Overridden from IHoverBehaviorTarget

Type Name Description
FInputRayHit BeginHoverSequenceHitTest ( const FInputDeviceRay& DevicePos ) IHoverBehaviorTarget implementation.
void OnBeginHover ( const FInputDeviceRay& DevicePos ) Initialize hover sequence at given position
void OnEndHover () Terminate active hover sequence
bool OnUpdateHover ( const FInputDeviceRay& DevicePos ) Update active hover sequence with new input position

Overridden from IClickDragBehaviorTarget

Type Name Description
FInputRayHit CanBeginClickDragSequence ( const FInputDeviceRay& PressPos ) IClickDragBehaviorTarget implementation.
void OnClickDrag ( const FInputDeviceRay& DragPos ) Notify Target that input position has changed
void OnClickPress ( const FInputDeviceRay& PressPos ) Notify Target that click press ocurred
void OnClickRelease ( const FInputDeviceRay& ReleasePos ) Notify Target that click release occurred
void OnTerminateDragSequence () Notify Target that click-drag sequence has been explicitly terminated (eg by escape key)

Constants

Name Description
ArcBallColor A linear, 32-bit/component floating point RGBA color.
AxisColorX  
AxisColorY A linear, 32-bit/component floating point RGBA color.
AxisColorZ A linear, 32-bit/component floating point RGBA color.
AxisLengthOffset  
AxisRadius  
AxisTransp  
CurrentColor A linear, 32-bit/component floating point RGBA color.
GreyColor A linear, 32-bit/component floating point RGBA color.
LargeOuterAlpha  
PlanarHandleOffset  
PlanarHandleSize  
PlaneColorXY A linear, 32-bit/component floating point RGBA color.
RotateArcballCircleColor  
RotateArcballInnerRadius Rotate constants.
RotateArcballOuterRadius  
RotateArcballSphereRadius  
RotateAxisInnerRadius  
RotateAxisInnerSlices  
RotateAxisNumSegments  
RotateAxisOuterRadius  
RotateOuterCircleColor  
RotateOuterCircleRadius  
RotateScreenSpaceCircleColor  
RotateScreenSpaceRadius  
ScaleAxisCubeDim  
ScaleAxisLength  
ScreenAxisColor A linear, 32-bit/component floating point RGBA color.
ScreenSpaceColor A linear, 32-bit/component floating point RGBA color.
TranslateAxisConeAngle  
TranslateAxisConeHeight  
TranslateAxisConeRadius  
TranslateAxisLength  
TranslateScreenSpaceHandleSize  
WhiteColor A linear, 32-bit/component floating point RGBA color.

Ask questions and help your peers Developer Forums

Write your own tutorials or read those from others Learning Library