[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3591] trunk/py/scripts/addons/ object_fracture_cell: support for using other objects particles as input

Campbell Barton ideasman42 at gmail.com
Sat Jul 7 11:46:57 CEST 2012


Revision: 3591
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3591
Author:   campbellbarton
Date:     2012-07-07 09:46:56 +0000 (Sat, 07 Jul 2012)
Log Message:
-----------
support for using other objects particles as input

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-07 08:07:47 UTC (rev 3590)
+++ trunk/py/scripts/addons/object_fracture_cell/__init__.py	2012-07-07 09:46:56 UTC (rev 3591)
@@ -183,12 +183,14 @@
             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(

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-07 08:07:47 UTC (rev 3590)
+++ trunk/py/scripts/addons/object_fracture_cell/fracture_cell_setup.py	2012-07-07 09:46:56 UTC (rev 3591)
@@ -34,7 +34,8 @@
 def _points_from_object(obj, source):
 
     _source_all = {
-        'PARTICLE', 'PENCIL',
+        'PARTICLE_OWN', 'PARTICLE_CHILD',
+        'PENCIL',
         'VERT_OWN', 'VERT_CHILD',
         }
 
@@ -77,6 +78,12 @@
                 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,11 +94,13 @@
             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):
         return [point.co.copy() for point in stroke.points]
@@ -115,7 +124,7 @@
 
 
 def cell_fracture_objects(scene, obj,
-                          source={'PARTICLE'},
+                          source={'PARTICLE_OWN'},
                           source_limit=0,
                           source_noise=0.0,
                           clean=True,



More information about the Bf-extensions-cvs mailing list