Skip to content

Commit

Permalink
fix: ensure vertex_bevel operator always places current bevel modifie…
Browse files Browse the repository at this point in the history
…r at the top of the stack, and only creates one weld modifier in total
  • Loading branch information
tristan-hm committed Feb 19, 2022
1 parent 6ae371f commit 00cfd4e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions power_mods/vertex_bevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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


class ND_OT_vertex_bevel(bpy.types.Operator):
Expand Down Expand Up @@ -130,13 +131,24 @@ def add_bevel_modifier(self, context):
bevel.profile = self.profile

self.bevel = bevel

while context.object.modifiers[0].name != self.bevel.name:
bpy.ops.object.modifier_move_up(modifier=self.bevel.name)


def add_weld_modifier(self, context):
weld = context.object.modifiers.new(mod_weld, type='WELD')
weld.merge_threshold = 0.00001
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

self.weld = weld
while context.object.modifiers[1].name != self.weld.name:
bpy.ops.object.modifier_move_up(modifier=self.weld.name)


def operate(self, context):
Expand Down

0 comments on commit 00cfd4e

Please sign in to comment.