Unify setting tooltips for items in SceneTreeEditor
This commit is contained in:
parent
ee86505136
commit
82f6dae408
@ -357,33 +357,22 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the node name in all tooltips so that long node names can be previewed
|
{
|
||||||
// without having to rename them.
|
// Display the node name in all tooltips so that long node names can be previewed
|
||||||
if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
|
// without having to rename them.
|
||||||
item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
String tooltip = String(p_node->get_name());
|
||||||
|
|
||||||
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_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
|
||||||
if (!p_node->get_editor_description().is_empty()) {
|
item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
||||||
tooltip += "\n\n" + p_node->get_editor_description();
|
tooltip += String("\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path());
|
||||||
|
} else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) {
|
||||||
|
item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
||||||
|
tooltip += String("\n" + TTR("Instance:") + " " + p_node->get_scene_file_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
item->set_tooltip_text(0, tooltip);
|
StringName custom_type = EditorNode::get_singleton()->get_object_custom_type_name(p_node);
|
||||||
} else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) {
|
tooltip += String("\n" + TTR("Type:") + " " + (custom_type != StringName() ? String(custom_type) : p_node->get_class()));
|
||||||
item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor"));
|
|
||||||
|
|
||||||
String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_scene_file_path() + "\n" + TTR("Type:") + " " + p_node->get_class();
|
|
||||||
if (!p_node->get_editor_description().is_empty()) {
|
|
||||||
tooltip += "\n\n" + p_node->get_editor_description();
|
|
||||||
}
|
|
||||||
|
|
||||||
item->set_tooltip_text(0, tooltip);
|
|
||||||
} else {
|
|
||||||
StringName type = EditorNode::get_singleton()->get_object_custom_type_name(p_node);
|
|
||||||
if (type == StringName()) {
|
|
||||||
type = p_node->get_class();
|
|
||||||
}
|
|
||||||
|
|
||||||
String tooltip = String(p_node->get_name()) + "\n" + TTR("Type:") + " " + type;
|
|
||||||
if (!p_node->get_editor_description().is_empty()) {
|
if (!p_node->get_editor_description().is_empty()) {
|
||||||
tooltip += "\n\n" + p_node->get_editor_description();
|
tooltip += "\n\n" + p_node->get_editor_description();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user