diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-08-16 22:30:31 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-08-17 14:20:16 +0200 |
commit | c62302a4321323625a00ba0f3e474db8a74e012f (patch) | |
tree | c67d59e1412bd1199dc2cf586cf4acbda28d1fe9 /editor | |
parent | de8ce3e625e74833aec6a5d165e7e82100a1dbf3 (diff) |
Improve the scene tree signals/groups tooltip
The tooltip now displays the number of connections and groups
that are assigned to the hovered node.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/scene_tree_editor.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 2d9accc3d8..25132796f1 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -270,15 +270,30 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { item->add_button(0, get_icon("NodeWarning", "EditorIcons"), BUTTON_WARNING, false, TTR("Node configuration warning:") + "\n" + p_node->get_configuration_warning()); } - bool has_connections = p_node->has_persistent_signal_connections(); - bool has_groups = p_node->has_persistent_groups(); - - if (has_connections && has_groups) { - item->add_button(0, get_icon("SignalsAndGroups", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connection(s) and group(s).\nClick to show signals dock.")); - } else if (has_connections) { - item->add_button(0, get_icon("Signals", "EditorIcons"), BUTTON_SIGNALS, false, TTR("Node has connections.\nClick to show signals dock.")); - } else if (has_groups) { - item->add_button(0, get_icon("Groups", "EditorIcons"), BUTTON_GROUPS, false, TTR("Node is in group(s).\nClick to show groups dock.")); + int num_connections = p_node->get_persistent_signal_connection_count(); + int num_groups = p_node->get_persistent_group_count(); + + if (num_connections >= 1 && num_groups >= 1) { + item->add_button( + 0, + get_icon("SignalsAndGroups", "EditorIcons"), + BUTTON_SIGNALS, + false, + vformat(TTR("Node has %s connection(s) and %s group(s).\nClick to show signals dock."), num_connections, num_groups)); + } else if (num_connections >= 1) { + item->add_button( + 0, + get_icon("Signals", "EditorIcons"), + BUTTON_SIGNALS, + false, + vformat(TTR("Node has %s connection(s).\nClick to show signals dock."), num_connections)); + } else if (num_groups >= 1) { + item->add_button( + 0, + get_icon("Groups", "EditorIcons"), + BUTTON_GROUPS, + false, + vformat(TTR("Node is in %s group(s).\nClick to show groups dock."), num_groups)); } } |