[Bf-extensions-cvs] [50818ba] master: Slope rotation feature: Dupli rotation gets aligned to the ground surface slope with a user-defined factor.

Lukas Tönne noreply at git.blender.org
Mon Dec 22 13:33:12 CET 2014


Commit: 50818bacafb949385027b6c13a3f63ed8302899e
Author: Lukas Tönne
Date:   Mon Dec 22 13:32:08 2014 +0100
Branches: master
https://developer.blender.org/rBAC50818bacafb949385027b6c13a3f63ed8302899e

Slope rotation feature: Dupli rotation gets aligned to the ground
surface slope with a user-defined factor.

===================================================================

M	object_physics_meadow/blob.py
M	object_physics_meadow/settings.py
M	object_physics_meadow/ui.py

===================================================================

diff --git a/object_physics_meadow/blob.py b/object_physics_meadow/blob.py
index b5b58f4..59752c5 100644
--- a/object_physics_meadow/blob.py
+++ b/object_physics_meadow/blob.py
@@ -333,7 +333,7 @@ def assign_sample_patches(groundob, blob, patches):
     return vgroup_samples
 
 def setup_blob_duplis(context, groundob, display_radius):
-    slope_factor = 0.0
+    slope_rotation = groundob.meadow.slope_rotation
 
     blobs = blobs_from_customprops(groundob.meadow)
 
@@ -365,7 +365,7 @@ def setup_blob_duplis(context, groundob, display_radius):
             def mesh_samples():
                 up = Vector((0,0,1))
                 for loc, nor in samples:
-                    mat = (slope_factor * up.rotation_difference(nor)).to_matrix()
+                    mat = (slope_rotation * up.rotation_difference(nor)).to_matrix()
                     mat.resize_4x4()
                     yield loc, mat
 
diff --git a/object_physics_meadow/settings.py b/object_physics_meadow/settings.py
index 539b076..6057b60 100644
--- a/object_physics_meadow/settings.py
+++ b/object_physics_meadow/settings.py
@@ -150,18 +150,29 @@ class MeadowObjectSettings(PropertyGroup):
         description="General random number seed value",
         default=12345
         )
+
     sampling_levels = IntProperty(
         name="Sampling Levels",
         description="Maximum number of sampling subdivision levels",
         default=4
         )
-    
+
     sample_distance = FloatProperty(
         name="Sample Distance",
         description="Minimum distance between samples to prevent overlap",
         default=1.0,
         min=0.01
         )
+
+    slope_rotation = FloatProperty(
+        name="Slope Rotation",
+        description="Influence of the slope on dupli rotation",
+        subtype='FACTOR',
+        default=0.0,
+        min=0.0,
+        max=1.0,
+        )
+
     max_samples = IntProperty(
         name="Maximum Samples",
         description="Maximum number of samples",
diff --git a/object_physics_meadow/ui.py b/object_physics_meadow/ui.py
index 9366cbf..0101b02 100644
--- a/object_physics_meadow/ui.py
+++ b/object_physics_meadow/ui.py
@@ -99,7 +99,10 @@ class OBJECT_PT_Meadow(Panel):
         
         col = layout.column()
         col.enabled = has_samples
-        col.operator("meadow.make_patches", icon='PARTICLE_PATH', text="Update Patches")
+
+        box = col.box()
+        box.prop(meadow, "slope_rotation")
+        box.operator("meadow.make_patches", icon='PARTICLE_PATH', text="Update Patches")
         
         row = col.row()
         row.operator("meadow.bake_physics", icon='MOD_PHYSICS')



More information about the Bf-extensions-cvs mailing list