diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index bc61661a83..4795fca03d 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4103,6 +4103,13 @@ void EditorNode::add_io_error(const String &p_error) { EditorInterface::get_singleton()->popup_dialog_centered_ratio(singleton->load_error_dialog, 0.5); } +void EditorNode::add_io_warning(const String &p_warning) { + DEV_ASSERT(Thread::get_caller_id() == Thread::get_main_id()); + singleton->load_errors->add_image(singleton->gui_base->get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); + singleton->load_errors->add_text(p_warning + "\n"); + EditorInterface::get_singleton()->popup_dialog_centered_ratio(singleton->load_error_dialog, 0.5); +} + bool EditorNode::_find_scene_in_use(Node *p_node, const String &p_path) const { if (p_node->get_scene_file_path() == p_path) { return true; @@ -6806,6 +6813,11 @@ EditorNode::EditorNode() { ResourceLoader::set_error_notify_func(&EditorNode::add_io_error); ResourceLoader::set_dependency_error_notify_func(&EditorNode::_dependency_error_report); + SceneState::set_instantiation_warning_notify_func([](const String &p_warning) { + add_io_warning(p_warning); + callable_mp(EditorInterface::get_singleton(), &EditorInterface::mark_scene_as_unsaved).call_deferred(); + }); + { // Register importers at the beginning, so dialogs are created with the right extensions. Ref<ResourceImporterTexture> import_texture; |