[Bf-blender-cvs] [491839b] master: Fix T42857: Inconsistency between cache line visibility and ability to change frame from image space

Sergey Sharybin noreply at git.blender.org
Tue Dec 9 16:34:36 CET 2014


Commit: 491839b3c8b1eb3a98ddce1ddf76e75176124557
Author: Sergey Sharybin
Date:   Tue Dec 9 20:33:19 2014 +0500
Branches: master
https://developer.blender.org/rB491839b3c8b1eb3a98ddce1ddf76e75176124557

Fix T42857: Inconsistency between cache line visibility and ability to change frame from image space

===================================================================

M	source/blender/editors/include/ED_image.h
M	source/blender/editors/mask/mask_ops.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/uvedit/uvedit_ops.c

===================================================================

diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index a9995de..1188ecd 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 93e59f3..929c4f7 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 f41e237..7c5aa34 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 50aee93..b8043d9 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 b58944e..23a5ac8 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);




More information about the Bf-blender-cvs mailing list