mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Enhance cache modes in resource loading
- Unify documentation, hoping to clear misconcepctions about about propagation of the cache mode across dependant loads. - Clarify in docs that `CACHE_MODE_REPLACE` now also works on the main resource (from #87008). - Add two recursive modes, counterparts of `CACHE_MODE_REPLACE` and `CACHE_MODE_IGNORE`, since it seems some need them (see #59669, #82830). - Let resources, even loaded with one of the ignore-cache modes, get a path, which is useful for tools.
This commit is contained in:
parent
bb6b06c813
commit
5e144022e7
15 changed files with 104 additions and 28 deletions
|
@ -2817,7 +2817,8 @@ Ref<GDScript> GDScriptLanguage::get_script_by_fully_qualified_name(const String
|
|||
|
||||
Ref<Resource> ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
|
||||
Error err;
|
||||
Ref<GDScript> scr = GDScriptCache::get_full_script(p_path, err, "", p_cache_mode == CACHE_MODE_IGNORE);
|
||||
bool ignoring = p_cache_mode == CACHE_MODE_IGNORE || p_cache_mode == CACHE_MODE_IGNORE_DEEP;
|
||||
Ref<GDScript> scr = GDScriptCache::get_full_script(p_path, err, "", ignoring);
|
||||
|
||||
if (err && scr.is_valid()) {
|
||||
// If !scr.is_valid(), the error was likely from scr->load_source_code(), which already generates an error.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue