summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-01-02 12:53:18 +0100
committerkobewi <kobewi4e@gmail.com>2024-01-02 12:53:18 +0100
commite534dbf53a489ffc1537918b757812161c464e85 (patch)
tree94ca40ecb5b3a19ca4732da9c780352280ae0d6e /editor/plugins/script_editor_plugin.cpp
parent13a0d6e9b253654f5cc2a44f3d0b3cae10440443 (diff)
downloadredot-engine-e534dbf53a489ffc1537918b757812161c464e85.tar.gz
Improve saving of built-in resources
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r--editor/plugins/script_editor_plugin.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index c1a65b7bb7..fa6d710325 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1000,12 +1000,21 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
}
}
+ if (p_res.is_valid()) {
+ // In case the Resource has built-in scripts.
+ _mark_built_in_scripts_as_saved(p_res->get_path());
+ }
+
_update_script_names();
trigger_live_script_reload();
}
void ScriptEditor::_scene_saved_callback(const String &p_path) {
// If scene was saved, mark all built-in scripts from that scene as saved.
+ _mark_built_in_scripts_as_saved(p_path);
+}
+
+void ScriptEditor::_mark_built_in_scripts_as_saved(const String &p_parent_path) {
for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
@@ -1018,7 +1027,7 @@ void ScriptEditor::_scene_saved_callback(const String &p_path) {
continue; // External script, who cares.
}
- if (edited_res->get_path().get_slice("::", 0) == p_path) {
+ if (edited_res->get_path().get_slice("::", 0) == p_parent_path) {
se->tag_saved_version();
}