From 2ad8ec5eaf32b7c5d7291ff8c23541f84c30730c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 9 May 2013 14:57:20 +0000 Subject: Changes to footage information panel - Display additional information about channels and buffer type (float/byte). - Don't show frame number beyong sequence length. - Also fixed issues with footage length calculation, so it's pronbably will be needed to reload some of existing footages. --- source/blender/editors/space_clip/clip_buttons.c | 41 +++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/space_clip') diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index c8eb4157d65..8bf06e402e4 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -64,6 +64,9 @@ #include "WM_api.h" #include "WM_types.h" +#include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" + #include "clip_intern.h" /* own include */ /* Panels */ @@ -496,6 +499,8 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha uiLayout *col; char str[1024]; int width, height, framenr; + ImBuf *ibuf; + size_t ofs = 0; if (!ptr->data) return; @@ -519,14 +524,40 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha col = uiLayoutColumn(layout, FALSE); - /* Display frame dimensions. */ + ibuf = BKE_movieclip_get_ibuf_flag(clip, user, clip->flag, MOVIECLIP_CACHE_SKIP); + + /* Display frame dimensions, channels number and byffer type. */ BKE_movieclip_get_size(clip, user, &width, &height); - BLI_snprintf(str, sizeof(str), IFACE_("Size: %dx%d"), width, height); + ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Size %d x %d"), width, height); + + if (ibuf) { + if (ibuf->rect_float) { + if (ibuf->channels != 4) + ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_(", %d float channel(s)"), ibuf->channels); + else if (ibuf->planes == R_IMF_PLANES_RGBA) + ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGBA float"), sizeof(str) - ofs); + else + ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGB float"), sizeof(str) - ofs); + } + else { + if (ibuf->planes == R_IMF_PLANES_RGBA) + ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGBA byte"), sizeof(str) - ofs); + else + ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", RGB byte"), sizeof(str) - ofs); + } + } + else { + ofs += BLI_strncpy_rlen(str + ofs, IFACE_(", failed to load"), sizeof(str) - ofs); + } + uiItemL(col, str, ICON_NONE); /* Display current frame number. */ - framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr) + clip->frame_offset; - BLI_snprintf(str, sizeof(str), IFACE_("Frame: %d"), framenr); + framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr) ; + if (framenr <= clip->len) + BLI_snprintf(str, sizeof(str), IFACE_("Frame: %d / %d"), framenr, clip->len); + else + BLI_snprintf(str, sizeof(str), IFACE_("Frame: - / %d"), clip->len); uiItemL(col, str, ICON_NONE); /* Display current file name if it's a sequence clip. */ @@ -540,4 +571,6 @@ void uiTemplateMovieclipInformation(uiLayout *layout, PointerRNA *ptr, const cha BLI_snprintf(str, sizeof(str), IFACE_("File: %s"), file); uiItemL(col, str, ICON_NONE); } + + IMB_freeImBuf(ibuf); } -- cgit v1.2.3