From 393cf409223180760f92578a0de5ba3ffd4f39b6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 30 Jun 2022 23:36:51 +0200 Subject: [PATCH] Distinguish multiple node configuration warnings in the scene tree dock A number of dots is present next to the node configuration icon warning when there is more than 1 warning. Co-authored-by: Hendrik Brucker --- editor/icons/NodeWarnings2.svg | 1 + editor/icons/NodeWarnings3.svg | 1 + editor/icons/NodeWarnings4Plus.svg | 1 + editor/scene_tree_editor.cpp | 12 +++++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 editor/icons/NodeWarnings2.svg create mode 100644 editor/icons/NodeWarnings3.svg create mode 100644 editor/icons/NodeWarnings4Plus.svg diff --git a/editor/icons/NodeWarnings2.svg b/editor/icons/NodeWarnings2.svg new file mode 100644 index 00000000000..e0385c28d1d --- /dev/null +++ b/editor/icons/NodeWarnings2.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/NodeWarnings3.svg b/editor/icons/NodeWarnings3.svg new file mode 100644 index 00000000000..53c0e70034a --- /dev/null +++ b/editor/icons/NodeWarnings3.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/NodeWarnings4Plus.svg b/editor/icons/NodeWarnings4Plus.svg new file mode 100644 index 00000000000..64c0a0671d8 --- /dev/null +++ b/editor/icons/NodeWarnings4Plus.svg @@ -0,0 +1 @@ + diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index a77687677bf..282cfa80e88 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -268,7 +268,17 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { String warning = p_node->get_configuration_warnings_as_string(); if (!warning.is_empty()) { - item->add_button(0, get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + warning); + const int num_warnings = p_node->get_configuration_warnings().size(); + String warning_icon; + if (num_warnings == 1) { + warning_icon = SNAME("NodeWarning"); + } else if (num_warnings <= 3) { + warning_icon = vformat("NodeWarnings%d", num_warnings); + } else { + warning_icon = SNAME("NodeWarnings4Plus"); + } + + item->add_button(0, get_theme_icon(warning_icon, SNAME("EditorIcons")), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + warning); } if (p_node->is_unique_name_in_owner()) {