1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Tree: Ability to add tooltips to TreeItem buttons.

Adds a tooltip parameter to `TreeItem::add_button()` and set a few tooltips in the Project settings and SceneTree dock.

(cherry picked from commit 29999942a2)
This commit is contained in:
Andreas Haas
2017-04-24 21:41:17 +02:00
committed by Rémi Verschelde
parent 831c8cb325
commit 66a1e049b0
4 changed files with 38 additions and 22 deletions

View File

@@ -336,27 +336,27 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
String warning = p_node->get_configuration_warning();
if (warning != String()) {
item->add_button(0, get_icon("NodeWarning", "EditorIcons"), BUTTON_WARNING);
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("ConnectionAndGroups", "EditorIcons"), BUTTON_SIGNALS);
item->add_button(0, get_icon("ConnectionAndGroups", "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("Connect", "EditorIcons"), BUTTON_SIGNALS);
item->add_button(0, get_icon("Connect", "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);
item->add_button(0, get_icon("Groups", "EditorIcons"), BUTTON_GROUPS, false, TTR("Node is in group(s).\nClick to show groups dock."));
}
}
if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE);
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Subscene options"));
item->set_tooltip(0, TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_type());
} else if (p_node != get_scene_node() && p_node->get_filename() != "" && can_open_instance) {
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE);
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Subscene options"));
item->set_tooltip(0, TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_type());
} else {
item->set_tooltip(0, String(p_node->get_name()) + "\n" + TTR("Type:") + " " + p_node->get_type());
@@ -369,24 +369,24 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (!p_node->get_script().is_null()) {
item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT);
item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open script"));
}
if (p_node->is_type("CanvasItem")) {
bool is_locked = p_node->has_meta("_edit_lock_"); //_edit_group_
if (is_locked)
item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK);
item->add_button(0, get_icon("Lock", "EditorIcons"), BUTTON_LOCK, false, TTR("Node is locked.\nClick to unlock"));
bool is_grouped = p_node->has_meta("_edit_group_");
if (is_grouped)
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP);
item->add_button(0, get_icon("Group", "EditorIcons"), BUTTON_GROUP, false, TTR("Children are not selectable.\nClick to make selectable"));
bool h = p_node->call("is_hidden");
if (h)
item->add_button(0, get_icon("Hidden", "EditorIcons"), BUTTON_VISIBILITY);
item->add_button(0, get_icon("Hidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
else
item->add_button(0, get_icon("Visible", "EditorIcons"), BUTTON_VISIBILITY);
item->add_button(0, get_icon("Visible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
if (!p_node->is_connected("visibility_changed", this, "_node_visibility_changed"))
p_node->connect("visibility_changed", this, "_node_visibility_changed", varray(p_node));
@@ -396,9 +396,9 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
bool h = p_node->call("is_hidden");
if (h)
item->add_button(0, get_icon("Hidden", "EditorIcons"), BUTTON_VISIBILITY);
item->add_button(0, get_icon("Hidden", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
else
item->add_button(0, get_icon("Visible", "EditorIcons"), BUTTON_VISIBILITY);
item->add_button(0, get_icon("Visible", "EditorIcons"), BUTTON_VISIBILITY, false, TTR("Toggle Visibility"));
if (!p_node->is_connected("visibility_changed", this, "_node_visibility_changed"))
p_node->connect("visibility_changed", this, "_node_visibility_changed", varray(p_node));