diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-05-14 08:39:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 08:39:27 +0200 |
commit | 8c71cbbe3fcd45cc1459c24a712273d143ef6879 (patch) | |
tree | 75e5480f5c7930fcabcc27a9e457f656002f38b0 /editor | |
parent | aba499965caa78ce1fd9a412ab3f385e1bdf1006 (diff) | |
parent | 0711d865e21311b625941f1e4618bb0c83410ed5 (diff) |
Merge pull request #18797 from TailyFair/assetlib-video-overlay
Added video thumbnail overlay in asset description
Diffstat (limited to 'editor')
-rw-r--r-- | editor/icons/icon_play_overlay.svg | 4 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/editor/icons/icon_play_overlay.svg b/editor/icons/icon_play_overlay.svg new file mode 100644 index 0000000000..eff33f1b6b --- /dev/null +++ b/editor/icons/icon_play_overlay.svg @@ -0,0 +1,4 @@ +<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"> + <rect x="0" y="0" width="64" height="64" rx="5" ry="5" fill="#044B94" fill-opacity="0.6"/> + <path d="M16 16 L48 32 L16 48" fill="#f2f2f2"/> +</svg>
\ No newline at end of file diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index eef72a8b3e..0ff316a286 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -171,7 +171,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; } } |