From c461b15720359129a47de4ca370785e100043214 Mon Sep 17 00:00:00 2001 From: Karolis K Date: Wed, 9 May 2018 15:08:20 +0300 Subject: [PATCH] Fix icon if remote icon load fails (cherry picked from commit c3e921fba3be76c27c33c495e2df4b64fdeb8638) --- editor/plugins/asset_library_editor_plugin.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 704b0512f79..b57ffb6dd13 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -65,7 +65,7 @@ void EditorAssetLibraryItem::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - icon->set_normal_texture(get_icon("GodotAssetDefault", "EditorIcons")); + icon->set_normal_texture(get_icon("DefaultProjectIcon", "EditorIcons")); category->add_color_override("font_color", Color(0.5, 0.5, 0.5)); author->add_color_override("font_color", Color(0.5, 0.5, 0.5)); } @@ -110,6 +110,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { add_child(hb); icon = memnew(TextureButton); + icon->set_custom_minimum_size(Size2(64, 64)); icon->set_default_cursor_shape(CURSOR_POINTING_HAND); icon->connect("pressed", this, "_asset_clicked"); @@ -383,7 +384,7 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse icon->set_texture(p_preview); asset_id = p_asset_id; if (!p_preview.is_valid()) - icon->set_texture(get_icon("GodotAssetDefault", "EditorIcons")); + icon->set_texture(get_icon("DefaultProjectIcon", "EditorIcons")); host = p_download_url; sha256 = p_sha256_hash; asset_installer->connect("confirmed", this, "_close"); @@ -704,7 +705,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt switch (image_queue[p_queue_id].image_type) { case IMAGE_QUEUE_ICON: - image->resize(80 * EDSCALE, 80 * EDSCALE, Image::INTERPOLATE_CUBIC); + image->resize(64 * EDSCALE, 64 * EDSCALE, Image::INTERPOLATE_CUBIC); break; case IMAGE_QUEUE_THUMBNAIL: { @@ -734,7 +735,7 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt } if (!image_set && final) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons")); } } } @@ -777,7 +778,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons WARN_PRINTS("Error getting PNG file for asset id " + itos(image_queue[p_queue_id].asset_id)); Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target); if (obj) { - obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("ErrorSign", "EditorIcons")); + obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons")); } }