diff options
author | Shrinivas Kulkarni <shrinivk@gmail.com> | 2020-10-01 10:18:25 +0300 |
---|---|---|
committer | Shrinivas Kulkarni <shrinivk@gmail.com> | 2020-10-01 10:18:25 +0300 |
commit | 861eb3e249aef55337bf437edb2220e6cb1865e5 (patch) | |
tree | 72d9606d75a3563c391ef6f6f106bd5e2baecd4c | |
parent | 351de35b968e5a49789851c3c90559dbe8afa5cd (diff) |
curve_assign_shapekey: 1) Changed call to space.overlay.show_curve_handles to space.overlay.display_handle as per the API change in 2.90 2) Removed redundant call to shader.bind 3) Removed redundant modal handlers in ModalMarkSegStartOp
-rw-r--r-- | curve_assign_shapekey.py | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/curve_assign_shapekey.py b/curve_assign_shapekey.py index 18e34c0c..643eb3a2 100644 --- a/curve_assign_shapekey.py +++ b/curve_assign_shapekey.py @@ -855,7 +855,7 @@ class MarkerController: def __init__(self, context): self.smMap = self.createSMMap(context) self.shader = gpu.shader.from_builtin('3D_FLAT_COLOR') - self.shader.bind() + # self.shader.bind() MarkerController.drawHandlerRef = \ bpy.types.SpaceView3D.draw_handler_add(self.drawHandler, \ @@ -926,14 +926,21 @@ class MarkerController: states = [] spaces = MarkerController.getSpaces3D(context) for s in spaces: - states.append(s.overlay.show_curve_handles) - s.overlay.show_curve_handles = False + if(hasattr(s.overlay, 'show_curve_handles')): + states.append(s.overlay.show_curve_handles) + s.overlay.show_curve_handles = False + elif(hasattr(s.overlay, 'display_handle')): # 2.90 + states.append(s.overlay.display_handle) + s.overlay.display_handle = 'NONE' return states def resetShowHandleState(context, handleStates): spaces = MarkerController.getSpaces3D(context) for i, s in enumerate(spaces): - s.overlay.show_curve_handles = handleStates[i] + if(hasattr(s.overlay, 'show_curve_handles')): + s.overlay.show_curve_handles = handleStates[i] + elif(hasattr(s.overlay, 'display_handle')): # 2.90 + s.overlay.display_handle = handleStates[i] class ModalMarkSegStartOp(Operator): @@ -965,25 +972,12 @@ class ModalMarkSegStartOp(Operator): self.markerState.updateSMMap() self.markerState.createBatch(context) - elif(event.type in {'LEFT_CTRL', 'RIGHT_CTRL'}): - self.ctrl = (event.value == 'PRESS') - - elif(event.type in {'LEFT_SHIFT', 'RIGHT_SHIFT'}): - self.shift = (event.value == 'PRESS') - - if(event.type not in {"MIDDLEMOUSE", "TAB", "LEFTMOUSE", \ - "RIGHTMOUSE", 'WHEELDOWNMOUSE', 'WHEELUPMOUSE'} and \ - not event.type.startswith("NUMPAD_")): - return {'RUNNING_MODAL'} - return {"PASS_THROUGH"} def execute(self, context): #TODO: Why such small step? self._timer = context.window_manager.event_timer_add(time_step = 0.0001, \ window = context.window) - self.ctrl = False - self.shift = False context.window_manager.modal_handler_add(self) self.markerState = MarkerController(context) |