summaryrefslogtreecommitdiff
path: root/editor/editor_resource_preview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_resource_preview.cpp')
-rw-r--r--editor/editor_resource_preview.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 327e61cea3..65a1704770 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -46,8 +46,7 @@ bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
if (get_script_instance() && get_script_instance()->has_method("handles")) {
return get_script_instance()->call("handles", p_type);
}
- ERR_EXPLAIN("EditorResourcePreviewGenerator::handles needs to be overridden");
- ERR_FAIL_V(false);
+ ERR_FAIL_V_MSG(false, "EditorResourcePreviewGenerator::handles needs to be overridden.");
}
Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from, const Size2 &p_size) const {
@@ -55,8 +54,7 @@ Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from, const S
if (get_script_instance() && get_script_instance()->has_method("generate")) {
return get_script_instance()->call("generate", p_from, p_size);
}
- ERR_EXPLAIN("EditorResourcePreviewGenerator::generate needs to be overridden");
- ERR_FAIL_V(Ref<Texture>());
+ ERR_FAIL_V_MSG(Ref<Texture>(), "EditorResourcePreviewGenerator::generate needs to be overridden.");
}
Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_path, const Size2 &p_size) const {
@@ -118,7 +116,7 @@ void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Textur
uint64_t modified_time = 0;
if (p_str.begins_with("ID:")) {
- hash = p_str.get_slicec(':', 2).to_int();
+ hash = uint32_t(p_str.get_slicec(':', 2).to_int64());
path = "ID:" + p_str.get_slicec(':', 1);
} else {
modified_time = FileAccess::get_modified_time(path);
@@ -205,7 +203,7 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<
}
Error err;
FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE, &err);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot create file '" + cache_base + ".txt'.");
f->store_line(itos(thumbnail_size));
f->store_line(itos(has_small_texture));
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
@@ -297,8 +295,9 @@ void EditorResourcePreview::_thread() {
//update modified time
f = FileAccess::open(file, FileAccess::WRITE);
- f->store_line(itos(modtime));
+ f->store_line(itos(thumbnail_size));
f->store_line(itos(has_small_texture));
+ f->store_line(itos(modtime));
f->store_line(md5);
memdelete(f);
}
@@ -451,7 +450,7 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) {
}
void EditorResourcePreview::start() {
- ERR_FAIL_COND(thread);
+ ERR_FAIL_COND_MSG(thread, "Thread already started.");
thread = Thread::create(_thread_func, this);
}