Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-05 04:11:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-05 04:11:39 +0400
commit8cf9e5f8c3904b3e46743c92c0275c4c54726866 (patch)
tree8b68b22d5d00df6f60b3c890c3b19b881d78be4d /release
parentebe29c3f8444f1ca8128ecc989f8f4af9bec5dac (diff)
change templates to call modal_handler_add() is called last since any errors between calling this function and returning will crash blender. see [#30687]
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/wm.py2
-rw-r--r--release/scripts/templates/operator_modal.py3
-rw-r--r--release/scripts/templates/operator_modal_draw.py3
-rw-r--r--release/scripts/templates/operator_modal_timer.py2
-rw-r--r--release/scripts/templates/operator_modal_view3d.py3
5 files changed, 6 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index ed4d5dd55f5..513277a2099 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -735,7 +735,7 @@ class WM_OT_context_modal_mouse(Operator):
if not self._values:
self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
- (self.data_path_iter, self.data_path_item))
+ (self.data_path_iter, self.data_path_item))
return {'CANCELLED'}
else:
diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py
index d8115bc95bf..88e5ee80590 100644
--- a/release/scripts/templates/operator_modal.py
+++ b/release/scripts/templates/operator_modal.py
@@ -26,9 +26,10 @@ class ModalOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.object:
- context.window_manager.modal_handler_add(self)
self.first_mouse_x = event.mouse_x
self.first_value = context.object.location.x
+
+ context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
else:
self.report({'WARNING'}, "No active object, could not finish")
diff --git a/release/scripts/templates/operator_modal_draw.py b/release/scripts/templates/operator_modal_draw.py
index f2d5ad8982b..f1c4e113b0a 100644
--- a/release/scripts/templates/operator_modal_draw.py
+++ b/release/scripts/templates/operator_modal_draw.py
@@ -53,14 +53,13 @@ class ModalDrawOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.area.type == 'VIEW_3D':
- context.window_manager.modal_handler_add(self)
-
# Add the region OpenGL drawing callback
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
self._handle = context.region.callback_add(draw_callback_px, (self, context), 'POST_PIXEL')
self.mouse_path = []
+ context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
else:
self.report({'WARNING'}, "View3D not found, cannot run operator")
diff --git a/release/scripts/templates/operator_modal_timer.py b/release/scripts/templates/operator_modal_timer.py
index 6d2ec95aedb..72c153df9d2 100644
--- a/release/scripts/templates/operator_modal_timer.py
+++ b/release/scripts/templates/operator_modal_timer.py
@@ -21,8 +21,8 @@ class ModalTimerOperator(bpy.types.Operator):
return {'PASS_THROUGH'}
def execute(self, context):
- context.window_manager.modal_handler_add(self)
self._timer = context.window_manager.event_timer_add(0.1, context.window)
+ context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
def cancel(self, context):
diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py
index 0babf169610..c870bbffdcf 100644
--- a/release/scripts/templates/operator_modal_view3d.py
+++ b/release/scripts/templates/operator_modal_view3d.py
@@ -45,14 +45,13 @@ class ViewOperator(bpy.types.Operator):
v3d = context.space_data
rv3d = v3d.region_3d
- context.window_manager.modal_handler_add(self)
-
if rv3d.view_perspective == 'CAMERA':
rv3d.view_perspective = 'PERSP'
self._initial_mouse = Vector((event.mouse_x, event.mouse_y, 0.0))
self._initial_location = rv3d.view_location.copy()
+ context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
else:
self.report({'WARNING'}, "Active space must be a View3d")