mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk -Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type) -Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
This commit is contained in:
parent
e5bb89cdd5
commit
f8d03b98e7
83 changed files with 395 additions and 183 deletions
|
@ -688,7 +688,7 @@ void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_fo
|
|||
uint64_t date = FileAccess::get_modified_time(script->get_path());
|
||||
|
||||
if (last_date != date) {
|
||||
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), true);
|
||||
Ref<Script> rel_script = ResourceLoader::load(script->get_path(), script->get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
ERR_CONTINUE(!rel_script.is_valid());
|
||||
script->set_source_code(rel_script->get_source_code());
|
||||
script->set_last_modified_time(rel_script->get_last_modified_time());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue