Skip to content

Commit

Permalink
#72 fix issue of not working with base_ob
Browse files Browse the repository at this point in the history
  • Loading branch information
Weisl committed Jul 5, 2023
1 parent 8524346 commit 2cc1576
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 30 deletions.
6 changes: 3 additions & 3 deletions collider_shapes/add_bounding_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
6 changes: 3 additions & 3 deletions collider_shapes/add_bounding_capsule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
6 changes: 3 additions & 3 deletions collider_shapes/add_bounding_convex_hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down
7 changes: 4 additions & 3 deletions collider_shapes/add_bounding_cylinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
14 changes: 5 additions & 9 deletions collider_shapes/add_bounding_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions collider_shapes/add_collision_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
6 changes: 3 additions & 3 deletions collider_shapes/add_collision_remesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
6 changes: 3 additions & 3 deletions collider_shapes/add_minimum_bounding_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit 2cc1576

Please sign in to comment.