Skip to content

Commit

Permalink
fix: fix profile extrude recall and revert behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed May 29, 2022
1 parent fd26650 commit a9a870d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions power_mods/profile_extrude.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def summon_old_operator(self, context, mods):

self.axis_prev = self.axis = {'X': 0, 'Y': 1, 'Z': 2}[self.screw.axis]
self.extrusion_length_prev = self.extrusion_length = self.screw.screw_offset
self.weighting_prev = self.weighting = self.calculate_existing_weighting()
self.weighting = self.calculate_existing_weighting()
self.offset_strength_prev = self.offset.strength


def calculate_offset_strength(self):
Expand All @@ -190,7 +191,7 @@ def calculate_offset_strength(self):
def calculate_existing_weighting(self):
offset = abs(self.offset.strength)
extrusion = self.screw.screw_offset
factor = offset / extrusion
factor = offset / (extrusion * 0.5)

return max(-1, min(1, 1 - round(factor)))

Expand Down Expand Up @@ -240,7 +241,7 @@ def revert(self, context):
self.screw.axis = axis
self.screw.screw_offset = self.extrusion_length_prev
self.offset.direction = axis
self.offset.strength = self.calculate_offset_strength()
self.offset.strength = self.offset_strength_prev

unregister_draw_handler()
unregister_axis_handler()
Expand Down

0 comments on commit a9a870d

Please sign in to comment.