diff options
| author | Karolis K <karolis.kalzanauskas@stud.vgtu.lt> | 2018-05-11 20:28:17 +0300 |
|---|---|---|
| committer | Karolis K <karolis.kalzanauskas@stud.vgtu.lt> | 2018-05-11 23:43:59 +0300 |
| commit | 0711d865e21311b625941f1e4618bb0c83410ed5 (patch) | |
| tree | 0129b49a8b7bb2a528ffd12585c37f175e59b355 /editor/plugins/asset_library_editor_plugin.cpp | |
| parent | eaa6613f0683bfc29767e9c4abc9f5b1435b5577 (diff) | |
| download | redot-engine-0711d865e21311b625941f1e4618bb0c83410ed5.tar.gz | |
Thumbnail overlay for videos in AssetLib
Diffstat (limited to 'editor/plugins/asset_library_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 05833704d1..c9a7433e2d 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -170,7 +170,23 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const for (int i = 0; i < preview_images.size(); i++) { if (preview_images[i].id == p_index) { - preview_images[i].button->set_icon(p_image); + if (preview_images[i].is_video) { + Ref<Image> overlay = get_icon("PlayOverlay", "EditorIcons")->get_data(); + Ref<Image> thumbnail = p_image->get_data(); + Point2 overlay_pos = Point2((thumbnail->get_width() - overlay->get_width()) / 2, (thumbnail->get_height() - overlay->get_height()) / 2); + + thumbnail->lock(); + thumbnail->blend_rect(overlay, overlay->get_used_rect(), overlay_pos); + thumbnail->unlock(); + + Ref<ImageTexture> tex; + tex.instance(); + tex->create_from_image(thumbnail); + + preview_images[i].button->set_icon(tex); + } else { + preview_images[i].button->set_icon(p_image); + } break; } } |
