From 23fbce5a5fc18f310abfc391654108c6bd7d12bc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Nov 2010 16:33:13 +0000 Subject: bugfix [#22615] Opening a blend file in python (bpy.ops.wm.open_mainfile() (r29489) [#22557] bpy.ops.wm.read_homefile() causes segfault (r29372) --- release/scripts/modules/bpy/ops.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'release/scripts/modules/bpy/ops.py') diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index c6bdc21afa6..23d82a98220 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -153,21 +153,24 @@ class bpy_ops_submodule_op(object): return self.module + "." + self.func def __call__(self, *args, **kw): + import bpy + context = bpy.context # Get the operator from blender + wm = context.window_manager + if args: C_dict, C_exec = __class__._parse_args(args) ret = op_call(self.idname_py(), C_dict, kw, C_exec) else: ret = op_call(self.idname_py(), None, kw) - if 'FINISHED' in ret: - import bpy - scene = bpy.context.scene - if scene: # None in backgroud mode + if 'FINISHED' in ret and context.window_manager == wm: + scene = context.scene + if scene: # None in backgroud mode scene.update() else: - for scene in bpy.data.scenes: + for scene in data.scenes: scene.update() return ret -- cgit v1.2.3