[#23035] Obj export crash

check for an active object before switching modes.
This commit is contained in:
Campbell Barton 2010-07-26 18:32:22 +00:00
parent ba49943d7e
commit 10b124ae39
5 changed files with 11 additions and 6 deletions

@ -941,7 +941,8 @@ def save_3ds(filename, context):
sce = context.scene
# sce= bpy.data.scenes.active
bpy.ops.object.mode_set(mode='OBJECT')
if context.object:
bpy.ops.object.mode_set(mode='OBJECT')
# Initialize the main chunk (primary):
primary = _3ds_chunk(PRIMARY)

@ -305,7 +305,8 @@ def write(filename, batch_objects = None, \
BATCH_OWN_DIR = False
):
bpy.ops.object.mode_set(mode='OBJECT')
if bpy.context.object:
bpy.ops.object.mode_set(mode='OBJECT')
# ----------------- Batch support!
if BATCH_ENABLE:

@ -823,7 +823,8 @@ def do_export(filepath, context,
orig_scene = context.scene
# Exit edit mode before exporting, so current object states are exported properly.
bpy.ops.object.mode_set(mode='OBJECT')
if context.object:
bpy.ops.object.mode_set(mode='OBJECT')
# if EXPORT_ALL_SCENES:
# export_scenes = bpy.data.scenes

@ -99,7 +99,8 @@ def write(filename, scene, ob, \
Window.WaitCursor(1)
"""
bpy.ops.object.mode_set(mode='OBJECT')
if scene.objects.active:
bpy.ops.object.mode_set(mode='OBJECT')
#mesh = BPyMesh.getMeshFromObject(ob, None, EXPORT_APPLY_MODIFIERS, False, scn) # XXX
if EXPORT_APPLY_MODIFIERS:

@ -1156,8 +1156,9 @@ def x3d_export(filename,
scene = context.scene
world = scene.world
bpy.ops.object.mode_set(mode='OBJECT')
if scene.objects.active:
bpy.ops.object.mode_set(mode='OBJECT')
# XXX these are global textures while .Get() returned only scene's?
alltextures = bpy.data.textures