From 48a4a518538f206f6ba665dc7a99e04c971af8b0 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 11 Aug 2016 11:31:27 -1000 Subject: [PATCH] use SaveAs rather than Save for outputting .blend files --- hecl/blender/hecl_blendershell.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/hecl/blender/hecl_blendershell.py b/hecl/blender/hecl_blendershell.py index 49d0dd997..06303304d 100644 --- a/hecl/blender/hecl_blendershell.py +++ b/hecl/blender/hecl_blendershell.py @@ -319,6 +319,8 @@ def dataout_loop(): for c in r: writepipebuf(struct.pack('f', c)) +loaded_blend = None + # Main exception handling try: # Command loop @@ -333,6 +335,7 @@ try: if 'FINISHED' in bpy.ops.wm.open_mainfile(filepath=cmdargs[1]): if bpy.ops.object.mode_set.poll(): bpy.ops.object.mode_set(mode = 'OBJECT') + loaded_blend = cmdargs[1] writepipeline(b'FINISHED') else: writepipeline(b'CANCELLED') @@ -340,8 +343,10 @@ try: elif cmdargs[0] == 'CREATE': if len(cmdargs) >= 4: bpy.ops.wm.open_mainfile(filepath=cmdargs[3]) + loaded_blend = cmdargs[1] else: bpy.ops.wm.read_homefile() + loaded_blend = None bpy.context.user_preferences.filepaths.save_version = 0 if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=cmdargs[1]): bpy.ops.file.hecl_patching_load() @@ -365,10 +370,11 @@ try: elif cmdargs[0] == 'SAVE': bpy.context.user_preferences.filepaths.save_version = 0 - if 'FINISHED' in bpy.ops.wm.save_mainfile(check_existing=False, compress=True): - writepipeline(b'FINISHED') - else: - writepipeline(b'CANCELLED') + if loaded_blend: + if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True): + writepipeline(b'FINISHED') + else: + writepipeline(b'CANCELLED') elif cmdargs[0] == 'PYBEGIN': writepipeline(b'READY')