From a5a2b36b9ead8f1b6aed60833c03d7a90ace9b03 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Jul 2019 11:01:33 +1000 Subject: Fix T66820: Cell fracture not working properly This failed to properly calculate booleans from the fractured cells. --- object_fracture_cell/fracture_cell_setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'object_fracture_cell') diff --git a/object_fracture_cell/fracture_cell_setup.py b/object_fracture_cell/fracture_cell_setup.py index 6bd8937d..83f7cdd1 100644 --- a/object_fracture_cell/fracture_cell_setup.py +++ b/object_fracture_cell/fracture_cell_setup.py @@ -321,7 +321,6 @@ def cell_fracture_boolean(context, obj, objects, collection = context.collection scene = context.scene view_layer = context.view_layer - depsgraph = context.evaluated_depsgraph_get() if use_interior_hide and level == 0: # only set for level 0 @@ -337,11 +336,18 @@ def cell_fracture_boolean(context, obj, objects, if use_interior_hide: obj_cell.data.polygons.foreach_set("hide", [True] * len(obj_cell.data.polygons)) + # Calculates all booleans at once (faster). + depsgraph = context.evaluated_depsgraph_get() + + for obj_cell in objects: + + if not use_debug_bool: + obj_cell_eval = obj_cell.evaluated_get(depsgraph) mesh_new = bpy.data.meshes.new_from_object(obj_cell_eval) mesh_old = obj_cell.data obj_cell.data = mesh_new - obj_cell.modifiers.remove(mod) + obj_cell.modifiers.remove(obj_cell.modifiers[-1]) # remove if not valid if not mesh_old.users: -- cgit v1.2.3