[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29352] branches/soc-2010-nicolasbishop: * Added a button to invert the mask

Nicholas Bishop nicholasbishop at gmail.com
Wed Jun 9 02:34:20 CEST 2010


Revision: 29352
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29352
Author:   nicholasbishop
Date:     2010-06-09 02:34:20 +0200 (Wed, 09 Jun 2010)

Log Message:
-----------
* Added a button to invert the mask
* Renamed mask "Full" to "Fill"

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c

Modified: branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py	2010-06-08 22:59:26 UTC (rev 29351)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py	2010-06-09 00:34:20 UTC (rev 29352)
@@ -501,7 +501,8 @@
 
         row = layout.row(align=True)
         row.operator("paint.mask_set", text="Clear").mode = 'CLEAR'
-        row.operator("paint.mask_set", text="Full").mode = 'FULL'
+        row.operator("paint.mask_set", text="Fill").mode = 'FILL'
+        row.operator("paint.mask_set", text="Invert").mode = 'INVERT'
         row.operator("paint.mask_set", text="Random").mode = 'RANDOM'
 
 

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h	2010-06-08 22:59:26 UTC (rev 29351)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h	2010-06-09 00:34:20 UTC (rev 29352)
@@ -126,7 +126,8 @@
 /* For now this is just temporary stuff to test masking */
 typedef enum {
 	MASKING_CLEAR,
-	MASKING_FULL,
+	MASKING_FILL,
+	MASKING_INVERT,
 	MASKING_RANDOM,
 } MaskSetMode;
 void PAINT_OT_mask_set(struct wmOperatorType *ot);

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c	2010-06-08 22:59:26 UTC (rev 29351)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c	2010-06-09 00:34:20 UTC (rev 29352)
@@ -24,11 +24,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-static float get_mask_value(MaskSetMode mode)
+static void set_mask_value(MaskSetMode mode, float *m)
 {
-	return (mode == MASKING_CLEAR ? 1 :
-		mode == MASKING_FULL ? 0 :
-		mode == MASKING_RANDOM ? (float)rand() / RAND_MAX : 0);
+	*m = (mode == MASKING_CLEAR ? 1 :
+	      mode == MASKING_FILL ? 0 :
+	      mode == MASKING_INVERT ? (1 - *m) :
+	      mode == MASKING_RANDOM ? (float)rand() / RAND_MAX : 0);
 }
 
 static int paint_mask_set_exec(bContext *C, wmOperator *op)
@@ -63,7 +64,7 @@
 
 			BLI_pbvh_vertex_iter_begin(pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 				if(vd.mask)
-					*vd.mask = get_mask_value(mode);
+					set_mask_value(mode, vd.mask);
 			}
 			BLI_pbvh_vertex_iter_end;
 
@@ -93,7 +94,8 @@
 {
 	static EnumPropertyItem mask_items[] = {
 		{MASKING_CLEAR, "CLEAR", 0, "Clear", ""},
-		{MASKING_FULL, "FULL", 0, "Full", ""},
+		{MASKING_FILL, "FILL", 0, "Fill", ""},
+		{MASKING_INVERT, "INVERT", 0, "Invert", ""},
 		{MASKING_RANDOM, "RANDOM", 0, "Random", ""},
 		{0, NULL, 0, NULL, NULL}};
 





More information about the Bf-blender-cvs mailing list