[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29756] branches/soc-2010-jwilkins: This makes some of the UI changes recommended by brecht.

Tom Musgrove LetterRip at gmail.com
Mon Jun 28 02:57:27 CEST 2010


Revision: 29756
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29756
Author:   letterrip
Date:     2010-06-28 02:57:27 +0200 (Mon, 28 Jun 2010)

Log Message:
-----------
This makes some of the UI changes recommended by brecht.  It also has a WIP version of a crease brush - for crease you need a really sharp falloff.  Also my math of combining the two is probably wrong :)

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c
    branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
    branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c

Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-28 00:57:27 UTC (rev 29756)
@@ -548,17 +548,17 @@
             col.separator()
 
             row = col.row(align=True)
-            row.prop(brush, "lock_brush_size", text="Use Blender Units")
+            row.prop(brush, "lock_brush_size", text="Use BUnits")
 
-            row = col.row(align=True)
+            #row = col.row(align=True)
             if brush.lock_brush_size:
                 if bpy.context.user_preferences.edit.use_unified_radius_and_strength:
-                    row.prop(bpy.context.user_preferences.edit, "sculpt_paint_bu_radius", text ="Units", slider=True)
+                    row.prop(bpy.context.user_preferences.edit, "sculpt_paint_bu_radius", text ="Radius", slider=True)
                 else:
                     row.prop(brush, "unprojected_radius", text="Units", slider=True)
             else:
                 if bpy.context.user_preferences.edit.use_unified_radius_and_strength:
-                    row.prop(bpy.context.user_preferences.edit, "sculpt_paint_pixel_radius", text="Pixels", slider=True)
+                    row.prop(bpy.context.user_preferences.edit, "sculpt_paint_pixel_radius", text="Radius", slider=True)
                 else:
                     row.prop(brush, "size", text="Pixels", slider=True)
 
@@ -582,7 +582,7 @@
                     row = col.row(align=True)
                     row.prop(brush, "strength", slider=True)
                 row.prop(brush, "use_strength_pressure", text="")
-                col.prop(brush, "strength_multiplier", slider=True)
+                #col.prop(brush, "strength_multiplier", slider=True)
 
                 # XXX - TODO
                 #row = col.row(align=True)
@@ -602,7 +602,7 @@
                 row.prop(brush, "plane_offset", slider=True)
                 row.prop(brush, "use_offset_pressure", text="")
 
-            if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'FILL', 'SCRAPE', 'CLAY', 'WAX', 'GRAB'):
+            if brush.sculpt_tool in ('DRAW', 'PINCH', 'CREASE', 'INFLATE', 'LAYER', 'FILL', 'SCRAPE', 'CLAY', 'WAX', 'GRAB'):
                 col.row().prop(brush, "direction", expand=True)
 
             if brush.sculpt_tool in ('DRAW', 'INFLATE', 'LAYER', 'CLAY', 'WAX'):
@@ -621,7 +621,6 @@
                     col.prop(brush, "use_persistent")
                     col.operator("sculpt.set_persistent_base")
                         
-            col.prop(brush,"use_dynamic_subdiv")
             if brush.use_dynamic_subdiv ==True:
                 col.prop(brush,"detail",slider=True)
                 col.prop(brush,"smoothness",slider=True)
@@ -861,6 +860,7 @@
         brush = settings.brush
 
         col = layout.column()
+        col.prop(brush,"use_dynamic_subdiv")
         col.prop(sculpt, "show_brush")
         if sculpt.show_brush:
             col.prop(sculpt, "show_brush_on_surface")
@@ -868,7 +868,7 @@
         col.prop(sculpt, "use_openmp")
 
         col.separator()
-        if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'WAX', 'PINCH', 'FLATTEN'):
+        if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'WAX', 'PINCH', 'CREASE', 'FLATTEN'):
             sub = col.column()
             sub.label(text="Color:")
             sub.prop(brush, "add_col", text="Add")

Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-06-28 00:57:27 UTC (rev 29756)
@@ -99,6 +99,7 @@
 	brush->smoothness = 0.25f;
 
 	/* BRUSH TEXTURE SETTINGS */
+	brush->preview = NULL;
 	brush->texture_offset = 0.0f; /* this determines where in the texture the midpoint of the brush is */
 	brush->texture_center_x = 0; /* center offset for textures used on brush or as stencils */
 	brush->texture_center_y = 0;

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-28 00:57:27 UTC (rev 29756)
@@ -547,6 +547,7 @@
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_INFLATE:
 		case SCULPT_TOOL_WAX:
