Skip to content

Commit

Permalink
fix: ensure cancel keybind cancels all operators, particularily while…
Browse files Browse the repository at this point in the history
… in halt mode
  • Loading branch information
tristan-hm committed Feb 6, 2022
1 parent 26a14c6 commit 126ec13
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 76 deletions.
15 changes: 8 additions & 7 deletions generators/ring_and_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand Down Expand Up @@ -64,11 +70,6 @@ def modal(self, context, event):

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions generators/screw_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand Down Expand Up @@ -67,11 +73,6 @@ def modal(self, context, event):

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions power_mods/screw.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand Down Expand Up @@ -68,11 +74,6 @@ def modal(self, context, event):

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions power_mods/solidify.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand Down Expand Up @@ -61,11 +67,6 @@ def modal(self, context, event):

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions power_mods/weighted_normal_bevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand All @@ -44,11 +50,6 @@ def modal(self, context, event):

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
28 changes: 8 additions & 20 deletions sketching/blank_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,24 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_confirm_alternative:
self.finish(context)

return {'FINISHED'}

# Pass through useful common vertex manipulation shortcuts //...

elif self.key_shift and event.type == 'D' and event.value == 'PRESS':
return {'PASS_THROUGH'}

elif event.alt and event.type == 'Z' and event.value == 'PRESS':
return {'PASS_THROUGH'}

elif event.type in {'LEFTMOUSE', 'E', 'G', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'} or event.ctrl:
return {'PASS_THROUGH'}

# ...//

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions sketching/geo_lift.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.clean_up(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_confirm:
Expand All @@ -31,11 +37,6 @@ def modal(self, context, event):
elif self.key_confirm_alternative:
return self.finish(context)

elif self.key_cancel:
self.clean_up(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down
15 changes: 8 additions & 7 deletions sketching/vertex_bevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_increase_factor:
Expand Down Expand Up @@ -60,11 +66,6 @@ def modal(self, context, event):
self.finish(context)

return {'FINISHED'}

elif self.key_cancel:
self.revert(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}
Expand Down
15 changes: 8 additions & 7 deletions sketching/view_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ def modal(self, context, event):
if self.key_toggle_operator_passthrough:
toggle_operator_passthrough(self)

if self.key_toggle_pin_overlay:
elif self.key_toggle_pin_overlay:
toggle_pin_overlay(self)

if self.operator_passthrough:
elif self.key_cancel:
self.clean_up(context)

return {'CANCELLED'}

elif self.operator_passthrough:
self.update_overlay_wrapper(context, event)

return {'PASS_THROUGH'}

elif self.key_step_up:
Expand Down Expand Up @@ -54,11 +60,6 @@ def modal(self, context, event):
elif self.key_confirm_alternative:
return self.finish(context)

elif self.key_cancel:
self.clean_up(context)

return {'CANCELLED'}

elif self.key_movement_passthrough:
return {'PASS_THROUGH'}

Expand Down

0 comments on commit 126ec13

Please sign in to comment.