-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix² behavior of ResourceFormatLoader CACHE_MODE_REPLACE
#87008
The head ref may contain hidden characters: "cache_mode_replace_fixes\u00B2"
Fix² behavior of ResourceFormatLoader CACHE_MODE_REPLACE
#87008
Conversation
core/io/resource_loader.cpp
Outdated
if (load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE) { | ||
Ref<Resource> res = ResourceCache::get_ref(load_task.local_path); | ||
if (res.is_valid() && res != load_task.resource) { | ||
// If resource is already loaded, only replace its data, to avoid existing invalidating instances. | ||
res->copy_from(load_task.resource); | ||
load_task.resource = res; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is added by this PR and it's the only difference from the previous one.
091883c
to
2e09985
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit hard to assess all the possible outcomes, but looks sensible.
Thanks! |
- 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 godotengine#87008). - Add two recursive modes, counterparts of `CACHE_MODE_REPLACE` and `CACHE_MODE_IGNORE`, since it seems some need them (see godotengine#59669, godotengine#82830). - Let resources, even loaded with one of the ignore-cache modes, get a path, which is useful for tools.
Same as #84167, but does not introduce #86187
When a resource is already loaded,
CACHE_MODE_REPLACE
will usecopy_from()
to replace the data in the loaded instances (in the previous version of this PR, the old instances were invalidated and made local).Fixes #81498