Skip to content
Snippets Groups Projects
Commit a2324bd4 authored by Campbell Barton's avatar Campbell Barton
Browse files

split islands boolean option.

parent 8a56a608
No related branches found
No related tags found
No related merge requests found
......@@ -56,12 +56,13 @@ def main_object(scene, obj, level, **kw):
recursion_chance_select = kw_copy.pop("recursion_chance_select")
use_layer_next = kw_copy.pop("use_layer_next")
group_name = kw_copy.pop("group_name")
use_island_split = kw_copy.pop("use_island_split")
from . import fracture_cell_setup
objects = fracture_cell_setup.cell_fracture_objects(scene, obj, **kw_copy)
objects = fracture_cell_setup.cell_fracture_boolean(scene, obj, objects)
objects = fracture_cell_setup.cell_fracture_boolean(scene, obj, objects,
use_island_split=use_island_split)
# todo, split islands.
......@@ -327,6 +328,7 @@ class FractureCell(Operator):
rowsub.prop(self, "use_smooth_faces")
rowsub.prop(self, "use_smooth_edges")
rowsub.prop(self, "use_data_match")
rowsub.prop(self, "use_island_split")
rowsub.prop(self, "margin")
# rowsub.prop(self, "use_island_split") # TODO
......
......@@ -122,7 +122,6 @@ def cell_fracture_objects(scene, obj,
use_smooth_faces=False,
use_smooth_edges=True,
use_data_match=False,
use_island_split=False,
use_debug_points=False,
margin=0.0,
):
......@@ -279,7 +278,11 @@ def cell_fracture_objects(scene, obj,
return objects
def cell_fracture_boolean(scene, obj, objects, apply=True, clean=True):
def cell_fracture_boolean(scene, obj, objects,
apply=True,
clean=True,
use_island_split=False,
):
objects_boolean = []
......@@ -326,4 +329,28 @@ def cell_fracture_boolean(scene, obj, objects, apply=True, clean=True):
if obj_cell is not None:
objects_boolean.append(obj_cell)
if use_island_split:
# this is ugly and Im not proud of this - campbell
objects_islands = []
for obj_cell in objects_boolean:
scene.objects.active = obj_cell
group_island = bpy.data.groups.new(name="Islands")
group_island.objects.link(obj_cell)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.separate(type='LOOSE')
bpy.ops.object.mode_set(mode='OBJECT')
objects_islands.extend(group_island.objects[:])
bpy.data.groups.remove(group_island)
scene.objects.active = None
objects_boolean = objects_islands
return objects_boolean
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment