[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30793] branches/soc-2010-nicolasbishop: = = Sculpt ==

Nicholas Bishop nicholasbishop at gmail.com
Tue Jul 27 07:53:29 CEST 2010


Revision: 30793
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30793
Author:   nicholasbishop
Date:     2010-07-27 07:53:28 +0200 (Tue, 27 Jul 2010)

Log Message:
-----------
== Sculpt ==

* Removed the mask brush, replaced with a BRUSH_MASK flag
* Added RNA/UI for that (UI is a checkbox in the brush panel)

TODO:
* For now, all brushes behave the same in mask mode; some brushes should have special behavior (e.g. smooth should smooth the mask)

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_brush_types.h
    branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.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-07-27 05:38:26 UTC (rev 30792)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py	2010-07-27 05:53:28 UTC (rev 30793)
@@ -684,8 +684,8 @@
 
                 col.prop(brush, "use_accumulate")
 
+            col.prop(brush, "mask")
 
-
             if brush.sculpt_tool == 'LAYER':
                 col.separator()
 

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-07-27 05:38:26 UTC (rev 30792)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c	2010-07-27 05:53:28 UTC (rev 30793)
@@ -480,7 +480,6 @@
 		case SCULPT_TOOL_CLAY_TUBES:
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_LAYER:
-		case SCULPT_TOOL_MASK:
 			return alpha * flip * pressure * overlap * feather;
 
 		case SCULPT_TOOL_CREASE:
@@ -2179,61 +2178,62 @@
 		}
 
 		/* Apply one type of brush action */
-		switch(brush->sculpt_tool){
-		case SCULPT_TOOL_DRAW:
-			do_draw_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SMOOTH:
-			do_smooth_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CREASE:
-			do_crease_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_BLOB:
-			do_crease_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_PINCH:
-			do_pinch_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_INFLATE:
-			do_inflate_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_GRAB:
-			do_grab_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_ROTATE:
-			do_rotate_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SNAKE_HOOK:
-			do_snake_hook_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_NUDGE:
-			do_nudge_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_THUMB:
-			do_thumb_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_LAYER:
-			do_layer_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_FLATTEN:
-			do_flatten_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CLAY:
-			do_clay_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CLAY_TUBES:
-			do_clay_tubes_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_FILL:
-			do_fill_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SCRAPE:
-			do_scrape_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_MASK:
+		if(brush->flag & BRUSH_MASK)
 			do_mask_brush(sd, ob, nodes, totnode);
-			break;
+		else {
+			switch(brush->sculpt_tool){
+			case SCULPT_TOOL_DRAW:
+				do_draw_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SMOOTH:
+				do_smooth_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CREASE:
+				do_crease_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_BLOB:
+				do_crease_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_PINCH:
+				do_pinch_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_INFLATE:
+				do_inflate_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_GRAB:
+				do_grab_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_ROTATE:
+				do_rotate_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SNAKE_HOOK:
+				do_snake_hook_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_NUDGE:
+				do_nudge_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_THUMB:
+				do_thumb_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_LAYER:
+				do_layer_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_FLATTEN:
+				do_flatten_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CLAY:
+				do_clay_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CLAY_TUBES:
+				do_clay_tubes_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_FILL:
+				do_fill_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SCRAPE:
+				do_scrape_brush(sd, ob, nodes, totnode);
+				break;
+			}
 		}
 
 		if (brush->sculpt_tool != SCULPT_TOOL_SMOOTH && brush->autosmooth_factor > 0) {

Modified: branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_brush_types.h	2010-07-27 05:38:26 UTC (rev 30792)
+++ branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_brush_types.h	2010-07-27 05:53:28 UTC (rev 30793)
@@ -125,6 +125,7 @@
 #define BRUSH_PLANE_TRIM (1<<26)
 #define BRUSH_FRONTFACE (1<<27)
 #define BRUSH_CUSTOM_ICON (1<<28)
+#define BRUSH_MASK (1<<29)
 
 /* Brush.sculpt_tool */
 typedef enum {
@@ -145,8 +146,7 @@
 	SCULPT_TOOL_WAX,        // XXX: reuse this slot later
 	SCULPT_TOOL_CREASE,
 	SCULPT_TOOL_BLOB,
-	SCULPT_TOOL_CLAY_TUBES,
-	SCULPT_TOOL_MASK
+	SCULPT_TOOL_CLAY_TUBES
 } SculptTool;
 
 /* Brush.vertexpaint_tool */

Modified: branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c	2010-07-27 05:38:26 UTC (rev 30792)
+++ branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c	2010-07-27 05:53:28 UTC (rev 30793)
@@ -54,7 +54,6 @@
 	{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
 	{SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
 	{SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
-	{SCULPT_TOOL_MASK, "MASK", 0, "Mask", ""},
 	{SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
 	{SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
 	{SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
@@ -687,6 +686,11 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ACCUMULATE);
 	RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke dabs on top of each other");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+	prop= RNA_def_property(srna, "mask", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_MASK);
+	RNA_def_property_ui_text(prop, "Mask", "Mark areas as protected from brush editing");
+	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
 	prop= RNA_def_property(srna, "use_space_atten", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);





More information about the Bf-blender-cvs mailing list