BGE: The WM_OT_blenderplayer_start addon now saves a copy of the current blendfile...
authorMitchell Stokes <mogurijin@gmail.com>
Thu, 29 Aug 2013 04:31:55 +0000 (04:31 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Thu, 29 Aug 2013 04:31:55 +0000 (04:31 +0000)
release/scripts/startup/bl_operators/wm.py

index c575b6dfdafe86ad805f674831670314cf8f4cc0..0b379d3852c41597c193308c4caa3b7bd94e56e5 100644 (file)
@@ -1286,9 +1286,10 @@ class WM_OT_blenderplayer_start(Operator):
             self.report({'ERROR'}, "Player path: %r not found" % player_path)
             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)
         subprocess.call([player_path, filepath])
+        os.unlink(filepath)
         return {'FINISHED'}