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

Nicholas Bishop nicholasbishop at gmail.com
Tue Jul 27 09:17:01 CEST 2010


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

Log Message:
-----------
== VPaint ==

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

Modified Paths:
--------------
    branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
    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 06:48:09 UTC (rev 30796)
+++ branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py	2010-07-27 07:17:01 UTC (rev 30797)
@@ -762,10 +762,9 @@
             row.prop(brush, "strength", text="Strength", slider=True)
             row.prop(brush, "use_strength_pressure", toggle=True, text="")
 
-            # XXX - TODO
-            #row = col.row(align=True)
-            #row.prop(brush, "jitter", slider=True)
-            #row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+            if brush.vertexpaint_tool == 'ALPHA':
+                row = col.row(align=True)
+                row.prop(brush, "direction", expand=True)
 
 
 class VIEW3D_PT_tools_brush_texture(PaintPanel):

Modified: branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-07-27 06:48:09 UTC (rev 30796)
+++ branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c	2010-07-27 07:17:01 UTC (rev 30797)
@@ -1682,9 +1682,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-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c	2010-07-27 06:48:09 UTC (rev 30796)
+++ branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_brush.c	2010-07-27 07:17:01 UTC (rev 30797)
@@ -71,8 +71,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", ICON_BRUSH_LIGHTEN, "Erase Alpha", "Use erase alpha blending mode while painting"},
-	{IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", ICON_BRUSH_LIGHTEN, "Add Alpha", "Use darken 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}};
 	
@@ -294,9 +293,10 @@
 		{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);
 
-	switch (me->sculpt_tool) {
+	if(rna_Brush_is_sculpt_brush(br, C)) {
+		switch (br->sculpt_tool) {
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_CREASE:
 		case SCULPT_TOOL_BLOB:
@@ -321,7 +321,14 @@
 
 		default:
 			return prop_default_items;
+		}
 	}
+	else if(rna_Brush_is_vpaint_brush(br, C)) {
+		if(br->vertexpaint_tool == IMB_BLEND_ADD_ALPHA)
+			return prop_direction_items;
+	}
+
+	return prop_default_items;
 }
 
 #else





More information about the Bf-blender-cvs mailing list