[Bf-extensions-cvs] [3d1920c] master: Renamed the patch_radius and max_patches settings to sample_distance and max_samples respectively, which is more intuitive.

Lukas Tönne noreply at git.blender.org
Sat Dec 20 13:31:15 CET 2014


Commit: 3d1920c8d6c584e6aca64aea7fc488964bfede92
Author: Lukas Tönne
Date:   Sat Dec 20 13:30:28 2014 +0100
Branches: master
https://developer.blender.org/rBAC3d1920c8d6c584e6aca64aea7fc488964bfede92

Renamed the patch_radius and max_patches settings to sample_distance and
max_samples respectively, which is more intuitive.

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

M	object_physics_meadow/blob.py
M	object_physics_meadow/meadow.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 937ff78..b5b58f4 100644
--- a/object_physics_meadow/blob.py
+++ b/object_physics_meadow/blob.py
@@ -371,9 +371,7 @@ def setup_blob_duplis(context, groundob, display_radius):
 
             if ob.meadow.use_as_dupli:
                 # make a duplicator for the patch object
-                # XXX use a tiny radius here to hide them in the viewport as much as possible
-                # this is not ideal, but we can't easily separate duplicator visibility and dupli visibility
-                dob = make_blob_object(context, blob_index, blob.loc, mesh_samples(), 0.0001)
+                dob = make_blob_object(context, blob_index, blob.loc, mesh_samples(), display_radius)
                 # put the duplicator in the patch group,
                 # so it gets removed together with patch copies
                 patch_group_assign(context, dob)
diff --git a/object_physics_meadow/meadow.py b/object_physics_meadow/meadow.py
index 2a4feb8..f910e47 100644
--- a/object_physics_meadow/meadow.py
+++ b/object_physics_meadow/meadow.py
@@ -41,10 +41,10 @@ def make_samples(context, gridob, groundob):
     gmax = mat * Vector(tuple(max(p[i] for p in groundob.bound_box) for i in range(3)))
     
     # get a sample generator implementation
-    #gen = best_candidate_gen(groundob.meadow.patch_radius, gmin[0], gmax[0], gmin[1], gmax[1])
-    gen = hierarchical_dart_throw_gen(groundob.meadow.patch_radius, groundob.meadow.sampling_levels, gmin[0], gmax[0], gmin[1], gmax[1])
+    #gen = best_candidate_gen(groundob.meadow.sample_distance, gmin[0], gmax[0], gmin[1], gmax[1])
+    gen = hierarchical_dart_throw_gen(groundob.meadow.sample_distance, groundob.meadow.sampling_levels, gmin[0], gmax[0], gmin[1], gmax[1])
     
-    loc2D = [p[0:2] for p in gen(groundob.meadow.seed, groundob.meadow.max_patches)]
+    loc2D = [p[0:2] for p in gen(groundob.meadow.seed, groundob.meadow.max_samples)]
     
     return loc2D
 
@@ -58,7 +58,7 @@ def make_blobs(context, gridob, groundob):
         prof.enable()
     
     samples2D = make_samples(context, gridob, groundob)
-    blob.make_blobs(context, gridob, groundob, samples2D, groundob.meadow.patch_radius)
+    blob.make_blobs(context, gridob, groundob, samples2D, groundob.meadow.sample_distance)
 
     if use_profiling:
         prof.disable()
@@ -85,7 +85,10 @@ def make_patches(context, gridob, groundob):
     
     template_objects = [ob for ob in scene.objects if ob.meadow.type == 'TEMPLATE']
     patch.make_patches(context, groundob, gridob, template_objects)
-    blob.setup_blob_duplis(context, groundob, 0.333 * groundob.meadow.patch_radius)
+    # XXX use a tiny radius here to hide duplicator faces in the viewport as much as possible
+    # this is not ideal, but we can't easily separate duplicator visibility and dupli visibility:
+    # hiding the duplicator would also hide the duplis!
+    blob.setup_blob_duplis(context, groundob, 0.0001)
 
     if use_profiling:
         prof.disable()
diff --git a/object_physics_meadow/settings.py b/object_physics_meadow/settings.py
index 9b87faa..539b076 100644
--- a/object_physics_meadow/settings.py
+++ b/object_physics_meadow/settings.py
@@ -156,15 +156,15 @@ class MeadowObjectSettings(PropertyGroup):
         default=4
         )
     
-    patch_radius = FloatProperty(
-        name="Patch Radius",
-        description="Free area around each patch where no other patch overlaps",
+    sample_distance = FloatProperty(
+        name="Sample Distance",
+        description="Minimum distance between samples to prevent overlap",
         default=1.0,
         min=0.01
         )
-    max_patches = IntProperty(
-        name="Maximum Patch Number",
-        description="Maximum number of patches",
+    max_samples = IntProperty(
+        name="Maximum Samples",
+        description="Maximum number of samples",
         default=1000,
         max=1000000,
         soft_max=10000
diff --git a/object_physics_meadow/ui.py b/object_physics_meadow/ui.py
index cf0796a..81b96d9 100644
--- a/object_physics_meadow/ui.py
+++ b/object_physics_meadow/ui.py
@@ -84,8 +84,8 @@ class OBJECT_PT_Meadow(Panel):
             sub.enabled = not has_samples
             sub.prop(meadow, "seed")
             col = sub.column(align=True)
-            col.prop(meadow, "patch_radius")
-            col.prop(meadow, "max_patches")
+            col.prop(meadow, "sample_distance")
+            col.prop(meadow, "max_samples")
             sub.prop(meadow, "sampling_levels")
             
             if has_samples:



More information about the Bf-extensions-cvs mailing list