|
34 | 34 | #include "core/io/file_access.h" |
35 | 35 | #include "core/io/resource_loader.h" |
36 | 36 | #include "editor/editor_node.h" |
| 37 | +#include "editor/editor_string_names.h" |
37 | 38 | #include "editor/file_system/editor_file_system.h" |
38 | 39 | #include "editor/gui/editor_file_dialog.h" |
39 | 40 | #include "editor/settings/editor_settings.h" |
@@ -164,6 +165,12 @@ void DependencyEditor::_update_file() { |
164 | 165 | EditorFileSystem::get_singleton()->update_file(editing); |
165 | 166 | } |
166 | 167 |
|
| 168 | +void DependencyEditor::_notification(int p_what) { |
| 169 | + if (p_what == NOTIFICATION_THEME_CHANGED) { |
| 170 | + warning_label->add_theme_color_override(SceneStringName(font_color), get_theme_color("warning_color", EditorStringName(Editor))); |
| 171 | + } |
| 172 | +} |
| 173 | + |
167 | 174 | void DependencyEditor::_update_list() { |
168 | 175 | List<String> deps; |
169 | 176 | ResourceLoader::get_dependencies(editing, &deps, true); |
@@ -229,13 +236,17 @@ void DependencyEditor::edit(const String &p_path) { |
229 | 236 | set_title(TTR("Dependencies For:") + " " + p_path.get_file()); |
230 | 237 |
|
231 | 238 | _update_list(); |
232 | | - popup_centered_ratio(0.4); |
233 | 239 |
|
234 | 240 | if (EditorNode::get_singleton()->is_scene_open(p_path)) { |
235 | | - EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file())); |
| 241 | + warning_label->show(); |
| 242 | + warning_label->set_text(vformat(TTR("Scene \"%s\" is currently being edited. Changes will only take effect when reloaded."), p_path.get_file())); |
236 | 243 | } else if (ResourceCache::has(p_path)) { |
237 | | - EditorNode::get_singleton()->show_warning(vformat(TTR("Resource '%s' is in use.\nChanges will only take effect when reloaded."), p_path.get_file())); |
| 244 | + warning_label->show(); |
| 245 | + warning_label->set_text(vformat(TTR("Resource \"%s\" is in use. Changes will only take effect when reloaded."), p_path.get_file())); |
| 246 | + } else { |
| 247 | + warning_label->hide(); |
238 | 248 | } |
| 249 | + popup_centered_ratio(0.4); |
239 | 250 | } |
240 | 251 |
|
241 | 252 | DependencyEditor::DependencyEditor() { |
@@ -274,6 +285,10 @@ DependencyEditor::DependencyEditor() { |
274 | 285 | mc->add_child(tree); |
275 | 286 | vb->add_child(mc); |
276 | 287 |
|
| 288 | + warning_label = memnew(Label); |
| 289 | + warning_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD); |
| 290 | + vb->add_child(warning_label); |
| 291 | + |
277 | 292 | set_title(TTR("Dependency Editor")); |
278 | 293 | search = memnew(EditorFileDialog); |
279 | 294 | search->connect("file_selected", callable_mp(this, &DependencyEditor::_searched)); |
|
0 commit comments