diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-23 21:52:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-23 21:52:20 +0400 |
commit | 4a04f7206914a49f5f95adc5eb786237f1a9f547 (patch) | |
tree | 78aed2fa481f972fac0965f814bebebe9d71ae65 /release/scripts/startup/bl_operators/wm.py | |
parent | f1cea89d99f0c80bdccd2ba1359142b5ff14cdb9 (diff) |
remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n
Diffstat (limited to 'release/scripts/startup/bl_operators/wm.py')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index a539e2693c1..1e469275e77 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1179,7 +1179,31 @@ class WM_OT_copy_prev_settings(Operator): return {'CANCELLED'} +class WM_OT_blenderplayer_start(Operator): + '''Launches the Blenderplayer with the current blendfile''' + bl_idname = "wm.blenderplayer_start" + bl_label = "Start" + + import os + blender_bin_path = bpy.app.binary_path + blender_bin_dir = os.path.dirname(blender_bin_path) + ext = os.path.splitext(blender_bin_path)[-1] + player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext) + + def execute(self, context): + import sys + import subprocess + import os + + if sys.platform == 'darwin': + self.player_path = os.path.join(self.blender_bin_dir, '../../../blenderplayer.app/Contents/MacOS/blenderplayer') + + filepath = bpy.app.tempdir + "game.blend" + bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True) + subprocess.call([self.player_path, filepath]) + return {'FINISHED'} + class WM_OT_keyconfig_test(Operator): "Test keyconfig for conflicts" bl_idname = "wm.keyconfig_test" @@ -1451,7 +1475,7 @@ class WM_OT_operator_cheat_sheet(Operator): class WM_OT_addon_enable(Operator): "Enable an addon" bl_idname = "wm.addon_enable" - bl_label = "Enable Add-On" + bl_label = "Enable Addon" module = StringProperty( name="Module", @@ -1482,7 +1506,7 @@ class WM_OT_addon_enable(Operator): class WM_OT_addon_disable(Operator): "Disable an addon" bl_idname = "wm.addon_disable" - bl_label = "Disable Add-On" + bl_label = "Disable Addon" module = StringProperty( name="Module", @@ -1499,7 +1523,7 @@ class WM_OT_addon_disable(Operator): class WM_OT_addon_install(Operator): "Install an addon" bl_idname = "wm.addon_install" - bl_label = "Install Add-On..." + bl_label = "Install Addon..." overwrite = BoolProperty( name="Overwrite", @@ -1667,7 +1691,7 @@ class WM_OT_addon_install(Operator): class WM_OT_addon_remove(Operator): "Disable an addon" bl_idname = "wm.addon_remove" - bl_label = "Remove Add-On" + bl_label = "Remove Addon" module = StringProperty( name="Module", @@ -1722,7 +1746,7 @@ class WM_OT_addon_remove(Operator): class WM_OT_addon_expand(Operator): - "Display more information on this add-on" + "Display more information on this addon" bl_idname = "wm.addon_expand" bl_label = "" |