Skip to content

Commit

Permalink
Merge pull request #18797 from TailyFair/assetlib-video-overlay
Browse files Browse the repository at this point in the history
Added video thumbnail overlay in asset description
  • Loading branch information
akien-mga authored May 14, 2018
2 parents aba4999 + 0711d86 commit 8c71cbb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions editor/icons/icon_play_overlay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion editor/plugins/asset_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 8c71cbb

Please sign in to comment.