mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Improve saving of built-in resources
This commit is contained in:
parent
13a0d6e9b2
commit
e534dbf53a
5 changed files with 45 additions and 2 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue