diff --git a/collider_shapes/add_bounding_box.py b/collider_shapes/add_bounding_box.py index b7b50f4..da655c7 100644 --- a/collider_shapes/add_bounding_box.py +++ b/collider_shapes/add_bounding_box.py @@ -86,12 +86,12 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) self.tmp_meshes.extend(split_objs) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: context.view_layer.objects.active = obj bounding_box_data = {} diff --git a/collider_shapes/add_bounding_capsule.py b/collider_shapes/add_bounding_capsule.py index 10ec67b..ac27463 100644 --- a/collider_shapes/add_bounding_capsule.py +++ b/collider_shapes/add_bounding_capsule.py @@ -105,11 +105,11 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: context.view_layer.objects.active = obj bounding_capsule_data = {} diff --git a/collider_shapes/add_bounding_convex_hull.py b/collider_shapes/add_bounding_convex_hull.py index c98dd2a..57a7d23 100644 --- a/collider_shapes/add_bounding_convex_hull.py +++ b/collider_shapes/add_bounding_convex_hull.py @@ -73,11 +73,11 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: convex_collision_data = {} diff --git a/collider_shapes/add_bounding_cylinder.py b/collider_shapes/add_bounding_cylinder.py index 8d0b524..4fb44ca 100644 --- a/collider_shapes/add_bounding_cylinder.py +++ b/collider_shapes/add_bounding_cylinder.py @@ -282,11 +282,12 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) + + for base_ob, obj in objs: - for obj in objs: bounding_cylinder_data = {} if self.obj_mode == "EDIT" and base_ob.type == 'MESH' and self.active_obj.type == 'MESH': diff --git a/collider_shapes/add_bounding_sphere.py b/collider_shapes/add_bounding_sphere.py index d4342a7..04e62e9 100644 --- a/collider_shapes/add_bounding_sphere.py +++ b/collider_shapes/add_bounding_sphere.py @@ -189,22 +189,18 @@ def execute(self, context): self.tmp_meshes.append(obj) if self.split_by_mesh_island: - print('obj = ' + obj.name) - split_objs = create_objs_from_island(obj) - print("Split objs = " + str(len(split_objs))) - for split_ob in split_objs: - print("Split obj = " + str(split_ob.name)) + split_objs = create_objs_from_island(obj) self.tmp_meshes.extend(split_objs) + for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: initial_mod_state = {} context.view_layer.objects.active = obj scene = context.scene diff --git a/collider_shapes/add_collision_mesh.py b/collider_shapes/add_collision_mesh.py index 0a40051..ed69a2a 100644 --- a/collider_shapes/add_collision_mesh.py +++ b/collider_shapes/add_collision_mesh.py @@ -78,11 +78,11 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: mesh_collider_data = {} if self.obj_mode == "EDIT" and base_ob.type == 'MESH' and self.active_obj.type == 'MESH': diff --git a/collider_shapes/add_collision_remesh.py b/collider_shapes/add_collision_remesh.py index 746a5cd..fd83fa9 100644 --- a/collider_shapes/add_collision_remesh.py +++ b/collider_shapes/add_collision_remesh.py @@ -83,11 +83,11 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: mesh_collider_data = {} if self.obj_mode == "EDIT" and base_ob.type == 'MESH' and self.active_obj.type == 'MESH': diff --git a/collider_shapes/add_minimum_bounding_box.py b/collider_shapes/add_minimum_bounding_box.py index 82b3a42..edf2903 100644 --- a/collider_shapes/add_minimum_bounding_box.py +++ b/collider_shapes/add_minimum_bounding_box.py @@ -173,11 +173,11 @@ def execute(self, context): for split in split_objs: col = self.add_to_collections(split, 'tmp_mesh', hide=False) col.color_tag = 'COLOR_03' - objs.extend(split_objs) + objs.append((base_ob, split)) else: - objs.append(obj) + objs.append((base_ob, obj)) - for obj in objs: + for base_ob, obj in objs: bounding_box_data = {} if self.obj_mode == "EDIT" and base_ob.type == 'MESH' and self.active_obj.type == 'MESH':