Browse Source

Merge pull request #249 from Areloch/InspectorGroupInserts

Adds additional functions for inserting inspectorGroups
Brian Roberts 5 years ago
parent
commit
dda0cc9aa7
2 changed files with 38 additions and 0 deletions
  1. 21 0
      Engine/source/gui/editor/guiInspector.cpp
  2. 17 0
      Engine/source/gui/editor/guiInspector.h

+ 21 - 0
Engine/source/gui/editor/guiInspector.cpp

@@ -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 )

+ 17 - 0
Engine/source/gui/editor/guiInspector.h

@@ -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