diff --git a/collider_shapes/add_bounding_primitive.py b/collider_shapes/add_bounding_primitive.py index bcdc140..098b1d5 100644 --- a/collider_shapes/add_bounding_primitive.py +++ b/collider_shapes/add_bounding_primitive.py @@ -740,6 +740,9 @@ def primitive_postprocessing(self, context, bounding_object, base_object_collect colSettings = context.scene.collider_tools self.set_viewport_drawing(context, bounding_object) + if self.use_weld_modifier: + self.add_weld_modifier(context, bounding_object) + self.add_displacement_modifier(context, bounding_object) self.set_collections(bounding_object, base_object_collections) @@ -800,17 +803,17 @@ def reset_to_initial_state(self, context): bpy.ops.object.mode_set(mode=self.obj_mode) def add_displacement_modifier(self, context, bounding_object): - scene = context.scene - # add displacement modifier and safe it to manipulate the strenght in the modal operator modifier = bounding_object.modifiers.new(name="Collision_displace", type='DISPLACE') modifier.strength = self.current_settings_dic['discplace_offset'] self.displace_modifiers.append(modifier) - def add_decimate_modifier(self, context, bounding_object): - scene = context.scene + def add_weld_modifier(self, context, bounding_object): + # add displacement modifier and safe it to manipulate the strenght in the modal operator + modifier = bounding_object.modifiers.new(name="Collision_weld", type='WELD') + def add_decimate_modifier(self, context, bounding_object): # add decimation modifier and safe it to manipulate the strenght in the modal operator modifier = bounding_object.modifiers.new(name="Collision_decimate", type='DECIMATE') modifier.ratio = self.current_settings_dic['decimate'] @@ -880,6 +883,7 @@ def __init__(self): self.use_vertex_count = False self.vertex_count = 8 self.use_modifier_stack = False + self.use_weld_modifier = False self.use_space = False self.use_cylinder_axis = False diff --git a/collider_shapes/add_collision_mesh.py b/collider_shapes/add_collision_mesh.py index 284c592..d154e5a 100644 --- a/collider_shapes/add_collision_mesh.py +++ b/collider_shapes/add_collision_mesh.py @@ -14,6 +14,7 @@ def __init__(self): super().__init__() self.use_decimation = True self.use_modifier_stack = True + self.use_weld_modifier = True self.shape = "mesh_shape" def invoke(self, context, event): diff --git a/preferences/properties.py b/preferences/properties.py index 97de6ef..064c96e 100644 --- a/preferences/properties.py +++ b/preferences/properties.py @@ -65,7 +65,8 @@ class ColliderTools_Properties(bpy.types.PropertyGroup): # Display setting of the bounding object in the viewport toggle_wireframe: bpy.props.BoolProperty(name="Toggle Wireframe", - description="Toggle wireframe display for collider objects.", default=False, + description="Toggle wireframe display for collider objects.", + default=False, update=update_wireframe) # Tranformation space to be used for creating the bounding object. @@ -93,6 +94,7 @@ class ColliderTools_Properties(bpy.types.PropertyGroup): "Collider wireframes are visible during the generation and remain afterwards")), description="Set the display type for collider wireframes", default='PREVIEW') + on_load: bpy.props.BoolProperty(name='On Load', default=True)