Files
UnrealEngine/Engine/Plugins/Mutable/Source/CustomizableObjectEditor/Private/MuCOE/SMutableScalarViewer.cpp
2025-05-18 13:04:45 +08:00

48 lines
859 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MuCOE/SMutableScalarViewer.h"
#include "Widgets/SBoxPanel.h"
#include "Widgets/Text/STextBlock.h"
#define LOCTEXT_NAMESPACE "CustomizableObjectEditor"
void SMutableScalarViewer::Construct(const FArguments& InArgs)
{
const FText ScalarValueTitle = LOCTEXT("ScalarValueTitle", "Scalar Value : ");
ChildSlot
[
SNew(SHorizontalBox)
// title
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock).
Text(ScalarValueTitle)
]
// value
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(STextBlock).
Text(this, &SMutableScalarViewer::GetValue)
]
];
}
void SMutableScalarViewer::SetScalar(const float& InFloat)
{
this->ScalarValue = InFloat;
}
FText SMutableScalarViewer::GetValue() const
{
return FText::AsNumber(this->ScalarValue);
}
#undef LOCTEXT_NAMESPACE