mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Merge pull request #1215 from Areloch/InspectorFieldSearch
Adds ability to filter inspector fields
This commit is contained in:
commit
5b9ec4e025
7 changed files with 108 additions and 12 deletions
|
|
@ -54,6 +54,7 @@ GuiInspector::GuiInspector()
|
||||||
mForcedArrayIndex(-1)
|
mForcedArrayIndex(-1)
|
||||||
{
|
{
|
||||||
mPadding = 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." );
|
"If false the custom fields Name, Id, and Source Class will not be shown." );
|
||||||
|
|
||||||
addField("forcedArrayIndex", TypeS32, Offset(mForcedArrayIndex, GuiInspector));
|
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" );
|
endGroup( "Inspector" );
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
|
|
@ -829,6 +831,12 @@ void GuiInspector::setForcedArrayIndex(S32 arrayIndex)
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiInspector::setSearchText(StringTableEntry searchText)
|
||||||
|
{
|
||||||
|
mSearchText = searchText;
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Console Methods.
|
// Console Methods.
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
@ -1000,3 +1008,10 @@ DefineEngineMethod(GuiInspector, setForcedArrayIndex, void, (S32 arrayIndex), (-
|
||||||
{
|
{
|
||||||
object->setForcedArrayIndex(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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,10 @@ public:
|
||||||
|
|
||||||
void setForcedArrayIndex(S32 arrayIndex);
|
void setForcedArrayIndex(S32 arrayIndex);
|
||||||
|
|
||||||
|
StringTableEntry getSearchText() { return mSearchText; }
|
||||||
|
|
||||||
|
void setSearchText(StringTableEntry searchText);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef Vector< SimObjectPtr< SimObject > > TargetVector;
|
typedef Vector< SimObjectPtr< SimObject > > TargetVector;
|
||||||
|
|
@ -190,6 +194,8 @@ protected:
|
||||||
String mGroupFilters;
|
String mGroupFilters;
|
||||||
bool mShowCustomFields;
|
bool mShowCustomFields;
|
||||||
S32 mForcedArrayIndex;
|
S32 mForcedArrayIndex;
|
||||||
|
|
||||||
|
StringTableEntry mSearchText;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@ GuiControl* GuiInspectorDatablockField::constructEditControl()
|
||||||
|
|
||||||
//Add add button
|
//Add add button
|
||||||
mAddButton = new GuiBitmapButtonCtrl();
|
mAddButton = new GuiBitmapButtonCtrl();
|
||||||
|
if(mDesiredClass == NULL)
|
||||||
|
return retCtrl;
|
||||||
|
|
||||||
dSprintf(szBuffer, sizeof(szBuffer), "DatablockEditorPlugin.createNewDatablockOfType(%s, %d.getText());", mDesiredClass->getClassName(), retCtrl->getId());
|
dSprintf(szBuffer, sizeof(szBuffer), "DatablockEditorPlugin.createNewDatablockOfType(%s, %d.getText());", mDesiredClass->getClassName(), retCtrl->getId());
|
||||||
mAddButton->setField("Command", szBuffer);
|
mAddButton->setField("Command", szBuffer);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,12 @@ bool GuiInspectorDynamicGroup::inspectGroup()
|
||||||
SimFieldDictionary * fieldDictionary = target->getFieldDictionary();
|
SimFieldDictionary * fieldDictionary = target->getFieldDictionary();
|
||||||
for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
|
for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
|
||||||
{
|
{
|
||||||
|
String searchText = mParent->getSearchText();
|
||||||
|
if (searchText != String::EmptyString) {
|
||||||
|
if (String((*ditr)->slotName).find(searchText, 0, String::NoCase | String::Left) == String::NPos)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( i == 0 )
|
if( i == 0 )
|
||||||
{
|
{
|
||||||
flist.increment();
|
flist.increment();
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,12 @@ bool GuiInspectorGroup::inspectGroup()
|
||||||
if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors))
|
if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
String searchText = mParent->getSearchText();
|
||||||
|
if (searchText != String::EmptyString) {
|
||||||
|
if (String(field->pFieldname).find(searchText, 0, String::NoCase | String::Left) == String::NPos)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((bGrabItems == true || (bNoGroup == true && bGrabItems == false)) && itr->type != AbstractClassRep::DeprecatedFieldType)
|
if ((bGrabItems == true || (bNoGroup == true && bGrabItems == false)) && itr->type != AbstractClassRep::DeprecatedFieldType)
|
||||||
{
|
{
|
||||||
if (bNoGroup == true && bGrabItems == true)
|
if (bNoGroup == true && bGrabItems == true)
|
||||||
|
|
|
||||||
|
|
@ -967,6 +967,36 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) {
|
||||||
tooltipprofile = "ToolsGuiToolTipProfile";
|
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||||
hovertime = "1000";
|
hovertime = "1000";
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
|
|
||||||
|
new GuiTextEditCtrl( GuiEditorInspectorFilter ) {
|
||||||
|
position = "5 0";
|
||||||
|
extent = "222 20";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
placeholderText = "Filter...";
|
||||||
|
validate = "GuiEditorInspectFields.setSearchText($ThisControl.getText());";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiBitmapButtonCtrl() {
|
||||||
|
bitmapAsset = "ToolsModule:clear_icon_n_image";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
|
HorizSizing = "left";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "205 2";
|
||||||
|
Extent = "17 17";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
command = "GuiEditorInspectorFilter.setText(\"\");GuiEditorInspectFields.setSearchText(\"\");";
|
||||||
|
};
|
||||||
|
|
||||||
new GuiScrollCtrl() {
|
new GuiScrollCtrl() {
|
||||||
willFirstRespond = "1";
|
willFirstRespond = "1";
|
||||||
|
|
@ -979,7 +1009,7 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) {
|
||||||
mouseWheelScrollSpeed = "-1";
|
mouseWheelScrollSpeed = "-1";
|
||||||
Margin = "0 0 0 0";
|
Margin = "0 0 0 0";
|
||||||
Padding = "0 0 0 0";
|
Padding = "0 0 0 0";
|
||||||
AnchorTop = "1";
|
AnchorTop = "0";
|
||||||
AnchorBottom = "0";
|
AnchorBottom = "0";
|
||||||
AnchorLeft = "1";
|
AnchorLeft = "1";
|
||||||
AnchorRight = "0";
|
AnchorRight = "0";
|
||||||
|
|
@ -987,8 +1017,8 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) {
|
||||||
Profile = "GuiEditorScrollProfile";
|
Profile = "GuiEditorScrollProfile";
|
||||||
HorizSizing = "width";
|
HorizSizing = "width";
|
||||||
VertSizing = "height";
|
VertSizing = "height";
|
||||||
position = "0 2";
|
position = "0 20";
|
||||||
Extent = "223 341";
|
Extent = "223 321";
|
||||||
MinExtent = "8 2";
|
MinExtent = "8 2";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
Visible = "1";
|
Visible = "1";
|
||||||
|
|
@ -1011,7 +1041,7 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) {
|
||||||
HorizSizing = "width";
|
HorizSizing = "width";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
position = "1 1";
|
position = "1 1";
|
||||||
Extent = "221 24";
|
Extent = "221 321";
|
||||||
MinExtent = "8 24";
|
MinExtent = "8 24";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
Visible = "1";
|
Visible = "1";
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,36 @@ $guiContent = new GuiControl() {
|
||||||
AnchorBottom = "0";
|
AnchorBottom = "0";
|
||||||
AnchorLeft = "1";
|
AnchorLeft = "1";
|
||||||
AnchorRight = "0";
|
AnchorRight = "0";
|
||||||
|
|
||||||
|
new GuiTextEditCtrl( EditorInspectorFilter ) {
|
||||||
|
position = "5 -4";
|
||||||
|
extent = "341 20";
|
||||||
|
profile = "ToolsGuiTextEditProfile";
|
||||||
|
horizSizing = "width";
|
||||||
|
vertSizing = "bottom";
|
||||||
|
placeholderText = "Filter...";
|
||||||
|
validate = "Inspector.setSearchText($ThisControl.getText());";
|
||||||
|
};
|
||||||
|
|
||||||
|
new GuiBitmapButtonCtrl() {
|
||||||
|
bitmapAsset = "ToolsModule:clear_icon_n_image";
|
||||||
|
groupNum = "-1";
|
||||||
|
buttonType = "PushButton";
|
||||||
|
useMouseEvents = "0";
|
||||||
|
isContainer = "0";
|
||||||
|
Profile = "ToolsGuiDefaultProfile";
|
||||||
|
HorizSizing = "left";
|
||||||
|
VertSizing = "bottom";
|
||||||
|
position = "325 -2";
|
||||||
|
Extent = "17 17";
|
||||||
|
MinExtent = "8 2";
|
||||||
|
canSave = "1";
|
||||||
|
Visible = "1";
|
||||||
|
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||||
|
hovertime = "1000";
|
||||||
|
canSaveDynamicFields = "0";
|
||||||
|
command = "EditorInspectorFilter.setText(\"\");Inspector.setSearchText(\"\");";
|
||||||
|
};
|
||||||
|
|
||||||
new GuiScrollCtrl() {
|
new GuiScrollCtrl() {
|
||||||
canSaveDynamicFields = "0";
|
canSaveDynamicFields = "0";
|
||||||
|
|
@ -74,20 +104,20 @@ $guiContent = new GuiControl() {
|
||||||
isContainer = "1";
|
isContainer = "1";
|
||||||
Profile = "GuiEditorScrollProfile";
|
Profile = "GuiEditorScrollProfile";
|
||||||
HorizSizing = "width";
|
HorizSizing = "width";
|
||||||
VertSizing = "height";
|
VertSizing = "bottom";
|
||||||
Position = "5 5";
|
Position = "5 20";
|
||||||
Extent = "187 238";
|
Extent = "343 941";
|
||||||
MinExtent = "8 8";
|
MinExtent = "8 8";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
Visible = "1";
|
Visible = "1";
|
||||||
tooltipprofile = "ToolsGuiToolTipProfile";
|
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||||
hovertime = "1000";
|
hovertime = "1000";
|
||||||
Docking = "Client";
|
Docking = "None";
|
||||||
Margin = "0 0 0 0";
|
Margin = "0 0 0 0";
|
||||||
Padding = "0 0 0 0";
|
Padding = "0 0 0 0";
|
||||||
AnchorTop = "1";
|
AnchorTop = "0";
|
||||||
AnchorBottom = "0";
|
AnchorBottom = "0";
|
||||||
AnchorLeft = "1";
|
AnchorLeft = "0";
|
||||||
AnchorRight = "0";
|
AnchorRight = "0";
|
||||||
willFirstRespond = "1";
|
willFirstRespond = "1";
|
||||||
hScrollBar = "alwaysOff";
|
hScrollBar = "alwaysOff";
|
||||||
|
|
@ -109,7 +139,7 @@ $guiContent = new GuiControl() {
|
||||||
HorizSizing = "width";
|
HorizSizing = "width";
|
||||||
VertSizing = "bottom";
|
VertSizing = "bottom";
|
||||||
Position = "0 0";
|
Position = "0 0";
|
||||||
Extent = "202 309";
|
Extent = "343 941";
|
||||||
MinExtent = "8 8";
|
MinExtent = "8 8";
|
||||||
canSave = "1";
|
canSave = "1";
|
||||||
Visible = "1";
|
Visible = "1";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue