From 11bfe15fc9acb4f9c739430426587b1fc5a81996 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 22 Aug 2026 17:06:42 -0500 Subject: [PATCH] multi-dimension inspector augs formatting for GuiInspectorTypePoint2I. updateValue ensures that's set to nearest whole number. also shifted the edit controls for point2i and point3f on over to GuiTextEditSliderCtrl for drag support --- .../source/gui/editor/guiInspectorTypes.cpp | 48 +++++++++++++++++-- Engine/source/gui/editor/guiInspectorTypes.h | 7 +-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index d33014ef36..183f380fc4 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1903,12 +1903,18 @@ void GuiInspectorTypeSFXSourceName::consoleInit() void GuiInspectorType2DValue::constructEditControlChildren(GuiControl* retCtrl, S32 width) { - mCtrlX = new GuiTextEditCtrl(); + mCtrlX = new GuiTextEditSliderCtrl(); + mCtrlX->setField("range", String::ToString("%f %f", F32_MIN_EX, F32_MAX)); + mCtrlX->setField("increment", String::ToString("%f", POINT_EPSILON * 100.0f)); + mCtrlX->setDataField(StringTable->insert("format"), NULL, "%g"); _registerEditControl(mCtrlX, "x"); mLabelX = new GuiControl(); _registerEditControl(mLabelX, "lx"); - mCtrlY = new GuiTextEditCtrl(); + mCtrlY = new GuiTextEditSliderCtrl(); + mCtrlY->setField("range", String::ToString("%f %f", F32_MIN_EX, F32_MAX)); + mCtrlY->setField("increment", String::ToString("%f", POINT_EPSILON * 100.0f)); + mCtrlY->setDataField(StringTable->insert("format"), NULL, "%g"); _registerEditControl(mCtrlY, "y"); mLabelY = new GuiControl(); _registerEditControl(mLabelY, "ly"); @@ -2078,7 +2084,11 @@ void GuiInspectorType3DValue::constructEditControlChildren(GuiControl* retCtrl, { Parent::constructEditControlChildren(retCtrl, width); - mCtrlZ = new GuiTextEditCtrl(); + mCtrlZ = new GuiTextEditSliderCtrl(); + mCtrlZ->setField("range", String::ToString("%f %f", F32_MIN_EX, F32_MAX)); + mCtrlZ->setField("increment", String::ToString("%f", POINT_EPSILON*100.0f)); + mCtrlZ->setDataField(StringTable->insert("format"), NULL, "%g"); + _registerEditControl(mCtrlZ, "z"); mLabelZ = new GuiControl(); _registerEditControl(mLabelZ, "lz"); @@ -2387,12 +2397,44 @@ GuiControl* GuiInspectorTypePoint2I::constructEditControl() { GuiControl* retCtrl = Parent::constructEditControl(); + mCtrlX->setField("increment", "1"); + mCtrlX->setField("range", String::ToString("%d %d", S32_MIN, S32_MAX)); mCtrlX->setDataField(StringTable->insert("format"), NULL, "%d"); + mCtrlY->setField("increment", "1"); + mCtrlY->setField("range", String::ToString("%d %d", S32_MIN, S32_MAX)); mCtrlY->setDataField(StringTable->insert("format"), NULL, "%d"); return retCtrl; } +void GuiInspectorTypePoint2I::updateValue() +{ + if (mField) + { + Parent::updateValue(); + const char* data = getData(); + if (!data) + data = ""; + U32 elementCount = StringUnit::getUnitCount(data, " "); + if (elementCount > 0) + { + S32 value = dAtoi(StringUnit::getUnit(data, 0, " \t\n")); + char szBuffer[64]; + dSprintf(szBuffer, 64, "%d", value); + mCtrlX->setText(szBuffer); + } + if (elementCount > 1) + { + S32 value = dAtoi(StringUnit::getUnit(data, 1, " \t\n")); + char szBuffer[64]; + dSprintf(szBuffer, 64, "%d", value); + mCtrlY->setText(szBuffer); + } + mScriptValue->setText(data); + mEdit->setDataField(StringTable->insert("tooltip"), NULL, data); + } +} + //----------------------------------------------------------------------------- // TypePoint3F GuiInspectorField Class //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/editor/guiInspectorTypes.h b/Engine/source/gui/editor/guiInspectorTypes.h index 839d51718c..8a825e8b0b 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.h +++ b/Engine/source/gui/editor/guiInspectorTypes.h @@ -633,10 +633,10 @@ class GuiInspectorType2DValue : public GuiInspectorField private: typedef GuiInspectorField Parent; protected: - GuiTextEditCtrl* mCtrlX; + GuiTextEditSliderCtrl* mCtrlX; GuiControl* mLabelX; GuiControl* mContainerX; - GuiTextEditCtrl* mCtrlY; + GuiTextEditSliderCtrl* mCtrlY; GuiControl* mLabelY; GuiControl* mContainerY; GuiTextCtrl* mScriptValue; @@ -663,7 +663,7 @@ class GuiInspectorType3DValue : public GuiInspectorType2DValue private: typedef GuiInspectorType2DValue Parent; protected: - GuiTextEditCtrl* mCtrlZ; + GuiTextEditSliderCtrl* mCtrlZ; GuiControl* mLabelZ; GuiControl* mContainerZ; @@ -718,6 +718,7 @@ class GuiInspectorTypePoint2I : public GuiInspectorTypePoint2F DECLARE_CONOBJECT(GuiInspectorTypePoint2I); static void consoleInit(); GuiControl* constructEditControl() override; + void updateValue() override; };