summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-11-29 16:19:17 +0100
committerkobewi <kobewi4e@gmail.com>2023-11-29 16:19:17 +0100
commit0b172742cfe011e2ad8823765b6f6500a126598e (patch)
treeede697fcf854d30a27f9ea2a1722530aa552ed80 /editor/editor_node.cpp
parent4c5a1484527ec5f8e320a24d0ee4c4fde0514776 (diff)
downloadredot-engine-0b172742cfe011e2ad8823765b6f6500a126598e.tar.gz
Save external data even without scene
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b2a65063a7..6584b38a9f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1693,7 +1693,7 @@ bool EditorNode::_validate_scene_recursive(const String &p_filename, Node *p_nod
return false;
}
-int EditorNode::_save_external_resources() {
+int EditorNode::_save_external_resources(bool p_also_save_external_data) {
// Save external resources and its subresources if any was modified.
int flg = 0;
@@ -1739,6 +1739,16 @@ int EditorNode::_save_external_resources() {
saved++;
}
+ if (p_also_save_external_data) {
+ for (int i = 0; i < editor_data.get_editor_plugin_count(); i++) {
+ EditorPlugin *plugin = editor_data.get_editor_plugin(i);
+ if (!plugin->get_unsaved_status().is_empty()) {
+ plugin->save_external_data();
+ saved++;
+ }
+ }
+ }
+
EditorUndoRedoManager::get_singleton()->set_history_as_saved(EditorUndoRedoManager::GLOBAL_HISTORY);
return saved;
@@ -2634,10 +2644,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
ScriptEditor::get_singleton()->save_current_script();
}
- const int saved = _save_external_resources();
+ const int saved = _save_external_resources(true);
if (saved > 0) {
show_accept(
- vformat(TTR("The current scene has no root node, but %d modified external resource(s) were saved anyway."), saved),
+ vformat(TTR("The current scene has no root node, but %d modified external resource(s) and/or plugin data were saved anyway."), saved),
TTR("OK"));
} else if (p_option == FILE_SAVE_AS_SCENE) {
// Don't show this dialog when pressing Ctrl + S to avoid interfering with script saving.