|
@@ -118,8 +118,6 @@ Variant EditorResourcePreviewGenerator::DrawRequester::_post_semaphore() const {
|
|
return Variant(); // Needed because of how the callback is used.
|
|
return Variant(); // Needed because of how the callback is used.
|
|
}
|
|
}
|
|
|
|
|
|
-EditorResourcePreview *EditorResourcePreview::singleton = nullptr;
|
|
|
|
-
|
|
|
|
bool EditorResourcePreview::is_threaded() const {
|
|
bool EditorResourcePreview::is_threaded() const {
|
|
return RSG::texture_storage->can_create_resources_async();
|
|
return RSG::texture_storage->can_create_resources_async();
|
|
}
|
|
}
|
|
@@ -291,13 +289,17 @@ void EditorResourcePreview::_iterate() {
|
|
bool has_small_texture;
|
|
bool has_small_texture;
|
|
uint64_t last_modtime;
|
|
uint64_t last_modtime;
|
|
String hash;
|
|
String hash;
|
|
- _read_preview_cache(f, &tsize, &has_small_texture, &last_modtime, &hash, &preview_metadata);
|
|
|
|
|
|
+ bool outdated;
|
|
|
|
+ _read_preview_cache(f, &tsize, &has_small_texture, &last_modtime, &hash, &preview_metadata, &outdated);
|
|
|
|
|
|
bool cache_valid = true;
|
|
bool cache_valid = true;
|
|
|
|
|
|
if (tsize != thumbnail_size) {
|
|
if (tsize != thumbnail_size) {
|
|
cache_valid = false;
|
|
cache_valid = false;
|
|
f.unref();
|
|
f.unref();
|
|
|
|
+ } else if (outdated) {
|
|
|
|
+ cache_valid = false;
|
|
|
|
+ f.unref();
|
|
} else if (last_modtime != modtime) {
|
|
} else if (last_modtime != modtime) {
|
|
String last_md5 = f->get_line();
|
|
String last_md5 = f->get_line();
|
|
String md5 = FileAccess::get_md5(item.path);
|
|
String md5 = FileAccess::get_md5(item.path);
|
|
@@ -357,14 +359,16 @@ void EditorResourcePreview::_write_preview_cache(Ref<FileAccess> p_file, int p_t
|
|
p_file->store_line(itos(p_modified_time));
|
|
p_file->store_line(itos(p_modified_time));
|
|
p_file->store_line(p_hash);
|
|
p_file->store_line(p_hash);
|
|
p_file->store_line(VariantUtilityFunctions::var_to_str(p_metadata).replace("\n", " "));
|
|
p_file->store_line(VariantUtilityFunctions::var_to_str(p_metadata).replace("\n", " "));
|
|
|
|
+ p_file->store_line(itos(CURRENT_METADATA_VERSION));
|
|
}
|
|
}
|
|
|
|
|
|
-void EditorResourcePreview::_read_preview_cache(Ref<FileAccess> p_file, int *r_thumbnail_size, bool *r_has_small_texture, uint64_t *r_modified_time, String *r_hash, Dictionary *r_metadata) {
|
|
|
|
|
|
+void EditorResourcePreview::_read_preview_cache(Ref<FileAccess> p_file, int *r_thumbnail_size, bool *r_has_small_texture, uint64_t *r_modified_time, String *r_hash, Dictionary *r_metadata, bool *r_outdated) {
|
|
*r_thumbnail_size = p_file->get_line().to_int();
|
|
*r_thumbnail_size = p_file->get_line().to_int();
|
|
*r_has_small_texture = p_file->get_line().to_int();
|
|
*r_has_small_texture = p_file->get_line().to_int();
|
|
*r_modified_time = p_file->get_line().to_int();
|
|
*r_modified_time = p_file->get_line().to_int();
|
|
*r_hash = p_file->get_line();
|
|
*r_hash = p_file->get_line();
|
|
*r_metadata = VariantUtilityFunctions::str_to_var(p_file->get_line());
|
|
*r_metadata = VariantUtilityFunctions::str_to_var(p_file->get_line());
|
|
|
|
+ *r_outdated = p_file->get_line().to_int() < CURRENT_METADATA_VERSION;
|
|
}
|
|
}
|
|
|
|
|
|
void EditorResourcePreview::_thread() {
|
|
void EditorResourcePreview::_thread() {
|