Display the node name in scene tree dock tooltips

This makes long node names previewable without having to rename them.

(cherry picked from commit c673aea124)
This commit is contained in:
Hugo Locurcio 2021-09-01 15:02:42 +02:00 committed by Rémi Verschelde
parent 92377f4b20
commit 520b2d822a
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -290,10 +290,12 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
}
}
// Display the node name in all tooltips so that long node names can be previewed
// without having to rename them.
if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
String tooltip = TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class();
String tooltip = String(p_node->get_name()) + "\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path() + "\n" + TTR("Type:") + " " + p_node->get_class();
if (p_node->get_editor_description() != String()) {
tooltip += "\n\n" + p_node->get_editor_description();
}
@ -302,7 +304,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
} else if (p_node != get_scene_node() && p_node->get_filename() != "" && can_open_instance) {
item->add_button(0, get_icon("InstanceOptions", "EditorIcons"), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
String tooltip = TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class();
String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class();
if (p_node->get_editor_description() != String()) {
tooltip += "\n\n" + p_node->get_editor_description();
}
@ -314,7 +316,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
type = p_node->get_class();
}
String tooltip = TTR("Type:") + " " + type;
String tooltip = String(p_node->get_name()) + "\n" + TTR("Type:") + " " + type;
if (p_node->get_editor_description() != String()) {
tooltip += "\n\n" + p_node->get_editor_description();
}