Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-07-07 05:32:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-07 05:33:44 +0300
commit9bc7dad463845abc247502c366ea3c9f94e4ad4b (patch)
tree3b6d5d83932ec0664e2cc9e3925188adca8d2015
parentd269e6b9f2783f06d3d8fdfb5e391006b22b13f7 (diff)
fracture_cell_setup: get particles from evaluated object
From patch by @Gappy1 (T61901)
-rw-r--r--object_fracture_cell/fracture_cell_setup.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/object_fracture_cell/fracture_cell_setup.py b/object_fracture_cell/fracture_cell_setup.py
index 0bd55547..83dab79b 100644
--- a/object_fracture_cell/fracture_cell_setup.py
+++ b/object_fracture_cell/fracture_cell_setup.py
@@ -30,7 +30,7 @@ _redraw_yasiamevil.opr = bpy.ops.wm.redraw_timer
_redraw_yasiamevil.arg = dict(type='DRAW_WIN_SWAP', iterations=1)
-def _points_from_object(scene, obj, source):
+def _points_from_object(depsgraph, scene, obj, source):
_source_all = {
'PARTICLE_OWN', 'PARTICLE_CHILD',
@@ -65,7 +65,6 @@ def _points_from_object(scene, obj, source):
matrix = obj.matrix_world.copy()
points.extend([matrix @ v.co for v in mesh.vertices])
else:
- depsgraph = bpy.context.evaluated_depsgraph_get()
ob_eval = ob.evaluated_get(depsgraph)
try:
mesh = ob_eval.to_mesh()
@@ -78,8 +77,9 @@ def _points_from_object(scene, obj, source):
ob_eval.to_mesh_clear()
def points_from_particles(obj):
+ obj_eval = obj.evaluated_get(depsgraph)
points.extend([p.location.copy()
- for psys in obj.particle_systems
+ for psys in obj_eval.particle_systems
for p in psys.particles])
# geom own
@@ -138,6 +138,7 @@ def cell_fracture_objects(context, obj,
):
from . import fracture_cell_calc
+ depsgraph = context.evaluated_depsgraph_get()
scene = context.scene
collection = context.collection
view_layer = context.view_layer
@@ -145,11 +146,11 @@ def cell_fracture_objects(context, obj,
# -------------------------------------------------------------------------
# GET POINTS
- points = _points_from_object(scene, obj, source)
+ points = _points_from_object(depsgraph, scene, obj, source)
if not points:
# print using fallback
- points = _points_from_object(scene, obj, {'VERT_OWN'})
+ points = _points_from_object(depsgraph, scene, obj, {'VERT_OWN'})
if not points:
print("no points found")