Skip to content

Commit

Permalink
fix: ensure a weld modifier is placed after a vanilla bevel modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed Apr 18, 2022
1 parent 733f6ad commit 5cecea6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion power_mods/bevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@


mod_bevel = "Bevel — ND B"
mod_summon_list = [mod_bevel]
mod_weld = "Weld — ND B"
mod_summon_list = [mod_bevel, mod_weld]


class ND_OT_bevel(bpy.types.Operator):
Expand Down Expand Up @@ -149,7 +150,19 @@ def add_bevel_modifier(self, context):
bevel.offset_type = 'WIDTH'

self.bevel = bevel


def add_weld_modifier(self, context):
mods = context.active_object.modifiers
mod_names = list(map(lambda x: x.name, mods))
previous_op = all(m in mod_names for m in mod_summon_list)

if not previous_op:
weld = context.object.modifiers.new(mod_weld, type='WELD')
weld.merge_threshold = 0.00001

self.weld = weld


def operate(self, context):
self.bevel.width = self.width
Expand All @@ -160,6 +173,7 @@ def operate(self, context):


def finish(self, context):
self.add_weld_modifier(context)
unregister_draw_handler()


Expand Down

0 comments on commit 5cecea6

Please sign in to comment.