You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user