Update
This commit is contained in:
72
Source/FLESHEditor/Public/MatrixInputWidget.h
Normal file
72
Source/FLESHEditor/Public/MatrixInputWidget.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Input/SNumericEntryBox.h"
|
||||
#include "Widgets/Input/SButton.h"
|
||||
#include "Widgets/Layout/SBox.h"
|
||||
#include "Widgets/Layout/SGridPanel.h"
|
||||
|
||||
/**
|
||||
* Matrix input widget for the FLESH editor
|
||||
* Allows inputting transformation matrices for precise cutting operations
|
||||
*/
|
||||
class FLESHEDITOR_API SMatrixInputWidget : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SMatrixInputWidget)
|
||||
: _Matrix(FMatrix::Identity)
|
||||
, _OnMatrixChanged()
|
||||
{}
|
||||
/** The initial matrix value */
|
||||
SLATE_ARGUMENT(FMatrix, Matrix)
|
||||
/** Called when the matrix value changes */
|
||||
SLATE_EVENT(FOnMatrixChanged, OnMatrixChanged)
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/** Constructs this widget */
|
||||
void Construct(const FArguments& InArgs);
|
||||
|
||||
/** Sets the matrix value */
|
||||
void SetMatrix(const FMatrix& InMatrix);
|
||||
|
||||
/** Gets the current matrix value */
|
||||
FMatrix GetMatrix() const;
|
||||
|
||||
/** Resets the matrix to identity */
|
||||
void ResetToIdentity();
|
||||
|
||||
/** Creates a rotation matrix from Euler angles */
|
||||
void SetFromEulerAngles(float Roll, float Pitch, float Yaw);
|
||||
|
||||
/** Creates a translation matrix */
|
||||
void SetFromTranslation(const FVector& Translation);
|
||||
|
||||
/** Creates a combined transformation matrix */
|
||||
void SetFromTransform(const FTransform& Transform);
|
||||
|
||||
private:
|
||||
/** The current matrix value */
|
||||
FMatrix Matrix;
|
||||
|
||||
/** Called when the matrix value changes */
|
||||
FOnMatrixChanged OnMatrixChanged;
|
||||
|
||||
/** The grid panel containing the matrix elements */
|
||||
TSharedPtr<SGridPanel> GridPanel;
|
||||
|
||||
/** Array of numeric entry boxes for matrix elements */
|
||||
TArray<TSharedPtr<SNumericEntryBox<float>>> NumericEntryBoxes;
|
||||
|
||||
/** Creates a numeric entry box for a matrix element */
|
||||
TSharedPtr<SNumericEntryBox<float>> CreateMatrixElementWidget(int32 Row, int32 Col);
|
||||
|
||||
/** Called when a matrix element changes */
|
||||
void OnMatrixElementChanged(float NewValue, int32 Row, int32 Col);
|
||||
|
||||
/** Updates the UI from the matrix value */
|
||||
void UpdateUI();
|
||||
};
|
||||
|
||||
/** Delegate for matrix value changes */
|
||||
DECLARE_DELEGATE_OneParam(FOnMatrixChanged, const FMatrix&);
|
Reference in New Issue
Block a user