Improve inspector filtering
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user