[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3586] trunk/py/scripts/addons/ object_fracture_cell: - debug option to not apply booleans

Campbell Barton ideasman42 at gmail.com
Thu Jul 5 17:59:25 CEST 2012


Revision: 3586
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3586
Author:   campbellbarton
Date:     2012-07-05 15:59:24 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
- debug option to not apply booleans
- temp workaround for convex hull failing

Modified Paths:
--------------
    trunk/py/scripts/addons/object_fracture_cell/__init__.py
    trunk/py/scripts/addons/object_fracture_cell/fracture_cell_setup.py

Modified: trunk/py/scripts/addons/object_fracture_cell/__init__.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_cell/__init__.py	2012-07-05 10:25:16 UTC (rev 3585)
+++ trunk/py/scripts/addons/object_fracture_cell/__init__.py	2012-07-05 15:59:24 UTC (rev 3586)
@@ -58,6 +58,7 @@
     use_layer_next = kw_copy.pop("use_layer_next")
     group_name = kw_copy.pop("group_name")
     use_island_split = kw_copy.pop("use_island_split")
+    use_debug_bool = kw_copy.pop("use_debug_bool")
 
     from . import fracture_cell_setup
 
@@ -71,6 +72,7 @@
     objects = fracture_cell_setup.cell_fracture_objects(scene, obj, **kw_copy)
     objects = fracture_cell_setup.cell_fracture_boolean(scene, obj, objects,
                                                         use_island_split=use_island_split,
+                                                        use_debug_bool=use_debug_bool,
                                                         use_debug_redraw=kw_copy["use_debug_redraw"])
 
     # todo, split islands.
@@ -315,6 +317,12 @@
             default=True,
             )
 
+    use_debug_bool = BoolProperty(
+            name="Debug Boolean",
+            description="Skip applying the boolean modifier",
+            default=False,
+            )
+
     def execute(self, context):
         keywords = self.as_keywords()  # ignore=("blah",)
 
@@ -383,6 +391,7 @@
         rowsub = col.row(align=True)
         rowsub.prop(self, "use_debug_redraw")
         rowsub.prop(self, "use_debug_points")
+        rowsub.prop(self, "use_debug_bool")
 
 #def menu_func(self, context):
 #    self.layout.menu("INFO_MT_add_fracture_objects", icon="PLUGIN")

Modified: trunk/py/scripts/addons/object_fracture_cell/fracture_cell_setup.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_cell/fracture_cell_setup.py	2012-07-05 10:25:16 UTC (rev 3585)
+++ trunk/py/scripts/addons/object_fracture_cell/fracture_cell_setup.py	2012-07-05 15:59:24 UTC (rev 3586)
@@ -205,7 +205,21 @@
 
         # create the convex hulls
         bm = bmesh.new()
+        
+        # WORKAROUND FOR CONVEX HULL BUG/LIMIT
+        # XXX small noise
+        import random
+        def R(): return (random.random() - 0.5) * 0.01
+        # XXX small noise
+
         for i, co in enumerate(cell_points):
+            
+            # XXX small noise
+            co.x += R()
+            co.y += R()
+            co.z += R()
+            # XXX small noise
+            
             bm_vert = bm.verts.new(co)
             bm_vert.tag = True
 
@@ -291,7 +305,7 @@
 
 
 def cell_fracture_boolean(scene, obj, objects,
-                          apply=True,
+                          use_debug_bool=False,
                           clean=True,
                           use_island_split=False,
                           use_debug_redraw=False,
@@ -304,7 +318,7 @@
         mod.object = obj
         mod.operation = 'INTERSECT'
 
-        if apply:
+        if not use_debug_bool:
             mesh_new = obj_cell.to_mesh(scene,
                                         apply_modifiers=True,
                                         settings='PREVIEW')
@@ -346,7 +360,7 @@
             if use_debug_redraw:
                 _redraw_yasiamevil()
 
-    if apply and use_island_split:
+    if (not use_debug_bool) and use_island_split:
         # this is ugly and Im not proud of this - campbell
         objects_islands = []
         for obj_cell in objects_boolean:



More information about the Bf-extensions-cvs mailing list