[Bf-blender-cvs] [2b5ed8c] soc-2013-paint: More guards and fixes for paint curve keymaps/transform for 2D editor

Antony Riakiotakis noreply at git.blender.org
Sat May 10 18:14:15 CEST 2014


Commit: 2b5ed8cacc94494939fb1fd34311ebbde68092f9
Author: Antony Riakiotakis
Date:   Sat May 10 19:14:04 2014 +0300
https://developer.blender.org/rB2b5ed8cacc94494939fb1fd34311ebbde68092f9

More guards and fixes for paint curve keymaps/transform for 2D editor

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

M	source/blender/editors/sculpt_paint/paint_curve.c
M	source/blender/editors/sculpt_paint/paint_image.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index d33cec2..5e2b2ee 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -25,6 +25,8 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
 
 #include "BKE_context.h"
 #include "BKE_main.h"
@@ -50,10 +52,21 @@
 int paintcurve_poll(bContext *C)
 {
 	Object *ob = CTX_data_active_object(C);
-	Paint *p = BKE_paint_get_active_from_context(C);
+	Paint *p;
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	SpaceImage *sima;
+
+	if (rv3d && !ob && (ob->mode & OB_MODE_ALL_PAINT))
+		return false;
+
+	sima = CTX_wm_space_image(C);
+
+	if (sima && sima->mode != SI_MODE_PAINT)
+		return false;
+
+	p = BKE_paint_get_active_from_context(C);
 
-	if (ob && (ob->mode & OB_MODE_ALL_PAINT) &&
-		p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
+	if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
 		return true;
 	}
 
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b6144fd..8a59092 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -996,9 +996,9 @@ int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
 
 	if (!rv3d) {
 		SpaceImage *sima = CTX_wm_space_image(C);
-		ARegion *ar = CTX_wm_region(C);
 
 		if (sima->mode == SI_MODE_PAINT) {
+			ARegion *ar = CTX_wm_region(C);
 			ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
 
 			return 1;




More information about the Bf-blender-cvs mailing list