diff --git a/collider_shapes/add_bounding_primitive.py b/collider_shapes/add_bounding_primitive.py index de4530b..19ffd6a 100644 --- a/collider_shapes/add_bounding_primitive.py +++ b/collider_shapes/add_bounding_primitive.py @@ -181,10 +181,14 @@ def draw_viewport_overlay(self, context): # mode check is here because keep original mesh doesn't work for EDIT mode atm. if self.use_keep_original_materials: label = "Keep Original Materials" - value = str(self.keep_original_material) + value = str(self.keep_original_material) # Currently only supported in OBJECT mode - type = 'bool' if self.obj_mode == 'OBJECT' else 'disabled' + if self.obj_mode == 'OBJECT': + type = 'bool' + else: + type = 'disabled' + i = draw_modal_item(self, font_id, i, vertical_px_offset, left_margin, label, value=value, key='(O)', type=type) label = "Toggle X Ray " @@ -773,8 +777,7 @@ def primitive_postprocessing(self, context, bounding_object, base_object_collect else: # No default material is selected mat_name = self.prefs.physics_material_name - # The or self.obj_mode == 'OBJECT' is here because the keep_original_material is currently not supported for 'EDIT' mode. - if self.keep_original_material == False or self.obj_mode != 'OBJECT': + if self.use_keep_original_materials == False or self.keep_original_material == False: set_physics_material(bounding_object, mat_name) bounding_object['isCollider'] = True @@ -1140,7 +1143,7 @@ def modal(self, context, event): self.creation_mode_idx = (self.creation_mode_idx + 1) % len(self.creation_mode) self.execute(context) - elif event.type == 'O' and event.value == 'RELEASE' and self.use_keep_original_materials == True and self.obj_mode == 'OBJECT': + elif event.type == 'O' and event.value == 'RELEASE' and self.use_keep_original_materials == True: self.keep_original_material = not self.keep_original_material self.execute(context) diff --git a/collider_shapes/add_collision_mesh.py b/collider_shapes/add_collision_mesh.py index 396dd4e..5f9868a 100644 --- a/collider_shapes/add_collision_mesh.py +++ b/collider_shapes/add_collision_mesh.py @@ -48,6 +48,10 @@ def execute(self, context): if context.object not in self.selected_objects: self.selected_objects.append(context.object) + # Keep original material is currently not supported for EDIT mode. + if self.obj_mode != 'OBJECT': + self.keep_original_material = False + collider_data = [] for obj in self.selected_objects: