1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

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 <hendrik.brucker@mail.de>
This commit is contained in:
Hugo Locurcio
2022-06-30 23:36:51 +02:00
parent ea4b8de2b4
commit 393cf40922
4 changed files with 14 additions and 1 deletions

View File

@@ -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()) {