Skip to content

Commit

Permalink
#247 Weld Modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Weisl committed Nov 9, 2022
1 parent d97950f commit 711eb53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions collider_shapes/add_bounding_primitive.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions collider_shapes/add_collision_mesh.py
Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion preferences/properties.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 711eb53

Please sign in to comment.