summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-26 14:51:11 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-26 14:51:11 +0200
commit54dbb1727398caeb3783d9601c0aed5f389fe63f (patch)
tree0d10aed46b5c6dfa42406e53700285650bdb93e3
parentb0c7f45a72be0d1dfb7cffb0d53379cd9fa7c38b (diff)
parent0b172742cfe011e2ad8823765b6f6500a126598e (diff)
downloadredot-engine-54dbb1727398caeb3783d9601c0aed5f389fe63f.tar.gz
Merge pull request #85513 from KoBeWi/that_one_weird_plugin_that_uses_no_Resources
Save external data even without scene
-rw-r--r--editor/editor_node.cpp16
-rw-r--r--editor/editor_node.h2
2 files changed, 14 insertions, 4 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ea42fff85a..ae7066fea9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1737,7 +1737,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;
@@ -1783,6 +1783,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;
@@ -2726,10 +2736,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.
diff --git a/editor/editor_node.h b/editor/editor_node.h
index b7b4dff74e..49674dd1c1 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -573,7 +573,7 @@ private:
void _update_undo_redo_allowed();
- int _save_external_resources();
+ int _save_external_resources(bool p_also_save_external_data = false);
void _set_current_scene(int p_idx);
void _set_current_scene_nocheck(int p_idx);