diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 13:46:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-07 13:46:56 +0400 |
commit | 93226d0188184b45d2554572cca2f64f23cf5e8e (patch) | |
tree | b6ff5f6a48964f7b4863d78c6e2b41458648aa9c /object_fracture_cell | |
parent | 313153117b6314e25775cd03065ef246b16575e7 (diff) |
support for using other objects particles as input
Diffstat (limited to 'object_fracture_cell')
-rw-r--r-- | object_fracture_cell/__init__.py | 8 | ||||
-rw-r--r-- | object_fracture_cell/fracture_cell_setup.py | 21 |
2 files changed, 20 insertions, 9 deletions
diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py index c1a71333..0076742e 100644 --- a/object_fracture_cell/__init__.py +++ b/object_fracture_cell/__init__.py @@ -183,12 +183,14 @@ class FractureCell(Operator): name="Source", items=(('VERT_OWN', "Own Verts", "Use own vertices"), ('VERT_CHILD', "Child Verts", "Use own vertices"), - ('PARTICLE', "Particles", ("All particle systems of the " - "source object")), + ('PARTICLE_OWN', "Own Particles", ("All particle systems of the " + "source object")), + ('PARTICLE_CHILD', "Child Particles", ("All particle systems of the " + "child objects")), ('PENCIL', "Grease Pencil", "This objects grease pencil"), ), options={'ENUM_FLAG'}, - default={'PARTICLE', 'VERT_OWN'} # 'VERT_OWN', 'EDGE_OWN', 'FACE_OWN' + default={'PARTICLE_OWN', 'VERT_OWN'}, ) source_limit = IntProperty( diff --git a/object_fracture_cell/fracture_cell_setup.py b/object_fracture_cell/fracture_cell_setup.py index 9a6ccbbf..c2237f68 100644 --- a/object_fracture_cell/fracture_cell_setup.py +++ b/object_fracture_cell/fracture_cell_setup.py @@ -34,7 +34,8 @@ _redraw_yasiamevil.arg = dict(type='DRAW_WIN_SWAP', iterations=1) def _points_from_object(obj, source): _source_all = { - 'PARTICLE', 'PENCIL', + 'PARTICLE_OWN', 'PARTICLE_CHILD', + 'PENCIL', 'VERT_OWN', 'VERT_CHILD', } @@ -77,6 +78,12 @@ def _points_from_object(obj, source): points.extend([matrix * v.co for v in mesh.vertices]) bpy.data.meshes.remove(mesh) + def points_from_particles(obj): + points.extend([p.location.copy() + for psys in obj.particle_systems + for p in psys.particles]) + + # geom own if 'VERT_OWN' in source: points_from_verts(obj) @@ -87,10 +94,12 @@ def _points_from_object(obj, source): points_from_verts(obj_child) # geom particles - if 'PARTICLE' in source: - points.extend([p.location.copy() - for psys in obj.particle_systems - for p in psys.particles]) + if 'PARTICLE_OWN' in source: + points_from_verts(obj) + + if 'PARTICLE_CHILD' in source: + for obj_child in obj.children: + points_from_particles(obj_child) # grease pencil def get_points(stroke): @@ -115,7 +124,7 @@ def _points_from_object(obj, source): def cell_fracture_objects(scene, obj, - source={'PARTICLE'}, + source={'PARTICLE_OWN'}, source_limit=0, source_noise=0.0, clean=True, |