diff --git a/object_fracture_voroni/__init__.py b/object_fracture_voroni/__init__.py index 611a37ac49570cbbf60856bbb05acf993826a861..d284e205b4dc9ed5bb1817f254afc65fb786c9a6 100644 --- a/object_fracture_voroni/__init__.py +++ b/object_fracture_voroni/__init__.py @@ -161,7 +161,7 @@ def main(context, **kw): 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 @@ class FractureCell(Operator): 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"), diff --git a/object_fracture_voroni/fracture_cell_setup.py b/object_fracture_voroni/fracture_cell_setup.py index cf87be263c652fd7515be2a01103f0a62b0d8549..a33658284a22c802d3d3975c8c0269beafdc322a 100644 --- a/object_fracture_voroni/fracture_cell_setup.py +++ b/object_fracture_voroni/fracture_cell_setup.py @@ -35,8 +35,8 @@ def _points_from_object(obj, source): _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 @@ def _points_from_object(obj, source): 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]) - - 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]) + 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) # 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: