From 491839b3c8b1eb3a98ddce1ddf76e75176124557 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 9 Dec 2014 20:33:19 +0500 Subject: [PATCH] Fix T42857: Inconsistency between cache line visibility and ability to change frame from image space --- source/blender/editors/include/ED_image.h | 2 ++ source/blender/editors/mask/mask_ops.c | 4 ++-- source/blender/editors/space_image/image_draw.c | 15 ++++++++++----- source/blender/editors/space_image/image_ops.c | 7 +++++-- source/blender/editors/uvedit/uvedit_ops.c | 9 +++++++++ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index a9995de068e..1188ecd0aa5 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -79,5 +79,7 @@ int ED_space_image_maskedit_mask_poll(struct bContext *C); void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf); +bool ED_space_image_show_cache(struct SpaceImage *sima); + #endif /* __ED_IMAGE_H__ */ diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 93e59f3244e..929c4f74b2f 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -784,7 +784,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, const wmEvent *event) SlidePointData *slidedata; if (mask == NULL) { - return OPERATOR_CANCELLED; + return OPERATOR_PASS_THROUGH; } slidedata = slide_point_customdata(C, op, event); @@ -1286,7 +1286,7 @@ static int slide_spline_curvature_invoke(bContext *C, wmOperator *op, const wmEv SlideSplineCurvatureData *slide_data; if (mask == NULL) { - return OPERATOR_CANCELLED; + return OPERATOR_PASS_THROUGH; } /* Be sure we don't conflict with point slide here. */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f41e237beb4..7c5aa349fa0 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -854,8 +854,13 @@ void draw_image_main(const bContext *C, ARegion *ar) draw_render_info(sima->iuser.scene, ima, ar, zoomx, zoomy); } -static bool show_image_cache(Image *image, Mask *mask) +bool ED_space_image_show_cache(SpaceImage *sima) { + Image *image = ED_space_image(sima); + Mask *mask = NULL; + if (sima->mode == SI_MODE_MASK) { + mask = ED_space_image_get_mask(sima); + } if (image == NULL && mask == NULL) { return false; } @@ -873,12 +878,12 @@ void draw_image_cache(const bContext *C, ARegion *ar) float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1); Mask *mask = NULL; - if (sima->mode == SI_MODE_MASK) { - mask = ED_space_image_get_mask(sima); + if (!ED_space_image_show_cache(sima)) { + return; } - if (!show_image_cache(image, mask)) { - return; + if (sima->mode == SI_MODE_MASK) { + mask = ED_space_image_get_mask(sima); } glEnable(GL_BLEND); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 50aee934841..b8043d9f0de 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2582,8 +2582,9 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event ImageSampleInfo *info; if (ar->regiontype == RGN_TYPE_WINDOW) { - if (event->mval[1] <= 16) + if (event->mval[1] <= 16 && ED_space_image_show_cache(sima)) { return OPERATOR_PASS_THROUGH; + } } if (!ED_space_image_has_buffer(sima)) @@ -3017,8 +3018,10 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event ARegion *ar = CTX_wm_region(C); if (ar->regiontype == RGN_TYPE_WINDOW) { - if (event->mval[1] > 16) + SpaceImage *sima = CTX_wm_space_image(C); + if (event->mval[1] > 16 || !ED_space_image_show_cache(sima)) { return OPERATOR_PASS_THROUGH; + } } RNA_int_set(op->ptr, "frame", frame_from_event(C, event)); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index b58944e4003..23a5ac80dfb 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3877,6 +3877,15 @@ static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e ARegion *ar = CTX_wm_region(C); float location[2]; + if (ar->regiontype == RGN_TYPE_WINDOW) { + if (event->mval[1] <= 16) { + SpaceImage *sima = CTX_wm_space_image(C); + if (sima && ED_space_image_show_cache(sima)) { + return OPERATOR_PASS_THROUGH; + } + } + } + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]); RNA_float_set_array(op->ptr, "location", location);