mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 15:25:40 +00:00
add numerous new validators
as well as inspector support to treat a significant chunk of the codebase as range-clmped values which can take a guisliderbarctrl with a configurable at the validator level fidelity variable additionally adds a new addfieldV and addprotetedfieldV for further callback validated slider-presented variables *also* adds an on additional callbacks to the inspector itself, like onPreinspectobject, onPostinspectObject, and onPostInspectorfieldModified in addition to *that*, adds a new hidefield command to tag a given specific field not to show in inspector
This commit is contained in:
parent
ab73099dd9
commit
fa760fa746
14 changed files with 476 additions and 15 deletions
|
|
@ -86,6 +86,7 @@ void GuiInspectorDynamicField::setData( const char* data, bool callbacks )
|
|||
|
||||
// give the target a chance to validate
|
||||
target->inspectPostApply();
|
||||
Con::executef(mInspector, "onPostInspectorFieldModified", mInspector->getIdString(), target->getIdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -615,6 +615,8 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
|||
|
||||
// Give the target a chance to validate.
|
||||
target->inspectPostApply();
|
||||
if (String::compare(oldValue.c_str(), newValue.c_str()) != 0)
|
||||
Con::executef(mInspector, "onPostInspectorFieldModified", mInspector->getIdString(), target->getIdString());
|
||||
}
|
||||
|
||||
if( callbacks && numTargets > 1 )
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ bool GuiInspectorGroup::inspectGroup()
|
|||
bGrabItems = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Skip field if it has the HideInInspectors flag set.
|
||||
|
||||
if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors))
|
||||
|
|
@ -761,6 +761,26 @@ void GuiInspectorGroup::removeInspectorField(StringTableEntry name)
|
|||
}
|
||||
}
|
||||
|
||||
void GuiInspectorGroup::hideInspectorField(StringTableEntry fieldName, bool setHidden)
|
||||
{
|
||||
SimObject* inspectObj = mParent->getInspectObject();
|
||||
if (inspectObj == nullptr)
|
||||
return;
|
||||
|
||||
AbstractClassRep::Field* field = const_cast<AbstractClassRep::Field*>(inspectObj->getClassRep()->findField(fieldName));
|
||||
|
||||
if (field == NULL)
|
||||
{
|
||||
Con::errorf("fieldName not found: %s.%s", inspectObj->getName(), fieldName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (setHidden)
|
||||
field->flag.set(AbstractClassRep::FIELD_HideInInspectors);
|
||||
else
|
||||
field->flag.clear(AbstractClassRep::FIELD_HideInInspectors);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspectorGroup, createInspectorField, GuiInspectorField*, (), , "createInspectorField()")
|
||||
{
|
||||
return object->createInspectorField();
|
||||
|
|
@ -798,6 +818,16 @@ DefineEngineMethod(GuiInspectorGroup, removeField, void, (const char* fieldName)
|
|||
object->removeInspectorField(StringTable->insert(fieldName));
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspectorGroup, hideField, void, (const char* fieldName, bool setHidden), (true),
|
||||
"Removes a Inspector field to this group of a given name.\n"
|
||||
"@param fieldName The name of the field to be removed.")
|
||||
{
|
||||
if (dStrEqual(fieldName, ""))
|
||||
return;
|
||||
|
||||
object->hideInspectorField(StringTable->insert(fieldName), setHidden);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspectorGroup, setForcedArrayIndex, void, (S32 arrayIndex), (-1),
|
||||
"Sets the ForcedArrayIndex for the group. Used to force presentation of arrayed fields to only show a specific field index."
|
||||
"@param arrayIndex The specific field index for arrayed fields to show. Use -1 or blank arg to go back to normal behavior.")
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ public:
|
|||
void addInspectorField(StringTableEntry name, StringTableEntry typeName, const char* description, const char* callbackName);
|
||||
void addInspectorField(GuiInspectorField* field);
|
||||
void removeInspectorField(StringTableEntry name);
|
||||
void hideInspectorField(StringTableEntry fieldName, bool setHidden);
|
||||
|
||||
void setForcedArrayIndex(const S32& arrayIndex = -1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue