[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37420] branches/soc-2011-onion: Revision: 30797

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat Jun 11 22:39:12 CEST 2011


Revision: 37420
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37420
Author:   jwilkins
Date:     2011-06-11 20:39:11 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Revision: 30797
Author: nicholasbishop
Date: 2:17:01 AM, Tuesday, July 27, 2010
Message:
== VPaint ==

* Merged the two alpha brushes into one, added RNA/UI for switching between adding and erasing alpha

**jwilkins:
**I also made the color selector disappear when alpha tool is selected
**several other vertex tools can be combined like this
**some noise in this because I added XXX to some comments

Modified Paths:
--------------
    branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2011-onion/source/blender/blenkernel/intern/brush.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h
    branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c

Property Changed:
----------------
    branches/soc-2011-onion/


Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793
/trunk/blender:36833-37386
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797
/trunk/blender:36833-37386

Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-06-11 20:39:11 UTC (rev 37420)
@@ -688,9 +688,11 @@
         # Vertex Paint Mode #
         elif context.vertex_paint_object and brush:
             col = layout.column()
-            col.template_color_wheel(brush, "color", value_slider=True)
-            col.prop(brush, "color", text="")
 
+            if brush.vertex_tool != 'ALPHA':
+                col.template_color_wheel(brush, "color", value_slider=True)
+                col.prop(brush, "color", text="")
+
             row = col.row(align=True)
             row.prop(brush, "size", slider=True)
             row.prop(brush, "use_pressure_size", toggle=True, text="")
@@ -699,6 +701,10 @@
             row.prop(brush, "strength", text="Strength", slider=True)
             row.prop(brush, "use_pressure_strength", toggle=True, text="")
 
+            if brush.vertex_tool == 'ALPHA':
+                row = col.row(align=True)
+                row.prop(brush, "direction", expand=True)
+
             # XXX - TODO
             #row = col.row(align=True)
             #row.prop(brush, "jitter", slider=True)

Modified: branches/soc-2011-onion/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenkernel/intern/brush.c	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/source/blender/blenkernel/intern/brush.c	2011-06-11 20:39:11 UTC (rev 37420)
@@ -366,7 +366,7 @@
 		br->sub_col[0] = 0.25;
 		br->sub_col[1] = 1;
 		break;
-	/*case SCULPT_TOOL_MASK: temporarily removed (maybe)
+	/*case SCULPT_TOOL_MASK: XXX: temporarily removed (maybe)
 		br->flag |= BRUSH_FRONTFACE;
 		br->add_col[0] = 0.750000;
 		br->add_col[1] = 0.750000;

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c	2011-06-11 20:39:11 UTC (rev 37420)
@@ -1661,9 +1661,12 @@
 
 static void vpaint_blend(Brush *brush, float col[4], float alpha)
 {
-	if(brush->vertexpaint_tool != VERTEX_PAINT_BLUR) {
-		IMB_blend_color_float(col, col, brush->rgb, alpha,
-				      brush->vertexpaint_tool);
+	int tool = brush->vertexpaint_tool;
+	if(tool != VERTEX_PAINT_BLUR) {
+		if(tool == IMB_BLEND_ADD_ALPHA &&
+		   (brush->flag & BRUSH_DIR_IN))
+			tool = IMB_BLEND_ERASE_ALPHA;
+		IMB_blend_color_float(col, col, brush->rgb, alpha, tool);
 	}
 }
 

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/sculpt.c	2011-06-11 20:39:11 UTC (rev 37420)
@@ -582,7 +582,7 @@
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_GRAVITY:
 		case SCULPT_TOOL_LAYER:
-		/*case SCULPT_TOOL_MASK: temporarily removed (maybe) */
+		/*case SCULPT_TOOL_MASK: XXX: temporarily removed (maybe) */
 			return alpha * flip * pressure * overlap * feather;
 
 		case SCULPT_TOOL_CREASE:
