[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31058] branches/soc-2010-jwilkins: == Gravity Modifier ==
Jason Wilkins
Jason.A.Wilkins at gmail.com
Thu Aug 5 07:04:01 CEST 2010
Revision: 31058
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31058
Author: jwilkins
Date: 2010-08-05 07:04:00 +0200 (Thu, 05 Aug 2010)
Log Message:
-----------
== Gravity Modifier ==
Any tool can have gravity applied as a modifier. It works similarly to autosmooth.
Modified Paths:
--------------
branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.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-08-05 03:28:32 UTC (rev 31057)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-08-05 05:04:00 UTC (rev 31058)
@@ -598,6 +598,14 @@
+ if brush.sculpt_tool not in ('GRAVITY'):
+ col.separator()
+
+ row = col.row(align=True)
+ row.prop(brush, "gravity_factor", slider=True)
+
+
+
if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
col.separator()
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-08-05 03:28:32 UTC (rev 31057)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-08-05 05:04:00 UTC (rev 31058)
@@ -1412,16 +1412,15 @@
}
}
-static void do_gravity_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
+static void gravity(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode, float bstrength)
{
Brush *brush = paint_brush(&sd->paint);
float offset[3], an[3];
- float bstrength= ss->cache->bstrength;
int n;
float gravity[3];
gravity[0]= gravity[1]= 0;
- gravity[2]= -ss->cache->radius / 2;
+ gravity[2]= -ss->cache->radius;
calc_sculpt_normal(sd, ss, an, nodes, totnode, brush->sculpt_plane_range);
@@ -1466,6 +1465,11 @@
}
}
+static void do_gravity_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
+{
+ gravity(sd, ss, nodes, totnode, ss->cache->bstrength);
+}
+
static void do_crease_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
{
Brush *brush = paint_brush(&sd->paint);
@@ -2788,6 +2792,9 @@
}
}
+ if (brush->sculpt_tool != SCULPT_TOOL_GRAVITY && brush->gravity_factor > 0)
+ gravity(sd, ss, nodes, totnode, brush->gravity_factor);
+
/* copy the modified vertices from mesh to the active key */
if(ss->kb)
mesh_to_key(ss->ob->data, ss->kb);
Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-08-05 03:28:32 UTC (rev 31057)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-08-05 05:04:00 UTC (rev 31058)
@@ -77,7 +77,7 @@
float plane_offset; /* offset for plane brushes (clay, flatten, fill, scrape) */
- float frontface_angle, pad2;
+ float frontface_angle;
char sculpt_tool; /* active sculpt tool */
char vertexpaint_tool; /* active vertex/weight paint tool/blend mode */
@@ -88,6 +88,8 @@
float crease_pinch_factor;
+ float gravity_factor;
+
float plane_trim;
float texture_sample_bias;
Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c 2010-08-05 03:28:32 UTC (rev 31057)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c 2010-08-05 05:04:00 UTC (rev 31058)
@@ -605,6 +605,14 @@
RNA_def_property_ui_text(prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gravity_factor");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+ RNA_def_property_ui_text(prop, "Gravity", "Amount of gravity to apply to each stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop= RNA_def_property(srna, "sculpt_plane_range", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "sculpt_plane_range");
RNA_def_property_range(prop, 0, 10);
More information about the Bf-blender-cvs
mailing list