Skip to content

Commit

Permalink
feat: step bolt operator segments up by 2, and by 1 on shift, followi…
Browse files Browse the repository at this point in the history
…ng similar operation to the sketch_bevel operator
  • Loading branch information
tristan-hm committed Jan 26, 2022
1 parent 8bff7c4 commit 8dbece2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def modal(self, context, event):
offset_factor = 0.001 if event.shift else 0.01
radius_factor = 0.001 if event.shift else 0.01
thickness_factor = 0.001 if event.shift else 0.01
segment_factor = 1 if event.shift else 2

self.key_shift = event.shift
self.key_alt = event.alt
Expand All @@ -36,7 +37,7 @@ def modal(self, context, event):
elif event.ctrl:
self.thickness += thickness_factor
else:
self.segments += 1
self.segments = 4 if self.segments == 3 else self.segments + segment_factor

elif event.type == 'WHEELDOWNMOUSE':
if event.alt and event.ctrl:
Expand All @@ -46,7 +47,7 @@ def modal(self, context, event):
elif event.ctrl:
self.thickness = max(0, self.thickness - thickness_factor)
else:
self.segments = max(3, self.segments - 1)
self.segments = max(3, self.segments - segment_factor)

elif event.type == 'LEFTMOUSE':
self.finish(context)
Expand Down Expand Up @@ -205,7 +206,7 @@ def draw_text_callback(self):
draw_property(
self,
"Segments: {}".format(self.segments),
"(±1)",
"(±2) | Shift (±1)",
active=(not self.key_ctrl and not self.key_alt),
alt_mode=False)

Expand Down

0 comments on commit 8dbece2

Please sign in to comment.