#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" // Define matrix change delegate type DECLARE_DELEGATE_OneParam(FOnMatrixChanged, const FMatrix&); /** * 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 GridPanel; /** Array of numeric entry boxes for matrix elements */ TArray>> NumericEntryBoxes; /** Creates a numeric entry box for a matrix element */ TSharedPtr> 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(); };