diff options
Diffstat (limited to 'editor/editor_resource_preview.cpp')
-rw-r--r-- | editor/editor_resource_preview.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index ee477b7c18..f92962a4cb 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -69,8 +69,8 @@ Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_ void EditorResourcePreviewGenerator::_bind_methods() { ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::STRING, "type"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::OBJECT, "generate:Texture", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::OBJECT, "generate_from_path:Texture", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE))); } EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() { @@ -185,7 +185,6 @@ void EditorResourcePreview::_thread() { path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below) } - print_line("cached: " + item.path); _preview_ready(path, cache[item.path].preview, item.id, item.function, item.userdata); preview_mutex->unlock(); @@ -201,16 +200,12 @@ void EditorResourcePreview::_thread() { if (item.resource.is_valid()) { - print_line("generated: " + item.path); - 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 _preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, item.id, item.function, item.userdata); } else { - print_line("from file: " + item.path); - String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp"); String cache_base = ProjectSettings::get_singleton()->globalize_path(item.path).md5_text(); cache_base = temp_path.plus_file("resthumb-" + cache_base); @@ -218,12 +213,9 @@ void EditorResourcePreview::_thread() { //does not have it, try to load a cached thumbnail String file = cache_base + ".txt"; - //print_line("cachetxt at "+file); FileAccess *f = FileAccess::open(file, FileAccess::READ); if (!f) { - //print_line("generate because not cached"); - //generate texture = _generate_preview(item, cache_base); } else { @@ -283,7 +275,6 @@ void EditorResourcePreview::_thread() { } } - //print_line("notify of preview ready"); _preview_ready(item.path, texture, item.id, item.function, item.userdata); } } |