From 2652f9a6090020fe930a29497dc6ff007964b12a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 1 Dec 2016 01:07:53 -0600 Subject: [PATCH] Fills out the automaticly filled inspector entries for AbstractClassRep::FieldFlags::FIELD_ComponentInspectors with a pressable button. --- .../source/gui/editor/guiInspectorTypes.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 1f2bfcdb0..f1bda5316 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -400,6 +400,32 @@ ConsoleDocClass( GuiInspectorTypeCheckBox, GuiControl* GuiInspectorTypeCheckBox::constructEditControl() { + if ( mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) ) + { + // This checkbox (bool field) is meant to be treated as a button. + GuiControl* retCtrl = new GuiButtonCtrl(); + + // If we couldn't construct the control, bail! + if( retCtrl == NULL ) + return retCtrl; + + GuiButtonCtrl *button = dynamic_cast(retCtrl); + + // Let's make it look pretty. + retCtrl->setDataField( StringTable->insert("profile"), NULL, "InspectorTypeButtonProfile" ); + retCtrl->setField( "text", "Click Here" ); + + retCtrl->setScriptValue( getData() ); + + _registerEditControl( retCtrl ); + + // Configure it to update our value when the popup is closed + char szBuffer[512]; + dSprintf( szBuffer, 512, "%d.apply(%d.getValue());",getId(), button->getId() ); + button->setField("Command", szBuffer ); + + return retCtrl; + } else { GuiControl* retCtrl = new GuiCheckBoxCtrl(); GuiCheckBoxCtrl *check = dynamic_cast(retCtrl); @@ -420,6 +446,7 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl() check->setField("Command", szBuffer ); return retCtrl; + } }