[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36440] trunk/blender/source/blender/ editors/sculpt_paint/paint_image.c: enable face mask selection in texture paint mode again (worked in 2.4x).

Campbell Barton ideasman42 at gmail.com
Mon May 2 14:32:28 CEST 2011


Revision: 36440
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36440
Author:   campbellbarton
Date:     2011-05-02 12:32:28 +0000 (Mon, 02 May 2011)
Log Message:
-----------
enable face mask selection in texture paint mode again (worked in 2.4x).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2011-05-02 12:31:09 UTC (rev 36439)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2011-05-02 12:32:28 UTC (rev 36440)
@@ -5272,6 +5272,26 @@
 	return OPERATOR_RUNNING_MODAL;
 }
 
+/* same as image_paint_poll but fail when face mask mode is enabled */
+static int image_paint_sample_color_poll(bContext *C)
+{
+	if(image_paint_poll(C)) {
+		if(CTX_wm_view3d(C)) {
+			Object *obact = CTX_data_active_object(C);
+			if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+				Mesh *me= get_mesh(obact);
+				if(me) {
+					return !(me->editflag & ME_EDIT_PAINT_MASK);
+				}
+			}
+		}
+
+		return 1;
+	}
+
+	return 0;
+}
+
 void PAINT_OT_sample_color(wmOperatorType *ot)
 {
 	/* identifiers */
@@ -5282,7 +5302,7 @@
 	ot->exec= sample_color_exec;
 	ot->invoke= sample_color_invoke;
 	ot->modal= sample_color_modal;
-	ot->poll= image_paint_poll;
+	ot->poll= image_paint_sample_color_poll;
 
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;




More information about the Bf-blender-cvs mailing list