|
46 | 46 | #include "editor/themes/editor_scale.h" |
47 | 47 | #include "scene/gui/button.h" |
48 | 48 | #include "scene/gui/texture_rect.h" |
| 49 | +#include "scene/property_utils.h" |
49 | 50 | #include "scene/resources/gradient_texture.h" |
50 | 51 | #include "scene/resources/image_texture.h" |
51 | 52 |
|
@@ -107,19 +108,34 @@ void EditorResourcePicker::_update_resource() { |
107 | 108 |
|
108 | 109 | String tooltip; |
109 | 110 |
|
| 111 | + String resource_name = "resource"; |
| 112 | + if (edited_resource.is_valid()) { |
| 113 | + resource_name = edited_resource->get_class(); |
| 114 | + |
| 115 | + if (edited_resource->has_meta(SceneStringNames::get_singleton()->_custom_type_script)) { |
| 116 | + if (const Ref<Script> custom_script = PropertyUtils::get_custom_type_script(*edited_resource); custom_script.is_valid()) { |
| 117 | + if (const String global_name = custom_script->get_global_name(); !global_name.is_empty()) { |
| 118 | + resource_name = global_name; |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | + |
110 | 124 | if (num_of_copies > 1) { |
111 | | - tooltip = vformat(TTR("This Resource is used in (%d) places."), num_of_copies); |
| 125 | + tooltip = vformat(TTRN("This %s is used in %d place.", "This %s is used in %d places.", num_of_copies), resource_name, num_of_copies); |
112 | 126 | } else if (!is_internal) { |
113 | | - tooltip = TTR("This Resource is external to scene."); |
| 127 | + tooltip = vformat(TTR("This %s is external to scene."), resource_name); |
114 | 128 | } |
115 | 129 |
|
116 | 130 | if (!editable) { |
117 | | - tooltip += "\n" + TTR("The Resource cannot be edited in the inspector and can't be made unique directly.") + "\n"; |
| 131 | + tooltip += "\n" + vformat(TTR("The %s cannot be edited in the inspector and can't be made unique directly."), resource_name) + "\n"; |
118 | 132 | } else { |
119 | | - tooltip += unique_enable ? TTR(" Left-click to make it unique.") + "\n" : "\n"; |
| 133 | + if (unique_enable) { |
| 134 | + tooltip += "\n" + TTR("Left-click to make it unique.") + "\n"; |
| 135 | + } |
120 | 136 |
|
121 | 137 | if (unique_recursive_enabled) { |
122 | | - tooltip += TTR("It is possible to make its subresources unique. Right-click to make them unique.") + "\n"; |
| 138 | + tooltip += TTR("It is possible to make its subresources unique.") + "\n" + TTR("Right-click to make them unique."); |
123 | 139 | } |
124 | 140 |
|
125 | 141 | if (!unique_enable && EditorNode::get_singleton()->get_editor_selection()->get_full_selected_node_list().size() == 1) { |
|
0 commit comments