[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60155] trunk/blender: Undo the front-facing only commit for clay strips brushes, it adds an

Antony Riakiotakis kalast at gmail.com
Mon Sep 16 04:24:42 CEST 2013


Revision: 60155
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60155
Author:   psy-fi
Date:     2013-09-16 02:24:41 +0000 (Mon, 16 Sep 2013)
Log Message:
-----------
Undo the front-facing only commit for clay strips brushes, it adds an
attenuation that should really be optional. There's also a minor
performance penalty and all this only for one problematic case. In case
the tool flattens two surfaces, users can manually set the front face
only option. A better non-attenuating way to cull such vertices can be
added later.

Also flatten brush should calculate the flatten plane from the original
vertices or the flattening will not converge for planes offsets
different than zero.

Reported by Michalis Zissiou, thanks!

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/BKE_brush.h
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-09-16 01:35:52 UTC (rev 60154)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-09-16 02:24:41 UTC (rev 60155)
@@ -642,10 +642,9 @@
                 row.prop(brush, "height", slider=True, text="Height")
 
             # use_frontface
-            if capabilities.has_frontface:
-                col.separator()
-                row = col.row()
-                row.prop(brush, "use_frontface", text="Front Faces Only")
+            col.separator()
+            row = col.row()
+            row.prop(brush, "use_frontface", text="Front Faces Only")
 
             # direction
             col.separator()

Modified: trunk/blender/source/blender/blenkernel/BKE_brush.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-09-16 01:35:52 UTC (rev 60154)
+++ trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-09-16 02:24:41 UTC (rev 60155)
@@ -111,8 +111,5 @@
 /* debugging only */
 void BKE_brush_debug_print_state(struct Brush *br);
 
-/* sculpt */
-bool BKE_sculpt_brush_frontface_only(struct Brush *);
-
 #endif
 

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-09-16 01:35:52 UTC (rev 60154)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-09-16 02:24:41 UTC (rev 60155)
@@ -1048,8 +1048,3 @@
 
 	return im;
 }
-
-bool BKE_sculpt_brush_frontface_only(struct Brush *br)
-{
-	return br->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS;
-}

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-09-16 01:35:52 UTC (rev 60154)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-09-16 02:24:41 UTC (rev 60155)
@@ -318,8 +318,6 @@
 	float plane_trim_squared;
 
 	rcti previous_r; /* previous redraw rectangle */
-
-	bool frontface; /* use front face */
 } StrokeCache;
 
 /************** Access to original unmodified vertex data *************/
@@ -671,10 +669,10 @@
 	}
 }
 
-static float frontface(bool ff, const float sculpt_normal[3],
+static float frontface(Brush *br, const float sculpt_normal[3],
                        const short no[3], const float fno[3])
 {
-	if (ff) {
+	if (br->flag & BRUSH_FRONTFACE) {
 		float dot;
 
 		if (no) {
@@ -1011,7 +1009,7 @@
 	/* Falloff curve */
 	avg *= BKE_brush_curve_strength(br, len, cache->radius);
 
-	avg *= frontface(cache->frontface, sculpt_normal, vno, fno);
+	avg *= frontface(br, sculpt_normal, vno, fno);
 
 	/* Paint mask */
 	avg *= 1.0f - mask;
@@ -1289,13 +1287,13 @@
 
 /* Test whether the StrokeCache.sculpt_normal needs update in
  * do_brush_action() */
-static int brush_needs_sculpt_normal(const Brush *brush, SculptSession *ss)
+static int brush_needs_sculpt_normal(const Brush *brush)
 {
 	return ((ELEM(brush->sculpt_tool,
 	              SCULPT_TOOL_GRAB,
 	              SCULPT_TOOL_SNAKE_HOOK) &&
 	         ((brush->normal_weight > 0) ||
-	          ss->cache->frontface)) ||
+	          (brush->flag & BRUSH_FRONTFACE))) ||
 
 	        ELEM7(brush->sculpt_tool,
 	              SCULPT_TOOL_BLOB,
@@ -3139,7 +3137,7 @@
 			BKE_pbvh_node_mark_update(nodes[n]);
 		}
 
-		if (brush_needs_sculpt_normal(brush, ss))
+		if (brush_needs_sculpt_normal(brush))
 			update_sculpt_normal(sd, ob, nodes, totnode);
 
 		if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA)
@@ -3905,10 +3903,10 @@
 		cache->original = 1;
 	}
 
-	if (ELEM8(brush->sculpt_tool,
+	if (ELEM9(brush->sculpt_tool,
 	          SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
 	          SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
-	          SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE))
+	          SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE, SCULPT_TOOL_FLATTEN))
 	{
 		if (!(brush->flag & BRUSH_ACCUMULATE)) {
 			cache->original = 1;
@@ -3922,9 +3920,6 @@
 	cache->previous_vertex_rotation = 0;
 	cache->init_dir_set = false;
 
-	cache->frontface = ((brush->flag & BRUSH_FRONTFACE) != 0) ||
-	                     BKE_sculpt_brush_frontface_only(brush);
-
 	sculpt_omp_start(sd, ss);
 }
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_brush.c	2013-09-16 01:35:52 UTC (rev 60154)
+++ trunk/blender/source/blender/makesrna/intern/rna_brush.c	2013-09-16 02:24:41 UTC (rev 60155)
@@ -237,12 +237,6 @@
 	return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
 }
 
-static int rna_SculptToolCapabilities_has_frontface_get(PointerRNA *ptr)
-{
-	Brush *br = (Brush *)ptr->data;
-	return !BKE_sculpt_brush_frontface_only(br);
-}
-
 static int rna_BrushCapabilities_has_texture_angle_get(PointerRNA *ptr)
 {
 	Brush *br = (Brush *)ptr->data;
@@ -562,7 +556,6 @@
 	SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
 	SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
 	SCULPT_TOOL_CAPABILITY(has_strength, "Has Strength");
-	SCULPT_TOOL_CAPABILITY(has_frontface, "Has Front Facing");
 
 #undef SCULPT_CAPABILITY
 }




More information about the Bf-blender-cvs mailing list