diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-08-23 18:16:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 18:16:26 +0200 |
commit | 1190fbdf2b7c516eb36d0ed2b8da0609d20f1980 (patch) | |
tree | 6eac82fad4e44dc06d871da13c776eac3377b7c5 /editor | |
parent | 5c5bc21195eac1ce8a80d726d391b004adf44247 (diff) | |
parent | d5f44bffe628d80228f36780b272b2d3afa92879 (diff) |
Merge pull request #64733 from Mickeon/try-editor-warning-spacing
Diffstat (limited to 'editor')
-rw-r--r-- | editor/scene_tree_editor.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index b977b012a8..00fd0c3aac 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -279,7 +279,19 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { warning_icon = SNAME("NodeWarnings4Plus"); } - item->add_button(0, get_theme_icon(warning_icon, SNAME("EditorIcons")), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + warning); + // Improve looks on tooltip, extra spacing on non-bullet point newlines. + const String bullet_point = String::utf8("• "); + int next_newline = 0; + while (next_newline != -1) { + next_newline = warning.find("\n", next_newline + 2); + if (warning.substr(next_newline + 1, bullet_point.length()) != bullet_point) { + warning = warning.insert(next_newline + 1, " "); + } + } + + String newline = (num_warnings == 1 ? "\n" : "\n\n"); + + item->add_button(0, get_theme_icon(warning_icon, SNAME("EditorIcons")), BUTTON_WARNING, false, TTR("Node configuration warning:") + newline + warning); } if (p_node->is_unique_name_in_owner()) { |