minor changes to templates\13
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Oct 2013 00:25:15 +0000 (00:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Oct 2013 00:25:15 +0000 (00:25 +0000)
release/scripts/templates_py/operator_mesh_uv.py [moved from release/scripts/templates_py/operator_uv.py with 100% similarity]
release/scripts/templates_py/operator_modal_timer.py

index 3088d59fbcfe8bc5cb4ee62f9997a57ac49c4cd7..b8211126dafed8e177d7830a831a01d9684e04ce 100644 (file)
@@ -9,7 +9,7 @@ class ModalTimerOperator(bpy.types.Operator):
     _timer = None
 
     def modal(self, context, event):
     _timer = None
 
     def modal(self, context, event):
-        if event.type == 'ESC':
+        if event.type in {'RIGHTMOUSE', 'ESC'}:
             return self.cancel(context)
 
         if event.type == 'TIMER':
             return self.cancel(context)
 
         if event.type == 'TIMER':
@@ -21,12 +21,14 @@ class ModalTimerOperator(bpy.types.Operator):
         return {'PASS_THROUGH'}
 
     def execute(self, context):
         return {'PASS_THROUGH'}
 
     def execute(self, context):
-        self._timer = context.window_manager.event_timer_add(0.1, context.window)
-        context.window_manager.modal_handler_add(self)
+        wm = context.window_manager
+        self._timer = wm.event_timer_add(0.1, context.window)
+        wm.modal_handler_add(self)
         return {'RUNNING_MODAL'}
 
     def cancel(self, context):
         return {'RUNNING_MODAL'}
 
     def cancel(self, context):
-        context.window_manager.event_timer_remove(self._timer)
+        wm = context.window_manager
+        wm.event_timer_remove(self._timer)
         return {'CANCELLED'}
 
 
         return {'CANCELLED'}