Adds ability to get InspectorGroup index, as well as inserting a new inspectorGroup at a specific position in the list

This commit is contained in:
Areloch 2020-07-13 18:58:00 -05:00
parent 56233410cf
commit 5b4af68793
2 changed files with 38 additions and 0 deletions

View file

@ -232,6 +232,27 @@ GuiInspectorGroup* GuiInspector::findExistentGroup( StringTableEntry groupName )
return NULL;
}
S32 GuiInspector::findExistentGroupIndex(StringTableEntry groupName)
{
// If we have no groups, it couldn't possibly exist
if (mGroups.empty())
return -1;
// Attempt to find it in the group list
Vector<GuiInspectorGroup*>::iterator i = mGroups.begin();
S32 index = 0;
for (; i != mGroups.end(); i++)
{
if (dStricmp((*i)->getGroupName(), groupName) == 0)
return index;
index++;
}
return -1;
}
//-----------------------------------------------------------------------------
void GuiInspector::updateFieldValue( StringTableEntry fieldName, StringTableEntry arrayIdx )

View file

@ -111,6 +111,16 @@ public:
mGroups.push_back(group);
}
/// <summary>
/// Inserts a group into group list at a specific position
/// </summary>
/// <param name="insertIndex"></param>
/// <param name="group"></param>
void insertInspectorGroup(U32 insertIndex, GuiInspectorGroup* group)
{
mGroups.insert(insertIndex, group);
}
/// Deletes all GuiInspectorGroups
void clearGroups();
@ -118,6 +128,13 @@ public:
/// Helper for inspectObject
GuiInspectorGroup* findExistentGroup( StringTableEntry groupName );
/// <summary>
/// Looks through the group list by name to find it's index
/// </summary>
/// <param name="groupName"></param>
/// <returns>Returns the index position of the group in the group list as S32. -1 if groupName not found.</returns>
S32 findExistentGroupIndex(StringTableEntry groupName);
/// Should there be a GuiInspectorField associated with this fieldName,
/// update it to reflect actual/current value of that field in the inspected object.
/// Added to support UndoActions