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:
@ -736,7 +736,7 @@ StreamTexture2D::~StreamTexture2D() {
|
||||
}
|
||||
}
|
||||
|
||||
RES ResourceFormatLoaderStreamTexture2D::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
||||
RES ResourceFormatLoaderStreamTexture2D::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) {
|
||||
Ref<StreamTexture2D> st;
|
||||
st.instance();
|
||||
Error err = st->load(p_path);
|
||||
@ -1034,7 +1034,7 @@ StreamTexture3D::~StreamTexture3D() {
|
||||
|
||||
/////////////////////////////
|
||||
|
||||
RES ResourceFormatLoaderStreamTexture3D::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
||||
RES ResourceFormatLoaderStreamTexture3D::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) {
|
||||
Ref<StreamTexture3D> st;
|
||||
st.instance();
|
||||
Error err = st->load(p_path);
|
||||
@ -2432,7 +2432,7 @@ StreamTextureLayered::~StreamTextureLayered() {
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
RES ResourceFormatLoaderStreamTextureLayered::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {
|
||||
RES ResourceFormatLoaderStreamTextureLayered::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) {
|
||||
Ref<StreamTextureLayered> st;
|
||||
if (p_path.get_extension().to_lower() == "stexarray") {
|
||||
Ref<StreamTexture2DArray> s;
|
||||
|
||||
Reference in New Issue
Block a user