summaryrefslogtreecommitdiffstats
path: root/editor/editor_sectioned_inspector.cpp
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-03-18 01:16:25 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-03-18 01:16:25 +0800
commit7bdca99d51ec5a28a67ceeb2e509826191aa6326 (patch)
tree22e9955c40c35fedde79ad098e6af8a047fbab2f /editor/editor_sectioned_inspector.cpp
parent5d806b435bdfb6669435f1a28589f847be5ff807 (diff)
downloadredot-engine-7bdca99d51ec5a28a67ceeb2e509826191aa6326.tar.gz
Improve inspector filtering
Diffstat (limited to 'editor/editor_sectioned_inspector.cpp')
-rw-r--r--editor/editor_sectioned_inspector.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp
index a44cf20771..627fa0eb35 100644
--- a/editor/editor_sectioned_inspector.cpp
+++ b/editor/editor_sectioned_inspector.cpp
@@ -33,6 +33,20 @@
#include "editor/editor_property_name_processor.h"
#include "editor/editor_scale.h"
+static bool _property_path_matches(const String &p_property_path, const String &p_filter) {
+ if (p_property_path.findn(p_filter) != -1) {
+ return true;
+ }
+
+ const Vector<String> sections = p_property_path.split("/");
+ for (int i = 0; i < sections.size(); i++) {
+ if (p_filter.is_subsequence_ofn(EditorPropertyNameProcessor::get_singleton()->process_name(sections[i]))) {
+ return true;
+ }
+ }
+ return false;
+}
+
class SectionedInspectorFilter : public Object {
GDCLASS(SectionedInspectorFilter, Object);
@@ -232,7 +246,7 @@ void SectionedInspector::update_category_list() {
continue;
}
- if (!filter.is_empty() && pi.name.findn(filter) == -1 && pi.name.replace("/", " ").capitalize().findn(filter) == -1) {
+ if (!filter.is_empty() && !_property_path_matches(pi.name, filter)) {
continue;
}