+		case SCULPT_TOOL_CREASE:
 			return alpha * 3.0f * dir * invert * pen_flip * pressure * overlap;
 			
 		case SCULPT_TOOL_LAYER:
@@ -1186,6 +1187,50 @@
 	}
 }
 
+static void do_crease_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
+{
+	Brush *brush = paint_brush(&sd->paint);
+	float offset[3], area_normal[3];
+	float bstrength= ss->cache->bstrength;
+	int n;
+	
+	calc_area_normal(sd, ss, area_normal, nodes, totnode);
+	
+	/* offset with as much as possible factored in already */
+	mul_v3_v3fl(offset, area_normal, ss->cache->radius);
+	mul_v3_v3(offset, ss->cache->scale);
+	mul_v3_fl(offset, bstrength);
+	
+	/* threaded loop over nodes */
+#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
+	for(n=0; n<totnode; n++) {
+		PBVHVertexIter vd;
+		SculptBrushTest test;
+		
+		sculpt_brush_test_init(ss, &test);
+		
+		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+			if(sculpt_brush_test(&test, vd.co)) {
+				/* offset vertex */
+				float fade = tex_strength(ss, brush, vd.co, test.dist);
+				float val[3];
+				
+				sub_v3_v3v3(val, test.location, vd.co);
+				mul_v3_v3fl(val, offset, fade);
+				symmetry_feather(sd, ss, vd.co, val);
+				add_v3_v3(val, vd.co);
+				
+				sculpt_clip(sd, ss, vd.co, val);
+				if(vd.mvert) {
+					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+					if(brush->flag & BRUSH_SUBDIV) vd.mvert->flag = 1; 
+				}
+			}
+		}
+		BLI_pbvh_vertex_iter_end;
+	}
+}
+
 static void do_pinch_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
 {
 	Brush *brush = paint_brush(&sd->paint);
@@ -2157,6 +2202,9 @@
 		case SCULPT_TOOL_SMOOTH:
 			do_smooth_brush(sd, ss, nodes, totnode);
 			break;
+		case SCULPT_TOOL_CREASE:
+			do_crease_brush(sd, ss, nodes, totnode);
+			break;
 		case SCULPT_TOOL_PINCH:
 			do_pinch_brush(sd, ss, nodes, totnode);
 			break;
@@ -2378,6 +2426,8 @@
 		return "Draw Brush"; break;
 	case SCULPT_TOOL_SMOOTH:
 		return "Smooth Brush"; break;
+	case SCULPT_TOOL_CREASE:
+		return "Crease Brush"; break;
 	case SCULPT_TOOL_PINCH:
 		return "Pinch Brush"; break;
 	case SCULPT_TOOL_INFLATE:
@@ -2588,7 +2638,7 @@
 		cache->original = 1;
 	}
 
-	if(ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_WAX))
+	if(ELEM6(brush->sculpt_tool, SCULPT_TOOL_DRAW,  SCULPT_TOOL_CREASE, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_WAX))
 		if(!(brush->flag & BRUSH_ACCUMULATE))
 			cache->original = 1;
 

Modified: branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/source/blender/imbuf/intern/cineon/cineonlib.c	2010-06-28 00:57:27 UTC (rev 29756)
@@ -31,7 +31,7 @@
 #include <winsock.h>
 #else
 #include <netinet/in.h>	 /* htonl() */
-/* #include <arpa/inet.h> */ /* htonl() on OS X */
+/* #include <arpa/inet.h> *//* htonl() on OS X */
 
 #endif
 #include <string.h>			 /* memset */

Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-06-28 00:57:27 UTC (rev 29756)
@@ -166,6 +166,7 @@
 #define SCULPT_TOOL_SNAKE_HOOK 13
 #define SCULPT_TOOL_ROTATE     14
 #define SCULPT_TOOL_WAX        15
+#define SCULPT_TOOL_CREASE     16
 
 /* ImagePaintSettings.tool */
 #define PAINT_TOOL_DRAW		0

Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-06-28 00:11:28 UTC (rev 29755)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-06-28 00:57:27 UTC (rev 29756)
@@ -113,6 +113,7 @@
 	static EnumPropertyItem brush_sculpt_tool_items[] = {
 		{SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
 		{SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
+		{SCULPT_TOOL_CREASE, "CREASE", 0, "Crease", ""},
 		{SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""},
 		{SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""},
 		{SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""},





More information about the Bf-blender-cvs mailing list