[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36991] branches/soc-2011-cucumber/release /scripts/startup: ==UI==

Daniel Stokes kupomail at gmail.com
Sun May 29 04:40:38 CEST 2011


Revision: 36991
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36991
Author:   kupoman
Date:     2011-05-29 02:40:37 +0000 (Sun, 29 May 2011)
Log Message:
-----------
==UI==
* Made some options available in Blender Game that were only available in Blender Render (camera resolution, animation fps)
* Created a panel for the embedded player
* Renamed the FPS option for the standalone player to Refresh Rate
* Moved framing options to display
* Made a button to launch the blender player from within blender (only tested on windows for now)

Modified Paths:
--------------
    branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py
    branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
    branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_particle.py

Property Changed:
----------------
    branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py

Modified: branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py
===================================================================
--- branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py	2011-05-29 00:56:42 UTC (rev 36990)
+++ branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py	2011-05-29 02:40:37 UTC (rev 36991)
@@ -22,7 +22,10 @@
 from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty
 from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
 
+import subprocess
+import os
 
+
 class MESH_OT_delete_edgeloop(bpy.types.Operator):
     '''Delete an edge loop by merging the faces on each side to a single face loop'''
     bl_idname = "mesh.delete_edgeloop"
@@ -949,7 +952,25 @@
 
         return {'CANCELLED'}
 
+class WM_OT_blenderplayer_start(bpy.types.Operator):
+    '''Launches the Blenderplayer with the current blendfile'''
+    bl_idname = "wm.blenderplayer_start"
+    bl_label = "Start"
+    
+    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):
+        print("Launching Blenderplayer!")
+        print("Blend file: %s" % bpy.app.tempdir + "game.blend")
+        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'}
 
+
 def _webbrowser_bug_fix():
     # test for X11
     import os

Modified: branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
===================================================================
--- branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py	2011-05-29 00:56:42 UTC (rev 36990)
+++ branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py	2011-05-29 02:40:37 UTC (rev 36991)
@@ -206,18 +206,46 @@
         return (rd.engine in cls.COMPAT_ENGINES)
 
 
-class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
-    bl_label = "Game"
+# class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
+    # bl_label = "Game"
+    # COMPAT_ENGINES = {'BLENDER_GAME'}
+
+    # def draw(self, context):
+        # layout = self.layout
+
+        # row = layout.row()
+        # row.operator("view3d.game_start", text="Start")
+        # row.label()
+        
+class RENDER_PT_embedded(RenderButtonsPanel, bpy.types.Panel):
+    bl_label = "Embedded Player"
     COMPAT_ENGINES = {'BLENDER_GAME'}
-
+    
     def draw(self, context):
         layout = self.layout
+        
+        rd = context.scene.render
 
         row = layout.row()
         row.operator("view3d.game_start", text="Start")
         row.label()
+        row = layout.row()
+        row.label(text="Resolution:")
+        row = layout.row(align=True)
+        row.prop(rd, "resolution_x", slider=False, text="X")
+        row.prop(rd, "resolution_y", slider=False, text="Y")
 
+        # split = layout.split()
 
+        # split.label(text="Resolution:")
+        # col = split.column()
+        # sub = col.column(align=True)
+        # sub.prop(rd, "resolution_x", slider=False, text="X")
+        # col = split.column()
+        # sub = col.column(align=True)
+        # sub.prop(rd, "resolution_y", slider=False, text="Y")
+
+
 class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Standalone Player"
     COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -226,31 +254,41 @@
         layout = self.layout
 
         gs = context.scene.game_settings
+        
+        row = layout.row()
+        row.operator("wm.blenderplayer_start", text="Start")
+        row.prop(gs, "show_fullscreen")
+        
+        row = layout.row()
+        row.label(text="Resolution:")
+        row = layout.row(align=True)
+        row.prop(gs, "resolution_x", slider=False, text="X")
+        row.prop(gs, "resolution_y", slider=False, text="Y")
+        
+        col = layout.column()
+        col.label(text="Quality:")
+        col = layout.column(align=True)
+        col.prop(gs, "depth", text="Bit Depth", slider=False)
+        col.prop(gs, "frequency", text="Refresh Rate", slider=False)
 
-        layout.prop(gs, "show_fullscreen")
+        # row = layout.row()
+        # row.label()
+        
+        # split = layout.split()
 
-        split = layout.split()
+        # col = split.column()
+        # col.label(text="Resolution:")
+        # sub = col.column(align=True)
+        # sub.prop(gs, "resolution_x", slider=False, text="X")
+        # sub.prop(gs, "resolution_y", slider=False, text="Y")
 
-        col = split.column()
-        col.label(text="Resolution:")
-        sub = col.column(align=True)
-        sub.prop(gs, "resolution_x", slider=False, text="X")
-        sub.prop(gs, "resolution_y", slider=False, text="Y")
+        # col = split.column()
+        # col.label(text="Quality:")
+        # sub = col.column(align=True)
+        # sub.prop(gs, "depth", text="Bit Depth", slider=False)
+        # sub.prop(gs, "frequency", text="Refresh Rate", slider=False)
 
-        col = split.column()
-        col.label(text="Quality:")
-        sub = col.column(align=True)
-        sub.prop(gs, "depth", text="Bit Depth", slider=False)
-        sub.prop(gs, "frequency", text="FPS", slider=False)
 
-        # framing:
-        col = layout.column()
-        col.label(text="Framing:")
-        col.row().prop(gs, "frame_type", expand=True)
-        if gs.frame_type == 'LETTERBOX':
-            col.prop(gs, "frame_color", text="")
-
-
 class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Stereo"
     COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -350,7 +388,10 @@
 
     def draw(self, context):
         layout = self.layout
-
+        
+        row = layout.row()
+        row.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
+        
         gs = context.scene.game_settings
         flow = layout.column_flow()
         flow.prop(gs, "show_debug_properties", text="Debug Properties")
@@ -359,7 +400,14 @@
         flow.prop(gs, "use_deprecation_warnings")
         flow.prop(gs, "show_mouse", text="Mouse Cursor")
 
+        # framing:
+        col = layout.column()
+        col.label(text="Framing:")
+        col.row().prop(gs, "frame_type", expand=True)
+        if gs.frame_type == 'LETTERBOX':
+            col.prop(gs, "frame_color", text="")
 
+
 class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Sound"
     COMPAT_ENGINES = {'BLENDER_GAME'}
@@ -371,8 +419,9 @@
 
         layout.prop(scene, "audio_distance_model")
 
-        layout.prop(scene, "audio_doppler_speed", text="Speed")
-        layout.prop(scene, "audio_doppler_factor")
+        col = layout.column(align=True)
+        col.prop(scene, "audio_doppler_speed", text="Speed")
+        col.prop(scene, "audio_doppler_factor")
 
 
 class WorldButtonsPanel():


Property changes on: branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_particle.py
===================================================================
--- branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_particle.py	2011-05-29 00:56:42 UTC (rev 36990)
+++ branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_particle.py	2011-05-29 02:40:37 UTC (rev 36991)
@@ -66,7 +66,6 @@
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "particle"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
@@ -76,15 +75,21 @@
 class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
+    # COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
         engine = context.scene.render.engine
-        return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
+        return (context.particle_system or context.object or context.space_data.pin_id)# and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
+        
+        if context.scene.render.engine == "BLENDER_GAME":
+            layout.label("The Blender particle system is")
+            layout.label("not available for use in the")
+            layout.label("Blender Game Engine")
+            return
 
         ob = context.object
         psys = context.particle_system




More information about the Bf-blender-cvs mailing list