UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TransformSubGizmoUtil.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "InteractiveGizmo.h"
7#include "Math/Axis.h"
8#include "Math/MathFwd.h" // FTransform
9#include "Misc/Optional.h"
10
11struct FLinearColor;
12class FText;
19class UObject;
20class UPrimitiveComponent;
21class UStaticMesh;
22class UTransformProxy;
24
30namespace UE::GizmoUtil
31{
37 {
38 UPrimitiveComponent* Component = nullptr;
41
42 // If true, we use the axis of the root gizmo component. If false, we use an axis of the
43 // component itself, which is determined by its transform. Does not attempt to use shared
44 // state for axis if false.
46
47 // Optional parameters:
48
49 // Default transaction name and provider are used if not provided. Not used if one is gotten from
50 // shared state.
53
54 // Transient package is used if custom outer is not provided
56
57 // If true, the gizmo moves the parent root component rather than just its own component, like
58 // the standard TRS sub gizmos do. If false, the gizmo moves just its component, leaving the
59 // parent in place. Does not attempt to use shared state for transform source or state target
60 // if false.
62
63 //~ The default hover behavior is to forward the hover information to the component via the
64 //~ IGizmoBaseComponentInterface. We could give the user a way to place a custom hover function
65 //~ like we have in deprecated initialization methods, but that is unclear to be worth it, as
66 //~ it is likely to be cleaner to implement the interface on any custom components.
67 //~TFunction<void(bool)> CustomUpdateHoverFunction;
68
69 // Returns the Axis parameter as an index in the range [0,2] where 0
70 // corresponds to X (or None), 1 corresponds to Y, and 2 corresponds to Z.
72 {
73 return (Axis == EAxis::Y) ? 1
74 : (Axis == EAxis::Z) ? 2
75 : 0;
76 }
77 };
78
106
115
116 // Parameter struct for InitializeSubGizmoElementsWithMesh
118 {
119 // Required parameters:
120
122 // If there are multiple elements, the same mesh will be set for all of them. This makes
123 // it easy to, for example, set all of the arrow components at once.
125 UStaticMesh* Mesh = nullptr;
126
127 // Optional parameters:
128
130
131 // When true, ComponentToGizmo is adjusted such that the gizmo basis points along
132 // the relevant element axis. This allows ComponentToGizmo to be specified once
133 // for the x axis case, and be reused for the y/z axes with the proper rotation.
135
136 // When true, the sub gizmo is mirrored across the gizmo origin depending on where
137 // in relation to the gizmo the camera is positioned.
139
140 // Leaving this unset causes the color to be determined by axis.
142
143 // Mesh to swap in when the user is dragging the gizmo.
145 // Only used when SubstituteInteractionMesh is being set
147 };
148
157
158}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ETransformGizmoSubElements
Definition InteractiveGizmo.h:105
Definition Text.h:385
Definition InteractiveToolChange.h:39
Definition Array.h:670
Definition CombinedTransformGizmo.h:337
Definition AxisSources.h:144
Definition AxisSources.h:56
Definition TransformSources.h:223
Definition StateTargets.h:168
Definition Object.h:95
Definition StaticMesh.h:593
Definition TransformProxy.h:40
Definition ViewAdjustedStaticMeshGizmoComponent.h:26
Type
Definition Axis.h:11
@ Z
Definition Axis.h:15
@ Y
Definition Axis.h:14
@ None
Definition Axis.h:12
Definition FreeRotationSubGizmo.h:18
INTERACTIVETOOLSFRAMEWORK_API void InitializeSubGizmoElementsWithMesh(const FInitMeshSubGizmoParams &Params, TArray< TPair< ETransformGizmoSubElements, UViewAdjustedStaticMeshGizmoComponent * > > *ElementComponentsOut=nullptr)
Definition TransformSubGizmoUtil.cpp:38
INTERACTIVETOOLSFRAMEWORK_API FTransform GetRotatedBasisTransform(const FTransform &TransformIn, EAxis::Type AxisToBeX)
Definition TransformSubGizmoUtil.cpp:15
Definition Color.h:48
Definition Optional.h:131
Definition Tuple.h:652
Definition TransformSubGizmoUtil.h:118
UStaticMesh * Mesh
Definition TransformSubGizmoUtil.h:125
bool bMirrorBasedOnOctant
Definition TransformSubGizmoUtil.h:138
FTransform SubstituteMeshToComponent
Definition TransformSubGizmoUtil.h:146
FTransform ComponentToGizmo
Definition TransformSubGizmoUtil.h:129
UStaticMesh * SubstituteInteractionMesh
Definition TransformSubGizmoUtil.h:144
ETransformGizmoSubElements Elements
Definition TransformSubGizmoUtil.h:124
UCombinedTransformGizmo * ParentGizmo
Definition TransformSubGizmoUtil.h:121
bool bRotateTransformBasisBasedOnElement
Definition TransformSubGizmoUtil.h:134
TOptional< FLinearColor > Color
Definition TransformSubGizmoUtil.h:141
Definition TransformSubGizmoUtil.h:37
TOptional< FText > TransactionName
Definition TransformSubGizmoUtil.h:51
IToolContextTransactionProvider * TransactionProvider
Definition TransformSubGizmoUtil.h:52
UTransformProxy * TransformProxy
Definition TransformSubGizmoUtil.h:39
bool bAxisIsBasedOnRootComponent
Definition TransformSubGizmoUtil.h:45
bool bManipulatesRootComponent
Definition TransformSubGizmoUtil.h:61
int GetClampedAxisIndex() const
Definition TransformSubGizmoUtil.h:71
EAxis::Type Axis
Definition TransformSubGizmoUtil.h:40
UObject * OuterForSubobjects
Definition TransformSubGizmoUtil.h:55
UPrimitiveComponent * Component
Definition TransformSubGizmoUtil.h:38
Definition TransformSubGizmoUtil.h:99
UGizmoTransformChangeStateTarget * StateTarget
Definition TransformSubGizmoUtil.h:101
UGizmoConstantFrameAxisSource * CameraAxisSource
Definition TransformSubGizmoUtil.h:102
UGizmoComponentAxisSource * UnitCardinalAxisSources[3]
Definition TransformSubGizmoUtil.h:104
UGizmoScaledAndUnscaledTransformSources * TransformSource
Definition TransformSubGizmoUtil.h:100
UGizmoComponentAxisSource * CardinalAxisSources[3]
Definition TransformSubGizmoUtil.h:103
static CORE_API const TTransform< double > Identity
Definition TransformNonVectorized.h:58