mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-14 17:05:26 +00:00
Adds logic and handling for Inspected SimObjects to be able to inject new InspectorGroups and InspectorFields when being inspected for editing.
Allows for expanded editing capabilities of existing classes without needing to add static fields to classes
This commit is contained in:
parent
7fa2e72d5f
commit
3991019912
6 changed files with 154 additions and 2 deletions
|
|
@ -779,6 +779,32 @@ void GuiInspector::sendInspectPostApply()
|
|||
getInspectObject( i )->inspectPostApply();
|
||||
}
|
||||
|
||||
S32 GuiInspector::createInspectorGroup(StringTableEntry groupName, S32 index)
|
||||
{
|
||||
GuiInspectorGroup* newGroup = nullptr;
|
||||
newGroup = findExistentGroup(groupName);
|
||||
if (newGroup)
|
||||
return newGroup->getId(); //if we already have a group under this name, just return it
|
||||
|
||||
newGroup = new GuiInspectorGroup(groupName, this);
|
||||
newGroup->registerObject();
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
//if index is -1, we just throw the group onto the stack at the end
|
||||
mGroups.push_back(newGroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if we have an explicit index, insert it specifically
|
||||
mGroups.insert(index, newGroup);
|
||||
}
|
||||
|
||||
addObject(newGroup);
|
||||
|
||||
return newGroup->getId();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Console Methods.
|
||||
//=============================================================================
|
||||
|
|
@ -918,3 +944,21 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), ,
|
|||
|
||||
return inspector->getId();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspector, createGroup, S32, (const char* groupName, S32 index), (-1),
|
||||
"Creates a new GuiInspectorGroup for this inspector and returns it's Id. If one already exists, then the Id of the existing one is returned.\n"
|
||||
"@param groupName Name of the new GuiInspectorGroup to add to this Inspector."
|
||||
"@param index(Optional) The index where to add the new group to in this Inspector's group stack."
|
||||
"@return id of the named GuiInspectorGroup")
|
||||
{
|
||||
return object->createInspectorGroup(StringTable->insert(groupName), index);
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspector, findExistentGroup, S32, (const char* groupName), ,
|
||||
"Finds an existing GuiInspectorGroup if it exists and returns it's Id.\n"
|
||||
"@param groupName Name of the new GuiInspectorGroup to find in this Inspector."
|
||||
"@return id of the named GuiInspectorGroup")
|
||||
{
|
||||
GuiInspectorGroup* group = object->findExistentGroup(StringTable->insert(groupName));
|
||||
return group ? group->getId() : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue