Fix restoring area type
This commit is contained in:
parent
a2e9c2ffe1
commit
f734f01c21
@ -587,10 +587,14 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
TIMbpp = 4
|
TIMbpp = 4
|
||||||
TIMshift = 2
|
TIMshift = 2
|
||||||
# Set context area to 3d view
|
# Set context area to 3d view
|
||||||
|
previousAreaType = 0
|
||||||
|
if bpy.context.object.mode != 'OBJECT' :
|
||||||
previousAreaType = bpy.context.area.type
|
previousAreaType = bpy.context.area.type
|
||||||
bpy.context.area.type="VIEW_3D"
|
bpy.context.area.type="VIEW_3D"
|
||||||
# Leave edit mode to avoid errors
|
# Leave edit mode to avoid errors
|
||||||
bpy.ops.object.mode_set(mode='OBJECT')
|
bpy.ops.object.mode_set(mode='OBJECT')
|
||||||
|
# restore previous area type
|
||||||
|
bpy.context.area.type = previousAreaType
|
||||||
# If set, triangulate objects of type mesh
|
# If set, triangulate objects of type mesh
|
||||||
if self.exp_Triangulate:
|
if self.exp_Triangulate:
|
||||||
for o in range(len(bpy.data.objects)):
|
for o in range(len(bpy.data.objects)):
|
||||||
@ -1939,8 +1943,6 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
for symbol in level_symbols:
|
for symbol in level_symbols:
|
||||||
h.write( "extern " + symbol + ";\n")
|
h.write( "extern " + symbol + ";\n")
|
||||||
h.close()
|
h.close()
|
||||||
# Restore previous area type
|
|
||||||
bpy.context.area.type = previousAreaType
|
|
||||||
return {'FINISHED'};
|
return {'FINISHED'};
|
||||||
def menu_func(self, context):
|
def menu_func(self, context):
|
||||||
self.layout.operator(ExportMyFormat.bl_idname, text="PSX Format(.c)");
|
self.layout.operator(ExportMyFormat.bl_idname, text="PSX Format(.c)");
|
||||||
|
Loading…
Reference in New Issue
Block a user