diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-02-15 19:20:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-02-15 19:20:53 +0300 |
commit | dab66a8e1dcc8f152309d3f6763c553bfa08ceae (patch) | |
tree | dfde6ae69cbbedba8c9a1bbf2b1ffef5ab526ec8 /io_scene_fbx/export_fbx_bin.py | |
parent | 63d378be70bafe6820ee852f342aa77167f1a0b6 (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.py | 8 |
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 |