forked from bartvdbraak/blender
BGE: The WM_OT_blenderplayer_start addon now saves a copy of the current blendfile with a trailing '~' to keep paths intact. An unsaved file will still go to the tmp directory. This file is deleted when the blenderplayer process exits.
This commit is contained in:
parent
567e13b2bb
commit
dea537fd68
@ -1286,9 +1286,10 @@ class WM_OT_blenderplayer_start(Operator):
|
|||||||
self.report({'ERROR'}, "Player path: %r not found" % player_path)
|
self.report({'ERROR'}, "Player path: %r not found" % player_path)
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
filepath = os.path.join(bpy.app.tempdir, "game.blend")
|
filepath = bpy.data.filepath+'~' if bpy.data.is_saved else os.path.join(bpy.app.tempdir, "game.blend")
|
||||||
bpy.ops.wm.save_as_mainfile('EXEC_DEFAULT', filepath=filepath, copy=True)
|
bpy.ops.wm.save_as_mainfile('EXEC_DEFAULT', filepath=filepath, copy=True)
|
||||||
subprocess.call([player_path, filepath])
|
subprocess.call([player_path, filepath])
|
||||||
|
os.unlink(filepath)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user