[Bf-extensions-cvs] [4dcdd1d] master: More usable default visibility settings for automatically generated objects.

Lukas Tönne noreply at git.blender.org
Mon Dec 15 21:11:15 CET 2014


Commit: 4dcdd1d664c14c5e568b159fd328bc6b596783a8
Author: Lukas Tönne
Date:   Mon Dec 15 21:08:19 2014 +0100
Branches: master
https://developer.blender.org/rBAC4dcdd1d664c14c5e568b159fd328bc6b596783a8

More usable default visibility settings for automatically generated
objects.

Child objects grouped under a common root (blobs and patches) are now
unselectable by default, otherwise selecting by clicking  becomes barely
possible with all the extra geometry.

The visualizer object is now hidden by default, it only serves as an
occasional hint for debugging.

The radius for duplicator faces is now very very small, so it doesn't
hinder the appearance in the viewport (face size doesn't matter for
duplis).

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

M	object_physics_meadow/blob.py

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

diff --git a/object_physics_meadow/blob.py b/object_physics_meadow/blob.py
index 3910e37..ce2fc78 100644
--- a/object_physics_meadow/blob.py
+++ b/object_physics_meadow/blob.py
@@ -195,6 +195,29 @@ def blobs_from_customprops(data):
     return blobs
 
 
+def make_blob_visualizer(context, groundob, blobs, display_radius, hide, hide_render=True):
+    # common parent empty for blobs
+    blob_parent = get_blob_parent(context, groundob.matrix_world, _sampleviz_parent_name)
+    blob_parent.hide = hide
+    blob_parent.hide_render = hide_render
+
+    # preliminary display object
+    # XXX this could be removed eventually, but it's helpful as visual feedback to the user
+    # before creating the actual duplicator blob meshes
+    for index, blob in enumerate(blobs):
+        if blob:
+            samples = [(loc, nor) for loc, nor, _, _, _ in blob.samples]
+            ob = make_blob_object(context, index, blob.loc, samples, display_radius)
+            # put it in the blob group
+            blob_group_assign(context, ob)
+            # use parent to keep the outliner clean
+            set_object_parent(ob, blob_parent)
+            
+            ob.hide = hide
+            ob.hide_render = hide_render
+            # make children unselectable by default
+            ob.hide_select = True
+
 def make_blobs(context, gridob, groundob, samples2D, display_radius):
     blob_group_clear(context)
     blobs = []
@@ -233,24 +256,11 @@ def make_blobs(context, gridob, groundob, samples2D, display_radius):
         sweights = poly_3d_calc(tuple(mverts[i].co for i in sverts), sloc)
 
         blob.add_sample(sloc, snor, spoly, sverts, sweights)
-
-    # common parent empty for blobs
-    blob_parent = get_blob_parent(context, groundob.matrix_world, _sampleviz_parent_name)
-    
-    # preliminary display object
-    # XXX this could be removed eventually, but it's helpful as visual feedback to the user
-    # before creating the actual duplicator blob meshes
-    for index, blob in enumerate(blobs):
-        if blob:
-            samples = [(loc, nor) for loc, nor, _, _, _ in blob.samples]
-            ob = make_blob_object(context, index, blob.loc, samples, display_radius)
-            # put it in the blob group
-            blob_group_assign(context, ob)
-            # use parent to keep the outliner clean
-            set_object_parent(ob, blob_parent)
     
     blobs_to_customprops(groundob.meadow, blobs)
 
+    make_blob_visualizer(context, groundob, blobs, display_radius, hide=True)
+
 #-----------------------------------------------------------------------
 
 from object_physics_meadow.patch import patch_objects, patch_group_assign
@@ -300,10 +310,13 @@ def setup_blob_duplis(context, groundob, display_radius):
     blobs = blobs_from_customprops(groundob.meadow)
 
     patches = [ob for ob in patch_objects(context) if blobs[ob.meadow.blob_index] is not None]
+    for ob in patches:
+        # make unselectable by default
+        ob.hide_select = True
     
     # common parent empty for blobs
     blob_parent = get_blob_parent(context, groundob.matrix_world, _duplicator_parent_name)
-    
+
     del_patches = set() # patches to delete, keep this separate for iterator validity
     for blob_index, blob in enumerate(blobs):
         if blob is None:
@@ -322,12 +335,17 @@ def setup_blob_duplis(context, groundob, display_radius):
             
             if ob.meadow.use_as_dupli:
                 # make a duplicator for the patch object
-                dob = make_blob_object(context, blob_index, blob.loc, samples, display_radius)
+                # 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, samples, 0.0001)
                 # put the duplicator in the patch group,
                 # so it gets removed together with patch copies
                 patch_group_assign(context, dob)
                 # use parent to keep the outliner clean
                 set_object_parent(dob, blob_parent)
+                # make unselectable by default
+                dob.hide_select = True
+
                 set_object_parent(ob, dob)
                 
                 dob.dupli_type = 'FACES'



More information about the Bf-extensions-cvs mailing list