From 3a05bdbaab2bc45b3d674e9001aab14b58ca7ed6 Mon Sep 17 00:00:00 2001 From: "Daniel J. Ramirez" Date: Fri, 8 Sep 2017 02:32:43 -0500 Subject: Improved alternative size thumbnail generation --- editor/filesystem_dock.cpp | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'editor/filesystem_dock.cpp') diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index a66d1724a1..69c1424403 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -215,9 +215,6 @@ void FileSystemDock::_notification(int p_what) { button_hist_next->set_icon(get_icon("Forward", "EditorIcons")); button_hist_prev->set_icon(get_icon("Back", "EditorIcons")); - Theme::get_default()->clear_icon("ResizedFolder", "EditorIcons"); - Theme::get_default()->clear_icon("ResizedFile", "EditorIcons"); - if (new_mode != display_mode) { set_display_mode(new_mode); } else { @@ -437,39 +434,15 @@ void FileSystemDock::_update_files(bool p_keep_selection) { files->set_max_text_lines(2); files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); - if (!has_icon("ResizedFolder", "EditorIcons")) { - Ref folder = get_icon("FolderBig", "EditorIcons"); - Ref img = folder->get_data(); - img = img->duplicate(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_folder = Ref(memnew(ImageTexture)); - resized_folder->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFolder", "EditorIcons", resized_folder); - } - - folder_thumbnail = get_icon("ResizedFolder", "EditorIcons"); - - if (!has_icon("ResizedFile", "EditorIcons")) { - Ref file = get_icon("FileBig", "EditorIcons"); - Ref img = file->get_data(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_file = Ref(memnew(ImageTexture)); - resized_file->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFile", "EditorIcons", resized_file); - } - - if (!has_icon("ResizedFileBroken", "EditorIcons")) { - Ref file = get_icon("FileBigBroken", "EditorIcons"); - Ref img = file->get_data(); - img->resize(thumbnail_size, thumbnail_size); - Ref resized_file = Ref(memnew(ImageTexture)); - resized_file->create_from_image(img, 0); - Theme::get_default()->set_icon("ResizedFileBroken", "EditorIcons", resized_file); + if (thumbnail_size < 64) { + folder_thumbnail = get_icon("FolderMediumThumb", "EditorIcons"); + file_thumbnail = get_icon("FileMediumThumb", "EditorIcons"); + file_thumbnail_broken = get_icon("FileDeadMediumThumb", "EditorIcons"); + } else { + folder_thumbnail = get_icon("FolderBigThumb", "EditorIcons"); + file_thumbnail = get_icon("FileBigThumb", "EditorIcons"); + file_thumbnail_broken = get_icon("FileDeadBigThumb", "EditorIcons"); } - - file_thumbnail = get_icon("ResizedFile", "EditorIcons"); - - file_thumbnail_broken = get_icon("ResizedFileBroken", "EditorIcons"); } else { files->set_icon_mode(ItemList::ICON_MODE_LEFT); -- cgit v1.2.3