From 03117a2ca804a5fee2935cfa9051c9b0674aac7c Mon Sep 17 00:00:00 2001 From: Tristan Strathearn Date: Sun, 20 Feb 2022 13:35:12 +1000 Subject: [PATCH] fix: ensure the decimate modifier retains its appropriate position in the stack when recalling the ring_and_bolt operator --- generators/ring_and_bolt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generators/ring_and_bolt.py b/generators/ring_and_bolt.py index 62aac09..7dcc2eb 100644 --- a/generators/ring_and_bolt.py +++ b/generators/ring_and_bolt.py @@ -196,6 +196,12 @@ def add_decimate_modifier(self): self.decimate = decimate + all_mods = self.obj.modifiers.values() + decimate_index = all_mods.index(self.screwZ) + 1 + + while self.obj.modifiers[decimate_index].name != self.decimate.name: + bpy.ops.object.modifier_move_up(modifier=self.decimate.name) + def try_remove_decimate_modifier(self, context): self.had_decimate_mod = False