[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3568] trunk/py/scripts/addons/ object_fracture_voroni: option to draw as fracture runs

Campbell Barton ideasman42 at gmail.com
Tue Jul 3 18:27:48 CEST 2012


Revision: 3568
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3568
Author:   campbellbarton
Date:     2012-07-03 16:27:48 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
option to draw as fracture runs

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

Modified: trunk/py/scripts/addons/object_fracture_voroni/__init__.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_voroni/__init__.py	2012-07-03 16:06:41 UTC (rev 3567)
+++ trunk/py/scripts/addons/object_fracture_voroni/__init__.py	2012-07-03 16:27:48 UTC (rev 3568)
@@ -60,9 +60,14 @@
 
     from . import fracture_cell_setup
     
+    if kw_copy["use_debug_redraw"]:
+        obj_draw_type_prev = obj.draw_type
+        obj.draw_type = 'WIRE'
+    
     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_island_split=use_island_split,
+                                                        use_debug_redraw=kw_copy["use_debug_redraw"])
 
     # todo, split islands.
 
@@ -129,6 +134,9 @@
         for obj_cell in objects:
             group.objects.link(obj_cell)
 
+    if kw_copy["use_debug_redraw"]:
+        obj.draw_type = obj_draw_type_prev
+
     # testing only!
     # obj.hide = True
     return objects
@@ -292,6 +300,12 @@
             description="Create mesh data showing the points used for fracture",
             default=False,
             )
+            
+    use_debug_redraw = BoolProperty(
+            name="Show Progress Realtime",
+            description="Redraw as fracture is done",
+            default=True,
+            )
 
     def execute(self, context):
         keywords = self.as_keywords()  # ignore=("blah",)
@@ -358,6 +372,7 @@
         col = box.column()
         col.label("Debug")
         rowsub = col.row(align=True)
+        rowsub.prop(self, "use_debug_redraw")
         rowsub.prop(self, "use_debug_points")
 
 #def menu_func(self, context):

Modified: trunk/py/scripts/addons/object_fracture_voroni/fracture_cell_setup.py
===================================================================
--- trunk/py/scripts/addons/object_fracture_voroni/fracture_cell_setup.py	2012-07-03 16:06:41 UTC (rev 3567)
+++ trunk/py/scripts/addons/object_fracture_voroni/fracture_cell_setup.py	2012-07-03 16:27:48 UTC (rev 3568)
@@ -23,6 +23,14 @@
 import bpy
 import bmesh
 
+
+def _redraw_yasiamevil():
+    _redraw_yasiamevil.opr(**_redraw_yasiamevil.arg)
+_redraw_yasiamevil.opr = bpy.ops.wm.redraw_timer
+_redraw_yasiamevil.arg = dict(type='DRAW_WIN_SWAP', iterations=1)
+
+    
+
 def _points_from_object(obj, source):
 
     _source_all = {
@@ -125,6 +133,7 @@
                           use_debug_points=False,
                           margin=0.0,
                           material_index=0,
+                          use_debug_redraw=False,
                           ):
     
     from . import fracture_cell_calc
@@ -189,7 +198,7 @@
 
     cells = fracture_cell_calc.points_as_bmesh_cells(verts, points,
                                                      margin_cell=margin)
-    
+
     # some hacks here :S
     cell_name = obj.name + "_cell"
     
@@ -270,6 +279,10 @@
 
         objects.append(obj_cell)
 
+        if use_debug_redraw:
+            scene.update()
+            _redraw_yasiamevil()
+
     scene.update()
 
 
@@ -287,6 +300,7 @@
                           apply=True,
                           clean=True,
                           use_island_split=False,
+                          use_debug_redraw=False,
                           ):
 
     objects_boolean = []
@@ -334,6 +348,9 @@
 
         if obj_cell is not None:
             objects_boolean.append(obj_cell)
+            
+            if use_debug_redraw:
+                _redraw_yasiamevil()
 
     if use_island_split:
         # this is ugly and Im not proud of this - campbell



More information about the Bf-extensions-cvs mailing list