@@ -3280,7 +3280,7 @@
 		return "Fill Brush";
 	case SCULPT_TOOL_SCRAPE:
 		return "Scrape Brush";
-	/*case SCULPT_TOOL_MASK: temporarily removed (maybe)
+	/*case SCULPT_TOOL_MASK: XXX: temporarily removed (maybe)
 		return "Mask Brush"; */
 	default:
 		return "Sculpting";

Modified: branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h	2011-06-11 20:39:11 UTC (rev 37420)
@@ -169,7 +169,7 @@
 	SCULPT_TOOL_BLOB        = 17,
 	SCULPT_TOOL_CLAY_STRIPS = 18,
 	SCULPT_TOOL_GRAVITY     = 19,
-	/*SCULPT_TOOL_MASK        = 20, temporarily removed (maybe) */
+	/*SCULPT_TOOL_MASK        = 20, XXX: temporarily removed (maybe) */
 } SculptTool;
 
 /* Brush.vertexpaint_tool */

Modified: branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c	2011-06-11 19:45:09 UTC (rev 37419)
+++ branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c	2011-06-11 20:39:11 UTC (rev 37420)
@@ -75,7 +75,7 @@
 	{SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
 	{SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
 	{SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
-	/*{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_SUBTRACT, "Mask", ""}, temporarily removed */
+	/*{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_SUBTRACT, "Mask", ""}, XXX: temporarily removed */
 	{0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem brush_vertex_tool_items[] = {
@@ -85,8 +85,7 @@
 	{IMB_BLEND_MUL, "MUL", ICON_BRUSH_MULTIPLY, "Multiply", "Use multiply blending mode while painting"},
 	{IMB_BLEND_LIGHTEN, "LIGHTEN", ICON_BRUSH_LIGHTEN, "Lighten", "Use lighten blending mode while painting"},
 	{IMB_BLEND_DARKEN, "DARKEN", ICON_BRUSH_DARKEN, "Darken", "Use darken blending mode while painting"},
-	{IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Use erase alpha blending mode while painting"},
-	{IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Use add alpha blending mode while painting"},
+	{IMB_BLEND_ADD_ALPHA, "ALPHA", ICON_BRUSH_LIGHTEN /* TODO */, "Alpha", "Add or remove alpha from the active layer"},
 	{VERTEX_PAINT_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", "Blur the color with surrounding values"},
 	{0, NULL, 0, NULL, NULL}};
 
@@ -274,7 +273,7 @@
 	return brush_alpha(me);
 }
 
-static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
 	static EnumPropertyItem prop_default_items[]= {
 		{0, NULL, 0, NULL, NULL}};
@@ -304,15 +303,17 @@
 		{BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	Brush *me= (Brush*)(ptr->data);
+	Brush *br= (Brush*)(ptr->data);
+	ToolSettings *ts= CTX_data_tool_settings(C);
 
-	switch (me->sculpt_tool) {
+	if (ts->sculpt) {
+		switch (br->sculpt_tool) {
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_CREASE:
 		case SCULPT_TOOL_BLOB:
 		case SCULPT_TOOL_LAYER:
 		case SCULPT_TOOL_CLAY:
-		/*case SCULPT_TOOL_MASK: temporarily removed (maybe) */
+		/*case SCULPT_TOOL_MASK: XXX: temporarily removed (maybe) */
 			return prop_direction_items;
 
 		case SCULPT_TOOL_FLATTEN:
@@ -332,7 +333,14 @@
 
 		default:
 			return prop_default_items;
+		}
 	}
+	else if(ts->vpaint) {
+		if(br->vertexpaint_tool == IMB_BLEND_ADD_ALPHA)
+			return prop_direction_items;
+	}
+
+	return prop_default_items;
 }
 
 static EnumPropertyItem *rna_Brush_texture_angle_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))




More information about the Bf-blender-cvs mailing list