Slope rotation feature: Dupli rotation gets aligned to the ground
authorLukas Tönne <lukas.toenne@gmail.com>
Mon, 22 Dec 2014 12:32:08 +0000 (13:32 +0100)
committerLukas Tönne <lukas.toenne@gmail.com>
Mon, 22 Dec 2014 12:32:08 +0000 (13:32 +0100)
surface slope with a user-defined factor.

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

index b5b58f4..59752c5 100644 (file)
@@ -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
 
index 539b076..6057b60 100644 (file)
@@ -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",
index 9366cbf..0101b02 100644 (file)
@@ -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')