[#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,6 +941,7 @@ def save_3ds(filename, context):
sce = context.scene sce = context.scene
# sce= bpy.data.scenes.active # sce= bpy.data.scenes.active
if context.object:
bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.object.mode_set(mode='OBJECT')
# Initialize the main chunk (primary): # Initialize the main chunk (primary):

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

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

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

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