From fec5221a65e9fe762f9bcbd2fd46317dc647a4ad Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sat, 7 Apr 2012 16:59:06 +0000 Subject: [PATCH] Disabling color channels for float images in clip editor now works fine. --- source/blender/blenkernel/intern/tracking.c | 3 +++ source/blender/editors/space_clip/clip_draw.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 0af8f2cf625..7654c361d14 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1125,6 +1125,9 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab } } } + + if (ibuf->rect_float) + ibuf->userflags |= IB_RECT_INVALID; } static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 019b23c231b..bf8976035a8 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -216,6 +216,13 @@ static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar) ED_region_info_draw(ar, str, block, 0.6f); } +static void verify_buffer_float(ImBuf *ibuf) +{ + if (ibuf->rect_float && (ibuf->rect == NULL || (ibuf->userflags & IB_RECT_INVALID))) { + IMB_rect_from_float(ibuf); + } +} + static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, int width, int height, float zoomx, float zoomy) { @@ -233,9 +240,7 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glRectf(x, y, x + zoomx * width, y + zoomy * height); } else { - if (ibuf->rect_float && !ibuf->rect) { - IMB_rect_from_float(ibuf); - } + verify_buffer_float(ibuf); if (ibuf->rect) glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);