[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30125] branches/soc-2010-jwilkins: == random rotation ==

Jason Wilkins Jason.A.Wilkins at gmail.com
Thu Jul 8 19:17:20 CEST 2010


Revision: 30125
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30125
Author:   jwilkins
Date:     2010-07-08 19:17:20 +0200 (Thu, 08 Jul 2010)

Log Message:
-----------
== random rotation ==
*enabling random rotation gives each dab a random amount of rotation
* known problem: the overlay texture doesn't randomly reorient as well

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-07-08 17:00:06 UTC (rev 30124)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-07-08 17:17:20 UTC (rev 30125)
@@ -800,6 +800,10 @@
             col.prop(tex_slot, "angle", text="")
             col.active = tex_slot.map_mode in ('FIXED', 'TILED')
 
+            col = layout.column()
+            col.prop(brush, "use_random_rotation")
+            col.active = (not brush.use_anchor) and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED') and (not brush.restore_mesh)
+
             split = layout.split()
 
             col = split.column()

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-08 17:00:06 UTC (rev 30124)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-08 17:17:20 UTC (rev 30125)
@@ -39,6 +39,7 @@
 #include "BLI_pbvh.h"
 #include "BLI_threads.h"
 #include "BLI_editVert.h"
+#include "BLI_rand.h"
 
 #include "DNA_key_types.h"
 #include "DNA_mesh_types.h"
@@ -2846,8 +2847,15 @@
 	else
 		cache->radius= cache->initial_radius;
 
-	if(!(brush->flag & BRUSH_ANCHORED || ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
+	if(!(brush->flag & BRUSH_ANCHORED || ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
 		copy_v2_v2(cache->tex_mouse, cache->mouse);
+
+		if  (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED && 
+			 !(brush->flag & BRUSH_RESTORE_MESH) && 
+			 brush->flag & BRUSH_RANDOM_ROTATION)
+		{
+			cache->special_rotation = 2*M_PI*BLI_frand();
+		}
 	}
 
 	if(brush->flag & BRUSH_ANCHORED) {

Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-07-08 17:00:06 UTC (rev 30124)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-07-08 17:17:20 UTC (rev 30125)
@@ -135,6 +135,7 @@
 #define BRUSH_EDGE_TO_EDGE	(1<<22)
 #define BRUSH_RESTORE_MESH	(1<<23)
 #define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24)
+#define BRUSH_RANDOM_ROTATION (1<<25)
 
 /* Brush.sculpt_tool */
 #define SCULPT_TOOL_DRAW        1

Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-07-08 17:00:06 UTC (rev 30124)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-07-08 17:17:20 UTC (rev 30125)
@@ -434,6 +434,11 @@
 	RNA_def_property_ui_text(prop, "Rake", "Rotate the brush texture to match the stroke direction");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+	prop= RNA_def_property(srna, "use_random_rotation", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RANDOM_ROTATION);
+	RNA_def_property_ui_text(prop, "Random Rotation", "Rotate the brush texture at random");
+	RNA_def_property_update(prop, 0, "rna_Brush_update");
+
 	prop= RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
 	RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location");





More information about the Bf-blender-cvs mailing list