UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PlanePositionGizmo.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7#include "CoreMinimal.h"
8#include "InputState.h"
9#include "InteractiveGizmo.h"
11#include "Math/MathFwd.h"
12#include "Math/Ray.h"
13#include "Math/Vector.h"
14#include "Math/Vector2D.h"
15#include "Templates/Function.h"
17#include "UObject/ObjectPtr.h"
20
21#include "PlanePositionGizmo.generated.h"
22
28class UObject;
30namespace UE::GizmoUtil
31{
32 struct FTransformSubGizmoCommonParams;
33 struct FTransformSubGizmoSharedState;
34}
35
36UCLASS(MinimalAPI)
38{
40
41public:
42 INTERACTIVETOOLSFRAMEWORK_API virtual UInteractiveGizmo* BuildGizmo(const FToolBuilderState& SceneState) const override;
43};
44
45
63UCLASS(MinimalAPI)
65{
67
68public:
73 INTERACTIVETOOLSFRAMEWORK_API bool InitializeAsTranslateGizmo(
76
81 INTERACTIVETOOLSFRAMEWORK_API bool InitializeAsScaleGizmo(
83 bool bDisallowNegativeScaling,
85
94 bool InitializeAsUniformScaleGizmo(
96 bool bDisallowNegativeScaling,
98
99 // UInteractiveGizmo overrides
100
101 INTERACTIVETOOLSFRAMEWORK_API virtual void Setup() override;
102 INTERACTIVETOOLSFRAMEWORK_API virtual void Tick(float DeltaTime) override;
103
104 // IClickDragBehaviorTarget implementation
105
106 INTERACTIVETOOLSFRAMEWORK_API virtual FInputRayHit CanBeginClickDragSequence(const FInputDeviceRay& PressPos) override;
107 INTERACTIVETOOLSFRAMEWORK_API virtual void OnClickPress(const FInputDeviceRay& PressPos) override;
108 INTERACTIVETOOLSFRAMEWORK_API virtual void OnClickDrag(const FInputDeviceRay& DragPos) override;
109 INTERACTIVETOOLSFRAMEWORK_API virtual void OnClickRelease(const FInputDeviceRay& ReleasePos) override;
110 INTERACTIVETOOLSFRAMEWORK_API virtual void OnTerminateDragSequence() override;
111
112 // IHoverBehaviorTarget implementation
113 INTERACTIVETOOLSFRAMEWORK_API virtual FInputRayHit BeginHoverSequenceHitTest(const FInputDeviceRay& PressPos) override;
114 INTERACTIVETOOLSFRAMEWORK_API virtual void OnBeginHover(const FInputDeviceRay& DevicePos) override;
115 INTERACTIVETOOLSFRAMEWORK_API virtual bool OnUpdateHover(const FInputDeviceRay& DevicePos) override;
116 INTERACTIVETOOLSFRAMEWORK_API virtual void OnEndHover() override;
117
118public:
119 // The below properties can be manipulated for more fine-grained control, but typically it is sufficient
120 // to use one of the initialization methods above.
121
123 UPROPERTY()
125
127 UPROPERTY()
129
131 UPROPERTY()
133
135 UPROPERTY()
137
139 UPROPERTY()
141
142public:
144 UPROPERTY()
145 bool bEnableSignedAxis = false;
146
148 UPROPERTY()
149 bool bFlipX = false;
150
152 UPROPERTY()
153 bool bFlipY = false;
154
159 TUniqueFunction<bool()> ShouldUseCustomDestinationFunc = []() {return false; };
160
162 {
163 // Right now we use the custom destination function for aligning to items in the scene, which
164 // we just need the world ray for. If we want to use functions that use other inputs as the
165 // basis for the destination, we would add those parameters here and would make sure that the
166 // gizmo passes them in.
167 const FRay* WorldRay = nullptr;
168 };
169
176 TUniqueFunction<bool(const FCustomDestinationParams& WorldRay, FVector& OutputPoint)> CustomDestinationFunc =
177 [](const FCustomDestinationParams& Params, FVector& OutputPoint) { return false; };
178
179public:
181 UPROPERTY()
182 bool bInInteraction = false;
183
184
185 //
186 // The values below are used in the context of a single click-drag interaction, ie if bInInteraction = true
187 // They otherwise should be considered uninitialized
188 //
189
190 UPROPERTY()
191 FVector InteractionOrigin;
192
193 UPROPERTY()
194 FVector InteractionNormal;
195
196 UPROPERTY()
197 FVector InteractionAxisX;
198
199 UPROPERTY()
200 FVector InteractionAxisY;
201
202
203 UPROPERTY()
204 FVector InteractionStartPoint;
205
206 UPROPERTY()
207 FVector InteractionCurPoint;
208
209 UPROPERTY()
210 FVector2D InteractionStartParameter;
211
212 UPROPERTY()
213 FVector2D InteractionCurParameter;
214
215 UPROPERTY()
216 FVector2D ParameterSigns = FVector2D(1, 1);
217
219 FVector LastHitPosition;
220 FVector2D InitialTargetParameter;
221
222 FVector2D InteractionStartOriginParameterOffset;
224
225 // Helper that can hold some extra upkeep to do during Tick (used to
226 // update a camera axis source if needed).
227 TUniqueFunction<void(float DeltaTime)> CustomTickFunction;
228};
229
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition BehaviorTargetInterfaces.h:91
Definition GizmoInterfaces.h:64
Definition GizmoInterfaces.h:108
Definition GizmoInterfaces.h:272
Definition GizmoInterfaces.h:334
Definition BehaviorTargetInterfaces.h:230
Definition ScriptInterface.h:139
Definition FunctionFwd.h:19
Definition ClickDragBehavior.h:33
Definition InteractiveGizmoBuilder.h:19
Definition InteractiveGizmo.h:29
Definition Object.h:95
Definition PlanePositionGizmo.h:38
Definition PlanePositionGizmo.h:65
Definition FreeRotationSubGizmo.h:18
@ false
Definition radaudio_common.h:23
Definition InputState.h:367
Definition InputState.h:52
Definition ToolContextInterfaces.h:50
Definition ObjectPtr.h:488
Definition TransformSubGizmoUtil.h:37
Definition TransformSubGizmoUtil.h:99
Definition PlanePositionGizmo.h:162