Browse Source

Improved search in settings dialogs

Settings search used to work only on properties, so if a searchbox text
was a substring of a category but not of a property the whole category
would be filtered out and no property would be shown.

Now the behaviour is changed so that when the searchbox text is a
substring of a category all its properties are shown too.

The previous behaviour is still present so that in case the searchbox
text is both a substring of a category and a property of another
category, all properties of the first category are shown and only the
property of the second category is shown.

(cherry picked from commit 84410f937e6504f72e8a35becf237049b640b39f)
Silvano Cerza 5 years ago
parent
commit
e2ac4195b6
2 changed files with 4 additions and 4 deletions
  1. 1 1
      editor/editor_inspector.cpp
  2. 3 3
      editor/editor_sectioned_inspector.cpp

+ 1 - 1
editor/editor_inspector.cpp

@@ -1596,7 +1596,7 @@ void EditorInspector::update_tree() {
 			if (capitalize_paths)
 				cat = cat.capitalize();
 
-			if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
+			if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name) && property_prefix.to_lower().find(filter.to_lower()) == -1)
 				continue;
 		}
 

+ 3 - 3
editor/editor_sectioned_inspector.cpp

@@ -245,6 +245,9 @@ void SectionedInspector::update_category_list() {
 		if (pi.name.find(":") != -1 || pi.name == "script" || pi.name == "resource_name" || pi.name == "resource_path" || pi.name == "resource_local_to_scene" || pi.name.begins_with("_global_script"))
 			continue;
 
+		if (!filter.empty() && !filter.is_subsequence_ofi(pi.name) && !filter.is_subsequence_ofi(pi.name.replace("/", " ").capitalize()))
+			continue;
+
 		int sp = pi.name.find("/");
 		if (sp == -1)
 			pi.name = "global/" + pi.name;
@@ -252,9 +255,6 @@ void SectionedInspector::update_category_list() {
 		Vector<String> sectionarr = pi.name.split("/");
 		String metasection;
 
-		if (!filter.empty() && !filter.is_subsequence_ofi(sectionarr[sectionarr.size() - 1].capitalize()))
-			continue;
-
 		int sc = MIN(2, sectionarr.size() - 1);
 
 		for (int i = 0; i < sc; i++) {