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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-15 19:20:53 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-15 19:20:53 +0300
commitdab66a8e1dcc8f152309d3f6763c553bfa08ceae (patch)
treedfde6ae69cbbedba8c9a1bbf2b1ffef5ab526ec8 /io_scene_fbx/export_fbx_bin.py
parent63d378be70bafe6820ee852f342aa77167f1a0b6 (diff)
Don't use context.active_object
This can fail in some cases (batch converting for example).
Diffstat (limited to 'io_scene_fbx/export_fbx_bin.py')
-rw-r--r--io_scene_fbx/export_fbx_bin.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index fc34ea31..871c198f 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -3030,9 +3030,11 @@ def save(operator, context,
ret = None
+ active_object = context.scene.objects.active
+
org_mode = None
- if context.active_object and context.active_object.mode != 'OBJECT' and bpy.ops.object.mode_set.poll():
- org_mode = context.active_object.mode
+ if active_object and active_object.mode != 'OBJECT' and bpy.ops.object.mode_set.poll():
+ org_mode = active_object.mode
bpy.ops.object.mode_set(mode='OBJECT')
if batch_mode == 'OFF':
@@ -3119,7 +3121,7 @@ def save(operator, context,
ret = {'FINISHED'} # so the script wont run after we have batch exported.
- if context.active_object and org_mode and bpy.ops.object.mode_set.poll():
+ if active_object and org_mode and bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode=org_mode)
return ret