[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3573] trunk/py/scripts/addons/ object_fracture_voroni: add support for using non mesh objects as point sources ( mainly for curves but meta's and surfaces also work)

Campbell Barton ideasman42 at gmail.com
Wed Jul 4 10:31:03 CEST 2012


Revision: 3573
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3573
Author:   campbellbarton
Date:     2012-07-04 08:31:03 +0000 (Wed, 04 Jul 2012)
Log Message:
-----------
add support for using non mesh objects as point sources (mainly for curves but meta's and surfaces also work)
remove face/edge point sources. not really that useful in most cases and clogged up UI.

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-04 01:08:04 UTC (rev 3572)
+++ trunk/py/scripts/addons/object_fracture_voroni/__init__.py	2012-07-04 08:31:03 UTC (rev 3573)
@@ -161,7 +161,7 @@
 
 class FractureCell(Operator):
     bl_idname = "object.add_fracture_cell_objects"
-    bl_label = "Cell Fracture Helper Objects"
+    bl_label = "Cell Fracture Mesh"
     bl_options = {'PRESET'}
 
     # -------------------------------------------------------------------------
@@ -169,11 +169,7 @@
     source = EnumProperty(
             name="Source",
             items=(('VERT_OWN', "Own Verts", "Use own vertices"),
-                   ('EDGE_OWN', "Own Edges", "Use own edges"),
-                   ('FACE_OWN', "Own Faces", "Use own faces"),
                    ('VERT_CHILD', "Child Verts", "Use own vertices"),
-                   ('EDGE_CHILD', "Child Edges", "Use own edges"),
-                   ('FACE_CHILD', "Child Faces", "Use own faces"),
                    ('PARTICLE', "Particles", ("All particle systems of the "
                                               "source object")),
                    ('PENCIL', "Grease Pencil", "This objects grease pencil"),

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-04 01:08:04 UTC (rev 3572)
+++ trunk/py/scripts/addons/object_fracture_voroni/fracture_cell_setup.py	2012-07-04 08:31:03 UTC (rev 3573)
@@ -35,8 +35,8 @@
 
     _source_all = {
         'PARTICLE', 'PENCIL',
-        'VERT_OWN', 'EDGE_OWN', 'FACE_OWN',
-        'VERT_CHILD', 'EDGE_CHILD', 'FACE_CHILD'}
+        'VERT_OWN', 'VERT_CHILD',
+        }
 
     print(source - _source_all)
     print(source)
@@ -59,41 +59,32 @@
         return co / tot
 
     def points_from_verts(obj):
+        """Takes points from _any_ object with geometry"""
         if obj.type == 'MESH':
             mesh = obj.data
             matrix = obj.matrix_world.copy()
             points.extend([matrix * v.co for v in mesh.vertices])
+        else:
+            try:
+                mesh = ob.to_mesh(scene=bpy.context.scene,
+                                  apply_modifiers=True,
+                                  settings='PREVIEW')
+            except:
+                mesh = None
 
-    def points_from_edges(obj):
-        if obj.type == 'MESH':
-            mesh = obj.data
-            matrix = obj.matrix_world.copy()
-            points.extend([matrix * edge_center(mesh, e) for e in mesh.edges])
+            if mesh is not None:
+                matrix = obj.matrix_world.copy()
+                points.extend([matrix * v.co for v in mesh.vertices])
+                bpy.data.meshes.remove(mesh)
 
-    def points_from_faces(obj):
-        if obj.type == 'MESH':
-            mesh = obj.data
-            matrix = obj.matrix_world.copy()
-            points.extend([matrix * poly_center(mesh, p) for p in mesh.polygons])
-
     # geom own
     if 'VERT_OWN' in source:
         points_from_verts(obj)
-    if 'EDGE_OWN' in source:
-        points_from_edges(obj)
-    if 'FACE_OWN' in source:
-        points_from_faces(obj)
 
     # geom children
     if 'VERT_CHILD' in source:
         for obj_child in obj.children:
             points_from_verts(obj_child)
-    if 'EDGE_CHILD' in source:
-        for obj_child in obj.children:
-            points_from_edges(obj_child)
-    if 'FACE_CHILD' in source:
-        for obj_child in obj.children:
-            points_from_faces(obj_child)
 
     # geom particles
     if 'PARTICLE' in source:



More information about the Bf-extensions-cvs mailing list