From 33092b6f4519a1caef7158efaf3ee7a9c91732f5 Mon Sep 17 00:00:00 2001 From: Micky Date: Fri, 16 Sep 2022 15:10:28 +0200 Subject: Expose and warn about Node Filters in Scene Tree Dock Adds "Filter by Type" and "Filter by Group" in the Scene Tree Dock's MenuButton. Hovering on them displays an useful tooltip. When selecting these items, the matching parameter is appended to the terms, and the caret is automatically brought to the end. When typing a filter that cannot be identified, a warning icon is displayed. The reason is explained as a tooltip. The same options are also quickly available by right-clicking or middle-clicking in the text field. --- editor/scene_tree_editor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'editor/scene_tree_editor.cpp') diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 689570bcf6..abebd306e6 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -612,6 +612,7 @@ void SceneTreeEditor::_update_tree(bool p_scroll_to_selected) { bool SceneTreeEditor::_update_filter(TreeItem *p_parent, bool p_scroll_to_selected) { if (!p_parent) { p_parent = tree->get_root(); + filter_term_warning.clear(); } if (!p_parent) { @@ -704,8 +705,8 @@ bool SceneTreeEditor::_item_matches_all_terms(TreeItem *p_item, PackedStringArra return false; } } - } else { - WARN_PRINT(vformat(TTR("Special Node filter \"%s\" is not recognised. Available filters include \"type\" and \"group\"."), parameter)); + } else if (filter_term_warning.is_empty()) { + filter_term_warning = vformat(TTR("\"%s\" is not a known filter."), parameter); continue; } } else { @@ -1029,6 +1030,10 @@ String SceneTreeEditor::get_filter() const { return filter; } +String SceneTreeEditor::get_filter_term_warning() { + return filter_term_warning; +} + void SceneTreeEditor::set_undo_redo(Ref p_undo_redo) { undo_redo = p_undo_redo; } -- cgit v1.2.3