diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 18:57:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-09 18:57:20 +0400 |
commit | 2ad8ec5eaf32b7c5d7291ff8c23541f84c30730c (patch) | |
tree | 11cd5ef70763f9ea6737ebc0feeefa0b5ee8cacd | |
parent | 602a7f77c6eead5b72a84207b02d111bf64df8cf (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_buttons.c | 41 |
2 files changed, 43 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index a83ee548054..d062f302379 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -299,7 +299,6 @@ static void movieclip_calc_length(MovieClip *clip) } } else if (clip->source == MCLIP_SRC_SEQUENCE) { - int framenr = 1; unsigned short numlen; char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX]; @@ -307,18 +306,17 @@ static void movieclip_calc_length(MovieClip *clip) if (numlen == 0) { /* there's no number group in file name, assume it's single framed sequence */ - clip->len = framenr + 1; + clip->len = 1; } else { + clip->len = 0; for (;;) { - get_sequence_fname(clip, framenr, name); + get_sequence_fname(clip, clip->len + clip->start_frame, name); - if (!BLI_exists(name)) { - clip->len = framenr; + if (BLI_exists(name)) + clip->len++; + else break; - } - - framenr++; } } } 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); } |