UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SRotatorInputBox.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Layout/Margin.h"
10#include "Widgets/SWidget.h"
12#include "Styling/CoreStyle.h"
16
18
22template<typename NumericType>
24{
26 static constexpr int32 ComponentNum = 3;
27public:
30
33
35 : _RollDisplayName(AxisDisplayInfo::GetRotationAxisNameShort(EAxisList::X))
36 , _PitchDisplayName(AxisDisplayInfo::GetRotationAxisNameShort(EAxisList::Y))
37 , _YawDisplayName(AxisDisplayInfo::GetRotationAxisNameShort(EAxisList::Z))
39 , _Swizzle(FIntVector4(0, 1, 2, 3))
40 , _Font(FAppStyle::Get().GetFontStyle("NormalFont"))
42 , _SpinDelta(1.f)
44 , _MinSliderValue(TOptional<NumericType>())
45 , _MaxSliderValue(TOptional<NumericType>())
50 , _TogglePadding( FMargin( 1.f,0.f,1.f,0.f ) )
52 {}
53
56
57
59
60
62
64
66
68
69
71
72
76
77
79
80
82
83
84 SLATE_ATTRIBUTE(NumericType, SpinDelta)
85
86
87 SLATE_ATTRIBUTE(int32, LinearDeltaSensitivity)
88
89
91
92
94
95
97
98
100
101
103
104
106
107
109
110
112
113
114 SLATE_EVENT(FSimpleDelegate, OnBeginSliderMovement)
115
116
117 SLATE_EVENT(FOnNumericValueChanged, OnEndSliderMovement)
118
119
121
122
124
125
127
128
130
131
133
134
136
137
139
140
142
143
145
146
148
149
151
152
154
155
157
158
160
161
163
164
165 SLATE_ARGUMENT(bool, PreventThrottling)
166
168
169private:
170
171 TAttribute<TOptional<FTextFormat>> BuildToolTipTextFormatString(FStringView DisplayNameString)
172 {
177 return Attribute;
178 }
179
180 TSharedRef<SWidget> ConstructRoll(const FArguments& InArgs)
181 {
184 .AllowSpin(InArgs._AllowSpin)
185 .Delta(InArgs._SpinDelta)
186 .LinearDeltaSensitivity(InArgs._LinearDeltaSensitivity)
187 .MinValue(InArgs._MinSliderValue)
188 .MaxValue(InArgs._MaxSliderValue)
189 .MinSliderValue(InArgs._MinSliderValue)
190 .MaxSliderValue(InArgs._MaxSliderValue)
191 .LabelPadding(FMargin(3.0f))
193 .Label()
194 [
196 ]
197 .Font( InArgs._Font )
198 .Value( InArgs._Roll )
200 .OnValueCommitted( InArgs._OnRollCommitted )
203 .UndeterminedString( NSLOCTEXT("SRotatorInputBox", "MultipleValues", "Multiple Values") )
204 .ToolTipTextFormat(BuildToolTipTextFormatString(InArgs._RollDisplayName.Get().ToString()))
206 .MinFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMinFractionalDigits() : TOptional<int32>())
207 .MaxFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMaxFractionalDigits() : TOptional<int32>())
212 .PreventThrottling(InArgs._PreventThrottling);
213 return Widget;
214 };
215
216 TSharedRef<SWidget> ConstructPitch(const FArguments& InArgs)
217 {
220 .AllowSpin(InArgs._AllowSpin)
221 .Delta(InArgs._SpinDelta)
222 .LinearDeltaSensitivity(InArgs._LinearDeltaSensitivity)
223 .MinValue(InArgs._MinSliderValue)
224 .MaxValue(InArgs._MaxSliderValue)
225 .MinSliderValue(InArgs._MinSliderValue)
226 .MaxSliderValue(InArgs._MaxSliderValue)
227 .LabelPadding(FMargin(3.0f))
229 .Label()
230 [
232 ]
233 .Font( InArgs._Font )
234 .Value( InArgs._Pitch )
236 .OnValueCommitted( InArgs._OnPitchCommitted )
239 .UndeterminedString( NSLOCTEXT("SRotatorInputBox", "MultipleValues", "Multiple Values") )
240 .ToolTipTextFormat(BuildToolTipTextFormatString(InArgs._PitchDisplayName.Get().ToString()))
242 .MinFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMinFractionalDigits() : TOptional<int32>())
243 .MaxFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMaxFractionalDigits() : TOptional<int32>())
248 .PreventThrottling(InArgs._PreventThrottling);
249 return Widget;
250 };
251
252 TSharedRef<SWidget> ConstructYaw(const FArguments& InArgs)
253 {
256 .AllowSpin(InArgs._AllowSpin)
257 .Delta(InArgs._SpinDelta)
258 .LinearDeltaSensitivity(InArgs._LinearDeltaSensitivity)
259 .MinValue(InArgs._MinSliderValue)
260 .MaxValue(InArgs._MaxSliderValue)
261 .MinSliderValue(InArgs._MinSliderValue)
262 .MaxSliderValue(InArgs._MaxSliderValue)
263 .LabelPadding(FMargin(3.0f))
265 .Label()
266 [
268 ]
269 .Font( InArgs._Font )
270 .Value( InArgs._Yaw )
272 .OnValueCommitted( InArgs._OnYawCommitted )
275 .UndeterminedString( NSLOCTEXT("SRotatorInputBox", "MultipleValues", "Multiple Values") )
276 .ToolTipTextFormat(BuildToolTipTextFormatString(InArgs._YawDisplayName.Get().ToString()))
278 .MinFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMinFractionalDigits() : TOptional<int32>())
279 .MaxFractionalDigits(InArgs._TypeInterface ? InArgs._TypeInterface->GetMaxFractionalDigits() : TOptional<int32>())
284 .PreventThrottling(InArgs._PreventThrottling);
285 return Widget;
286 };
287
288public:
289
295 void Construct( const FArguments& InArgs )
296 {
297 using WidgetConstructorFn = TSharedRef<SWidget> (ThisClass::*)(const FArguments&);
299 {
300 &ThisClass::ConstructRoll,
301 &ThisClass::ConstructPitch,
302 &ThisClass::ConstructYaw
303 };
304
306
307 for (int32 SwizzleIndex = 0; SwizzleIndex < ComponentNum; SwizzleIndex++)
308 {
310 const auto& Swizzle = InArgs._Swizzle;
312 if (ensureMsgf(SwizzleValue < 3 && SwizzleValue >= 0, TEXT("Invalid Swizzle Value")))
313 {
314 Widget = (this->*Constructors[SwizzleValue])(InArgs);
315 }
316
317 TSharedRef<SWidget> WidgetRef = Widget.ToSharedRef();
318
319 HorizontalBox->AddSlot()
320 [
322 ];
323 }
324
326 [
327 HorizontalBox
328 ];
329 }
330
334 template<typename EventType, typename... ArgsType>
336 const EventType OnSliderMovement,
337 const EventType OnComponentSliderMovement)
338 {
339 if(OnSliderMovement.IsBound())
340 {
341 return EventType::CreateLambda(
343 {
344 OnSliderMovement.ExecuteIfBound(Args...);
345 OnComponentSliderMovement.ExecuteIfBound(Args...);
346 });
347 }
349 }
350};
351
#define ensureMsgf( InExpression, InFormat,...)
Definition AssertionMacros.h:465
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SNew(WidgetType,...)
Definition DeclarativeSyntaxSupport.h:37
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_EVENT(DelegateName, EventName)
Definition DeclarativeSyntaxSupport.h:458
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
return true
Definition ExternalRpcRegistry.cpp:601
#define X(Name, Desc)
Definition FormatStringSan.h:47
#define NSLOCTEXT(InNamespace, InKey, InTextLiteral)
Definition Internationalization.h:300
ECheckBoxState
Definition SlateTypes.h:65
Definition AppStyle.h:24
Definition ArrangedChildren.h:15
Definition Text.h:278
Definition Text.h:385
static CORE_API FText FromString(const ANSICHAR *String)
Definition Text.cpp:1081
Definition SCompoundWidget.h:22
FCompoundWidgetOneChildSlot ChildSlot
Definition SCompoundWidget.h:113
Definition SBoxPanel.h:171
Definition SNullWidget.h:14
static SLATECORE_API TSharedRef< class SWidget > NullWidget
Definition SNullWidget.h:22
Definition SNumericEntryBox.h:37
static TSharedRef< SWidget > BuildNarrowColorLabel(FLinearColor LabelColor)
Definition SNumericEntryBox.h:458
Definition SRotatorInputBox.h:24
DECLARE_DELEGATE_TwoParams(FOnNumericValueCommitted, NumericType, ETextCommit::Type)
EventType CreatePerComponentSliderMovementEvent(const EventType OnSliderMovement, const EventType OnComponentSliderMovement)
Definition SRotatorInputBox.h:335
void Construct(const FArguments &InArgs)
Definition SRotatorInputBox.h:295
DECLARE_DELEGATE_OneParam(FOnNumericValueChanged, NumericType)
SLATE_BEGIN_ARGS(SNumericRotatorInputBox< NumericType >)
Definition SRotatorInputBox.h:34
virtual SLATECORE_API FString ToString() const
Definition SWidget.cpp:1086
Definition Attribute.h:17
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition StaticArray.h:26
BuilderType & Append(const OtherCharType *const String, const int32 Length)
Definition StringBuilder.h:238
Definition StringBuilder.h:509
Definition AxisDisplayInfo.h:12
CORE_API FLinearColor GetAxisColor(EAxisList::Type Axis)
Definition AxisDisplayInfo.cpp:96
Definition Axis.h:22
@ X
Definition Axis.h:26
@ Y
Definition Axis.h:27
@ Z
Definition Axis.h:28
Type
Definition SlateEnums.h:291
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
void OnValueChanged(FPropertyPath &Path, INotifyHook *NotifyHook, TPred Pred)
Definition SNumericPropertyValue.cpp:126
@ false
Definition radaudio_common.h:23
Definition Margin.h:17
Definition SlateFontInfo.h:147
Definition NumericTypeInterface.h:21
Definition Optional.h:131