Adds logic to be able to set a search string on an inspector that will be used to filter displayed fields.

Adds a textEdit filter box to the main world inspector that hooks into the primary inspector for said search functionality
This commit is contained in:
Areloch 2024-02-13 20:33:14 -06:00
parent 59fc6d3d65
commit d890c530f9
6 changed files with 74 additions and 8 deletions

View file

@ -54,6 +54,7 @@ GuiInspector::GuiInspector()
mForcedArrayIndex(-1)
{
mPadding = 1;
mSearchText = StringTable->EmptyString();
}
//-----------------------------------------------------------------------------
@ -79,7 +80,8 @@ void GuiInspector::initPersistFields()
"If false the custom fields Name, Id, and Source Class will not be shown." );
addField("forcedArrayIndex", TypeS32, Offset(mForcedArrayIndex, GuiInspector));
addField("searchText", TypeString, Offset(mSearchText, GuiInspector), "A string that, if not blank, is used to filter shown fields");
endGroup( "Inspector" );
Parent::initPersistFields();
@ -829,6 +831,12 @@ void GuiInspector::setForcedArrayIndex(S32 arrayIndex)
refresh();
}
void GuiInspector::setSearchText(StringTableEntry searchText)
{
mSearchText = searchText;
refresh();
}
//=============================================================================
// Console Methods.
//=============================================================================
@ -1000,3 +1008,10 @@ DefineEngineMethod(GuiInspector, setForcedArrayIndex, void, (S32 arrayIndex), (-
{
object->setForcedArrayIndex(arrayIndex);
}
DefineEngineMethod(GuiInspector, setSearchText, void, (const char* searchText), (""),
"Sets the searched text used to filter out displayed fields in the inspector."
"@param searchText The text to be used as a filter for field names. Leave as blank to clear search")
{
object->setSearchText(searchText);
}