Fix bug where not all previews are shown, closes #9895
This commit is contained in:
parent
f61e8695c9
commit
a7e8aa4053
|
@ -180,11 +180,13 @@ void EditorResourcePreview::_thread() {
|
||||||
|
|
||||||
if (cache.has(item.path)) {
|
if (cache.has(item.path)) {
|
||||||
//already has it because someone loaded it, just let it know it's ready
|
//already has it because someone loaded it, just let it know it's ready
|
||||||
|
String path = item.path;
|
||||||
if (item.resource.is_valid()) {
|
if (item.resource.is_valid()) {
|
||||||
item.path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below)
|
path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below)
|
||||||
}
|
}
|
||||||
|
|
||||||
_preview_ready(item.path, cache[item.path].preview, item.id, item.function, item.userdata);
|
print_line("cached: " + item.path);
|
||||||
|
_preview_ready(path, cache[item.path].preview, item.id, item.function, item.userdata);
|
||||||
|
|
||||||
preview_mutex->unlock();
|
preview_mutex->unlock();
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,12 +201,16 @@ void EditorResourcePreview::_thread() {
|
||||||
|
|
||||||
if (item.resource.is_valid()) {
|
if (item.resource.is_valid()) {
|
||||||
|
|
||||||
|
print_line("generated: " + item.path);
|
||||||
|
|
||||||
texture = _generate_preview(item, String());
|
texture = _generate_preview(item, String());
|
||||||
//adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred
|
//adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred
|
||||||
_preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, item.id, item.function, item.userdata);
|
_preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, item.id, item.function, item.userdata);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
print_line("from file: " + item.path);
|
||||||
|
|
||||||
String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp");
|
String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp");
|
||||||
String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text();
|
String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text();
|
||||||
cache_base = temp_path.plus_file("resthumb-" + cache_base);
|
cache_base = temp_path.plus_file("resthumb-" + cache_base);
|
||||||
|
|
Loading…
Reference in New Issue