diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-08-22 23:34:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-22 23:34:03 +0200 |
commit | 745e80fa8d494c9ef1c7e6fadbbafa399074471a (patch) | |
tree | 958536778256c14c4176964a21b1a5e573aca71d /editor/scene_tree_editor.cpp | |
parent | 9744becc3976ee13b8c79fba458d263ccfcde4f4 (diff) | |
parent | 296640ab8f6164ae144602e0fb095b1c16465873 (diff) | |
download | redot-engine-745e80fa8d494c9ef1c7e6fadbbafa399074471a.tar.gz |
Merge pull request #58377 from MrBBBaiXue/type-filter
Add a way to filter nodes by type in scene tree dock.
Diffstat (limited to 'editor/scene_tree_editor.cpp')
-rw-r--r-- | editor/scene_tree_editor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 5f1c0bd26d..b977b012a8 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -603,7 +603,9 @@ bool SceneTreeEditor::_update_filter(TreeItem *p_parent, bool p_scroll_to_select } if (!keep) { - keep = filter.is_subsequence_ofn(p_parent->get_text(0)); + StringName node_type = get_node(p_parent->get_metadata(0))->get_class(); + bool is_kept_by_type = (filter.begins_with("type:") && filter.trim_prefix("type:").is_subsequence_ofn(node_type)) || (filter.begins_with("t:") && filter.trim_prefix("t:").is_subsequence_ofn(node_type)); + keep = (filter.is_subsequence_ofn(p_parent->get_text(0)) || is_kept_by_type); } p_parent->set_visible(keep); |