2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-06 23:25:53 +00:00

use SaveAs rather than Save for outputting .blend files

This commit is contained in:
Jack Andersen 2016-08-11 11:31:27 -10:00
parent 031daeb841
commit 48a4a51853

View File

@ -319,6 +319,8 @@ def dataout_loop():
for c in r: for c in r:
writepipebuf(struct.pack('f', c)) writepipebuf(struct.pack('f', c))
loaded_blend = None
# Main exception handling # Main exception handling
try: try:
# Command loop # Command loop
@ -333,6 +335,7 @@ try:
if 'FINISHED' in bpy.ops.wm.open_mainfile(filepath=cmdargs[1]): if 'FINISHED' in bpy.ops.wm.open_mainfile(filepath=cmdargs[1]):
if bpy.ops.object.mode_set.poll(): if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.object.mode_set(mode = 'OBJECT')
loaded_blend = cmdargs[1]
writepipeline(b'FINISHED') writepipeline(b'FINISHED')
else: else:
writepipeline(b'CANCELLED') writepipeline(b'CANCELLED')
@ -340,8 +343,10 @@ try:
elif cmdargs[0] == 'CREATE': elif cmdargs[0] == 'CREATE':
if len(cmdargs) >= 4: if len(cmdargs) >= 4:
bpy.ops.wm.open_mainfile(filepath=cmdargs[3]) bpy.ops.wm.open_mainfile(filepath=cmdargs[3])
loaded_blend = cmdargs[1]
else: else:
bpy.ops.wm.read_homefile() bpy.ops.wm.read_homefile()
loaded_blend = None
bpy.context.user_preferences.filepaths.save_version = 0 bpy.context.user_preferences.filepaths.save_version = 0
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]): if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]):
bpy.ops.file.hecl_patching_load() bpy.ops.file.hecl_patching_load()
@ -365,10 +370,11 @@ try:
elif cmdargs[0] == 'SAVE': elif cmdargs[0] == 'SAVE':
bpy.context.user_preferences.filepaths.save_version = 0 bpy.context.user_preferences.filepaths.save_version = 0
if 'FINISHED' in bpy.ops.wm.save_mainfile(check_existing=False, compress=True): if loaded_blend:
writepipeline(b'FINISHED') if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True):
else: writepipeline(b'FINISHED')
writepipeline(b'CANCELLED') else:
writepipeline(b'CANCELLED')
elif cmdargs[0] == 'PYBEGIN': elif cmdargs[0] == 'PYBEGIN':
writepipeline(b'READY') writepipeline(b'READY')