[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29424] branches/soc-2010-jwilkins: == Normal Weight for Snake Hook ==

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat Jun 12 14:16:16 CEST 2010


Revision: 29424
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29424
Author:   jwilkins
Date:     2010-06-12 14:16:15 +0200 (Sat, 12 Jun 2010)

Log Message:
-----------
== Normal Weight for Snake Hook ==

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.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-12 11:57:22 UTC (rev 29423)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-12 12:16:15 UTC (rev 29424)
@@ -572,7 +572,7 @@
                 row = col.row(align=True)
                 row.prop(brush, "autosmooth_factor", slider=True)
 
-            if brush.sculpt_tool in ('GRAB'):
+            if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
                 row = col.row(align=True)
                 row.prop(brush, "normal_weight", slider=True)
 

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-12 11:57:22 UTC (rev 29423)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-12 12:16:15 UTC (rev 29424)
@@ -1504,11 +1504,26 @@
 {
 	Brush *brush = paint_brush(&sd->paint);
 	float bstrength = ss->cache->bstrength;
-	float grab_delta[3];
+	float grab_delta[3], an[3];
 	int n;
+	float len;
 
+	if (brush->normal_weight > 0)
+		calc_area_normal(sd, ss, an, nodes, totnode);
+
 	copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry);
 
+	len = len_v3(grab_delta);
+
+	if (bstrength < 0)
+		negate_v3(grab_delta);
+
+	if (brush->normal_weight > 0) {
+		mul_v3_fl(an, len*brush->normal_weight);
+		mul_v3_fl(grab_delta, 1.0f - brush->normal_weight);
+		add_v3_v3(grab_delta, an);
+	}
+
 	for(n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;





More information about the Bf-blender-cvs mailing list