BGE panels: wip
authorDalai Felinto <dfelinto@gmail.com>
Mon, 20 Jul 2009 20:28:29 +0000 (20:28 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Mon, 20 Jul 2009 20:28:29 +0000 (20:28 +0000)
Logic Panel:
- world settings (moved from world)
 ... that includes physic engine selection + gravity
- game player (from gamesettings, it wasn't wrapped)
- stereo/dome (from gamesettings, it wasn't wrapped)
 ... separated stereom into stereoflag and stereomode
- properties
 ... (didn't touch it)

Buttons Game Panel:
(wip panel)
- Physics (moved from Logic Panel)
 ... it will be a datablock in the future (right Campbell ?)
- Material Physics (not currently implemented)
 ... a datablock link to the materials of an object + the dynamic physic variables

* NOTE:
in readfile.c::do_version I couldn't do if(scene->world). There is something wrong with scenes with an unlinked world. So so far we are ignoring the old values....

19 files changed:
release/ui/buttons_game.py [new file with mode: 0644]
release/ui/buttons_world.py
release/ui/space_logic.py
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/world.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_buttons/space_buttons.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_world.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

diff --git a/release/ui/buttons_game.py b/release/ui/buttons_game.py
new file mode 100644 (file)
index 0000000..01937ca
--- /dev/null
@@ -0,0 +1,118 @@
+
+import bpy
+class GameButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "game"
+
+class GAME_PT_context_game(GameButtonsPanel):
+       __idname__ = "GAME_PT_context_game"
+       __no_header__ = True
+
+       def draw(self, context):
+               layout = self.layout
+               ob = context.object
+               game = context.game
+
+               split = layout.split(percentage=0.06)
+               split.itemL(text="", icon="ICON_GAME")
+               split.itemR(game, "name", text="")
+
+class GAME_PT_data(GameButtonsPanel):
+       __idname__ = "GAME_PT_data"
+       __label__ = "Data"
+
+       def draw(self, context):
+               layout = self.layout
+               ob = context.object
+               game = context.game
+
+class GAME_PT_physics(GameButtonsPanel):
+       __idname__ = "GAME_PT_physics"
+       __label__ = "Physics"
+
+       def poll(self, context):
+               ob = context.active_object
+               return ob and ob.game
+
+       def draw(self, context):
+               layout = self.layout
+               ob = context.active_object
+               
+               game = ob.game
+
+               flow = layout.column_flow()
+               flow.active = True
+               flow.itemR(game, "physics_type")
+               flow.itemR(game, "actor")
+               
+               row = layout.row()
+               row.itemR(game, "ghost")
+               row.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
+               
+               flow = layout.column_flow()
+               flow.itemR(game, "mass")
+               flow.itemR(game, "radius")
+               flow.itemR(game, "no_sleeping")
+               flow.itemR(game, "damping")
+               flow.itemR(game, "rotation_damping")
+               flow.itemR(game, "minimum_velocity")
+               flow.itemR(game, "maximum_velocity")
+               
+               row = layout.row()
+               row.itemR(game, "do_fh")
+               row.itemR(game, "rotation_fh")
+               
+               flow = layout.column_flow()
+               flow.itemR(game, "form_factor")
+               flow.itemR(game, "anisotropic_friction")
+               
+               flow = layout.column_flow()
+               flow.active = game.anisotropic_friction
+               flow.itemR(game, "friction_coefficients")
+               
+               split = layout.split()
+               sub = split.column()
+               sub.itemR(game, "lock_x_axis")
+               sub.itemR(game, "lock_y_axis")
+               sub.itemR(game, "lock_z_axis")
+               sub = split.column()
+               sub.itemR(game, "lock_x_rot_axis")
+               sub.itemR(game, "lock_y_rot_axis")
+               sub.itemR(game, "lock_z_rot_axis")
+
+
+class GAME_PT_collision_bounds(GameButtonsPanel):
+       __idname__ = "GAME_PT_collision_bounds"
+       __label__ = "Collision Bounds"
+
+       def poll(self, context):
+               ob = context.active_object
+               return ob and ob.game
+       
+       def draw_header(self, context):
+               layout = self.layout
+               ob = context.active_object
+               game = ob.game
+
+               layout.itemR(game, "use_collision_bounds", text="")
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               ob = context.scene.objects[0]
+               game = ob.game
+               
+               flow = layout.column_flow()
+               flow.active = game.use_collision_bounds
+               flow.itemR(game, "collision_bounds")
+               flow.itemR(game, "collision_compound")
+               flow.itemR(game, "collision_margin")
+
+
+
+bpy.types.register(GAME_PT_context_game)
+bpy.types.register(GAME_PT_data)
+bpy.types.register(GAME_PT_physics)
+bpy.types.register(GAME_PT_collision_bounds)
\ No newline at end of file
index 0f16c847c5d9179e68ad45e60db51c8720e4a65c..6e233f86765214890627f0293f453d4216e711a9 100644 (file)
@@ -175,26 +175,6 @@ class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
                col.row().itemR(ao, "blend_mode", expand=True)
                col.row().itemR(ao, "color", expand=True)
                col.itemR(ao, "energy")
-               
-class WORLD_PT_game(WorldButtonsPanel):
-       __label__ = "Game Settings"
-
-       def draw(self, context):
-               layout = self.layout
-               world = context.world
-               
-               flow = layout.column_flow()
-               flow.itemR(world, "physics_engine")
-               flow.itemR(world, "physics_gravity")
-               
-               flow.itemR(world, "game_fps")
-               flow.itemR(world, "game_logic_step_max")
-               flow.itemR(world, "game_physics_substep")
-               flow.itemR(world, "game_physics_step_max")
-               
-               flow.itemR(world, "game_use_occlusion_culling", text="Enable Occlusion Culling")
-               flow.itemR(world, "game_occlusion_culling_resolution")
-               
 
 bpy.types.register(WORLD_PT_context_world)     
 bpy.types.register(WORLD_PT_preview)
@@ -203,4 +183,3 @@ bpy.types.register(WORLD_PT_ambient_occlusion)
 bpy.types.register(WORLD_PT_mist)
 bpy.types.register(WORLD_PT_stars)
 bpy.types.register(WORLD_PT_color_correction)
-bpy.types.register(WORLD_PT_game)
index bb7f22c7c5e669c69bdfb95023fb4a57b621a61b..5f56c0e4537b750cfa3c23b0896aeb3f79b9f1f4 100644 (file)
@@ -1,9 +1,9 @@
 import bpy
 
-class LOGIC_PT_physics(bpy.types.Panel):
+class LOGIC_PT_properties(bpy.types.Panel):
        __space_type__ = "LOGIC_EDITOR"
        __region_type__ = "UI"
-       __label__ = "Physics"
+       __label__ = "Properties"
 
        def poll(self, context):
                ob = context.active_object
@@ -12,100 +12,168 @@ class LOGIC_PT_physics(bpy.types.Panel):
        def draw(self, context):
                layout = self.layout
                ob = context.active_object
-               
                game = ob.game
-
-               flow = layout.column_flow()
-               flow.active = True
-               flow.itemR(game, "physics_type")
-               flow.itemR(game, "actor")
-               
-               row = layout.row()
-               row.itemR(game, "ghost")
-               row.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
-               
-               flow = layout.column_flow()
-               flow.itemR(game, "mass")
-               flow.itemR(game, "radius")
-               flow.itemR(game, "no_sleeping")
-               flow.itemR(game, "damping")
-               flow.itemR(game, "rotation_damping")
-               flow.itemR(game, "minimum_velocity")
-               flow.itemR(game, "maximum_velocity")
                
-               row = layout.row()
-               row.itemR(game, "do_fh")
-               row.itemR(game, "rotation_fh")
+               for prop in game.properties:
+                       flow = layout.row()
+                       flow.itemR(prop, "name", text="")
+                       flow.itemR(prop, "type", text="")
+                       flow.itemR(prop, "value", text="") # we dont care about the type. rna will display correctly
+                       flow.itemR(prop, "debug")
+
+"""
+class WORLD_PT_game(WorldButtonsPanel):
+       __space_type__ = "LOGIC_EDITOR"
+       __region_type__ = "UI"
+       __label__ = "Game Settings"
+
+       def draw(self, context):
+               layout = self.layout
+               world = context.world
                
                flow = layout.column_flow()
-               flow.itemR(game, "form_factor")
-               flow.itemR(game, "anisotropic_friction")
+               flow.itemR(world, "physics_engine")
+               flow.itemR(world, "physics_gravity")
                
-               flow = layout.column_flow()
-               flow.active = game.anisotropic_friction
-               flow.itemR(game, "friction_coefficients")
+               flow.itemR(world, "game_fps")
+               flow.itemR(world, "game_logic_step_max")
+               flow.itemR(world, "game_physics_substep")
+               flow.itemR(world, "game_physics_step_max")
                
+               flow.itemR(world, "game_use_occlusion_culling", text="Enable Occlusion Culling")
+               flow.itemR(world, "game_occlusion_culling_resolution")
+"""
+class LOGIC_PT_player(bpy.types.Panel):
+       __space_type__ = "LOGIC_EDITOR"
+       __region_type__ = "UI"
+       __label__ = "Game Player"
+
+       def draw(self, context):
+               layout = self.layout
+               gs = context.scene.game_data
+               row = layout.row()
+               row.itemR(gs, "fullscreen")
+
                split = layout.split()
-               sub = split.column()
-               sub.itemR(game, "lock_x_axis")
-               sub.itemR(game, "lock_y_axis")
-               sub.itemR(game, "lock_z_axis")
-               sub = split.column()
-               sub.itemR(game, "lock_x_rot_axis")
-               sub.itemR(game, "lock_y_rot_axis")
-               sub.itemR(game, "lock_z_rot_axis")
+               col = split.column(align=True)
+               col.itemR(gs, "resolution_x", slider=False, text="Res. X")
+               col.itemR(gs, "resolution_y", slider=False, text="Res. Y")
+
+               col = split.column(align=True)
+               col.itemR(gs, "depth", slider=False)
+               col.itemR(gs, "frequency", slider=False)
+               
 
+               # framing:
+               col = layout.column()
+               col.itemL(text="Framing Options:")
+               col.row().itemR(gs, "framing_type", expand=True)
 
-class LOGIC_PT_collision_bounds(bpy.types.Panel):
+               colsub = col.column()
+               colsub.itemR(gs, "framing_color", text="")
+
+class LOGIC_PT_stereo(bpy.types.Panel):
        __space_type__ = "LOGIC_EDITOR"
        __region_type__ = "UI"
-       __label__ = "Collision Bounds"
-
-       def poll(self, context):
-               ob = context.active_object
-               return ob and ob.game
-       
-       def draw_header(self, context):
-               layout = self.layout
-               ob = context.active_object
-               game = ob.game
+       __label__ = "Stereo and Dome"
 
-               layout.itemR(game, "use_collision_bounds", text="")
-       
        def draw(self, context):
                layout = self.layout
-               
-               ob = context.active_object
-               game = ob.game
-               
-               flow = layout.column_flow()
-               flow.active = game.use_collision_bounds
-               flow.itemR(game, "collision_bounds")
-               flow.itemR(game, "collision_compound")
-               flow.itemR(game, "collision_margin")
+               gs = context.scene.game_data
 
-class LOGIC_PT_properties(bpy.types.Panel):
+
+               # stereo options:
+               col= layout.column()
+               col.itemL(text="Stereo Options:")
+               row = col.row()
+               row.itemR(gs, "stereo", expand=True)
+               stereo_mode = gs.stereo
+
+               # stereo:
+               if stereo_mode == 'STEREO':
+                       col = layout.column(align=True)
+                       row = col.row()
+                       row.item_enumR(gs, "stereo_mode", "QUADBUFFERED")
+                       row.item_enumR(gs, "stereo_mode", "ABOVEBELOW")
+                       
+                       row = col.row()
+                       row.item_enumR(gs, "stereo_mode", "INTERLACED")
+                       row.item_enumR(gs, "stereo_mode", "ANAGLYPH")
+                       
+                       row = col.row()
+                       row.item_enumR(gs, "stereo_mode", "SIDEBYSIDE")
+                       row.item_enumR(gs, "stereo_mode", "VINTERLACE")
+
+#                      row = layout.column_flow()
+#                      row.itemR(gs, "stereo_mode")
+
+               # dome:
+               if stereo_mode == 'DOME':
+                       row = layout.row()
+                       row.itemR(gs, "dome_mode")
+
+                       split=layout.split()
+                       col=split.column(align=True)
+                       col.itemR(gs, "dome_angle", slider=True)
+                       col.itemR(gs, "dome_tesselation", text="Tessel.")
+                       col=split.column(align=True)
+                       col.itemR(gs, "dome_tilt")
+                       col.itemR(gs, "dome_buffer_resolution", text="Res.", slider=True)
+                       col=layout.column()
+                       col.itemR(gs, "dome_text")
+
+
+class LOGIC_PT_physics(bpy.types.Panel):
        __space_type__ = "LOGIC_EDITOR"
        __region_type__ = "UI"
-       __label__ = "Properties"
-
-       def poll(self, context):
-               ob = context.active_object
-               return ob and ob.game
-       
+       __label__ = "World Physics"
        def draw(self, context):
                layout = self.layout
-               
-               ob = context.active_object
-               game = ob.game
-               
-               for prop in game.properties:
-                       flow = layout.row()
-                       flow.itemR(prop, "name", text="")
-                       flow.itemR(prop, "type", text="")
-                       flow.itemR(prop, "value", text="") # we dont care about the type. rna will display correctly
-                       flow.itemR(prop, "debug")
+               gs = context.scene.game_data
+               flow = layout.column_flow()
+               flow.itemR(gs, "physics_engine")
+               if gs.physics_engine != "NONE":
+                       flow.itemR(gs, "physics_gravity")
+                       split = layout.split()
+                       col = split.column()
+                       col.itemR(gs, "use_occlusion_culling", text="Enable Occlusion Culling")
+       
+                       sub = split.column()
+                       sub.active = gs.use_occlusion_culling
+                       sub.itemR(gs, "occlusion_culling_resolution", text="resol.")
+
+# Activity Culling is deprecated I think. Let's leave it commented by now
+"""
+                       split = layout.split()
+                       col = split.column()
+                       col.itemR(gs, "activity_culling")
+                       
+                       sub = split.column()
+                       sub.active = gs.activity_culling
+                       sub.itemR(gs, "activity_culling_box_radius")
+"""
+
+                       split = layout.split()
+                       col = split.column(align=True)
+                       col.itemR(gs, "physics_step_max", text="phys")
+                       col.itemR(gs, "physics_step_sub", text="sub")
+                       
+                       col = split.column(align=True)
+                       col.itemR(gs, "fps", text="fps")
+                       col.itemR(gs, "logic_step_max", text="log")
+
+               else:
+                       split = layout.split()
+                       col = split.column(align=True)
+                       col.itemR(gs, "fps", text="fps")
+                       col = split.column(align=True)
+                       col.itemR(gs, "logic_step_max", text="log")
 
-bpy.types.register(LOGIC_PT_physics)
-bpy.types.register(LOGIC_PT_collision_bounds)
 bpy.types.register(LOGIC_PT_properties)
+bpy.types.register(LOGIC_PT_player)
+bpy.types.register(LOGIC_PT_stereo)
+bpy.types.register(LOGIC_PT_physics)
\ No newline at end of file
index 2ab67ed6151bd6722d95ce29d5536837abd8e755..20ed7c1b7eb8399d8a678b305e9b08af6e0afce5 100644 (file)
@@ -230,23 +230,11 @@ Scene *add_scene(char *name)
        sce->r.bake_osa= 5;
        sce->r.bake_flag= R_BAKE_CLEAR;
        sce->r.bake_normal_space= R_BAKE_SPACE_TANGENT;
-       
-       sce->r.xplay= 640;
-       sce->r.yplay= 480;
-       sce->r.freqplay= 60;
-       sce->r.depth= 32;
 
        sce->r.scemode= R_DOCOMP|R_DOSEQ|R_EXTENSION;
        sce->r.stamp= R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_SCENE|R_STAMP_CAMERA;
        
        sce->r.threads= 1;
-       
-       sce->r.stereomode = 1;  // no stereo
-       sce->r.domeangle = 180;
-       sce->r.domemode = 1;
-       sce->r.domeres = 4;
-       sce->r.domeresbuf = 1.0f;
-       sce->r.dometilt = 0;
 
        sce->r.simplify_subsurf= 6;
        sce->r.simplify_particles= 1.0f;
@@ -322,6 +310,29 @@ Scene *add_scene(char *name)
        /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
        scene_add_render_layer(sce);
        
+       /* game data */
+       sce->gm.stereoflag = STEREO_NOSTEREO;
+       sce->gm.stereomode = STEREO_ANAGLYPH;
+       sce->gm.dome.angle = 180;
+       sce->gm.dome.mode = DOME_FISHEYE;
+       sce->gm.dome.res = 4;
+       sce->gm.dome.resbuf = 1.0f;
+       sce->gm.dome.tilt = 0;
+
+       sce->gm.xplay= 800;
+       sce->gm.yplay= 600;
+       sce->gm.freqplay= 60;
+       sce->gm.depth= 32;
+
+       sce->gm.gravity= 9.8f;
+       sce->gm.physicsEngine= WOPHY_BULLET;
+       sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling 
+       sce->gm.occlusionRes = 128;
+       sce->gm.ticrate = 60;
+       sce->gm.maxlogicstep = 5;
+       sce->gm.physubstep = 1;
+       sce->gm.maxphystep = 5;
+
        return sce;
 }
 
index 7fe129ed6fcaf5072297624b318e936afc987007..c84c54b17eebbc1c7e14f789c1cfd263b5a6d4b7 100644 (file)
@@ -94,7 +94,6 @@ World *add_world(char *name)
        wrld->skytype= WO_SKYBLEND;
        wrld->stardist= 15.0f;
        wrld->starsize= 2.0f;
-       wrld->gravity= 9.8f;
        
        wrld->exp= 0.0f;
        wrld->exposure=wrld->range= 1.0f;
@@ -106,14 +105,7 @@ World *add_world(char *name)
        wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;    
        wrld->ao_approx_error= 0.25f;
        
-       wrld->physicsEngine= WOPHY_BULLET;//WOPHY_SUMO; Bullet by default
-       wrld->mode = WO_DBVT_CULLING;   // DBVT culling by default
-       wrld->occlusionRes = 128;
        wrld->preview = NULL;
-       wrld->ticrate = 60;
-       wrld->maxlogicstep = 5;
-       wrld->physubstep = 1;
-       wrld->maxphystep = 5;
 
        return wrld;
 }
index 8a5f915c8498446c260fb2f0ef6fb856f20245d0..46db41094403c9de24f12888ff199ed0c1af6fa4 100644 (file)
@@ -3995,7 +3995,8 @@ static void lib_link_scene(FileData *fd, Main *main)
                                srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override);
                        }
                        /*Game Settings: Dome Warp Text*/
-                       sce->r.dometext= newlibadr_us(fd, sce->id.lib, sce->r.dometext);
+//                     sce->r.dometext= newlibadr_us(fd, sce->id.lib, sce->r.dometext); // XXX deprecated since 2.5
+                       sce->gm.dome.warptext= newlibadr_us(fd, sce->id.lib, sce->gm.dome.warptext);
 
                        sce->id.flag -= LIB_NEEDLINK;
                }
@@ -9314,6 +9315,69 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ts->uv_selectmode= UV_SELECT_VERTEX;
                                ts->vgroup_weight= 1.0f;
                        }
+
+                       /* Game Settings */
+                       //Dome
+                       sce->gm.dome.angle = sce->r.domeangle;
+                       sce->gm.dome.mode = sce->r.domemode;
+                       sce->gm.dome.res = sce->r.domeres;
+                       sce->gm.dome.resbuf = sce->r.domeresbuf;
+                       sce->gm.dome.tilt = sce->r.dometilt;
+                       sce->gm.dome.warptext = sce->r.dometext;
+
+                       //Stand Alone
+                       sce->gm.fullscreen = sce->r.fullscreen;
+                       sce->gm.xplay = sce->r.xplay;
+                       sce->gm.yplay = sce->r.yplay;
+                       sce->gm.freqplay = sce->r.freqplay;
+                       sce->gm.depth = sce->r.depth;
+                       sce->gm.attrib = sce->r.attrib;
+
+                       //Stereo
+                       sce->gm.xsch = sce->r.xsch;
+                       sce->gm.ysch = sce->r.ysch;
+                       sce->gm.stereomode = sce->r.stereomode;
+                       /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
+                       if (sce->gm.stereomode == 1){ //1 = STEREO_NOSTEREO
+                               sce->gm.stereoflag = STEREO_NOSTEREO;
+                               sce->gm.stereomode = STEREO_ANAGLYPH;
+                       }
+                       else if(sce->gm.stereomode == 8){ //8 = STEREO_DOME
+                               sce->gm.stereoflag = STEREO_DOME;
+                               sce->gm.stereomode = STEREO_ANAGLYPH;
+                       }
+                       else
+                               sce->gm.stereoflag = STEREO_ENABLE;
+
+                       //Framing
+                       sce->gm.framing = sce->framing;
+                       sce->gm.xplay = sce->r.xplay;
+                       sce->gm.yplay = sce->r.yplay;
+                       sce->gm.freqplay= sce->r.freqplay;
+                       sce->gm.depth= sce->r.depth;
+
+                       //Physic (previously stored in world)
+                       if (0){
+//                     if (sce->world){ // XXX I think we need to run lib_link_all() before do_version()
+                               sce->gm.gravity = sce->world->gravity;
+                               sce->gm.physicsEngine= sce->world->physicsEngine;
+                               sce->gm.mode = sce->world->mode;
+                               sce->gm.occlusionRes = sce->world->occlusionRes;
+                               sce->gm.ticrate = sce->world->ticrate;
+                               sce->gm.maxlogicstep = sce->world->maxlogicstep;
+                               sce->gm.physubstep = sce->world->physubstep;
+                               sce->gm.maxphystep = sce->world->maxphystep;
+                       }
+                       else{
+                               sce->gm.gravity =9.8f;
+                               sce->gm.physicsEngine= WOPHY_BULLET;// Bullet by default
+                               sce->gm.mode = WO_DBVT_CULLING; // DBVT culling by default
+                               sce->gm.occlusionRes = 128;
+                               sce->gm.ticrate = 60;
+                               sce->gm.maxlogicstep = 5;
+                               sce->gm.physubstep = 1;
+                               sce->gm.maxphystep = 5;
+                       }
                }
        }
 
@@ -10225,7 +10289,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
        }
 
        if(sce->r.dometext)
-               expand_doit(fd, mainvar, sce->r.dometext);
+               expand_doit(fd, mainvar, sce->gm.dome.warptext);
 }
 
 static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
index b7e2a3325cb9ac2443019e16359a7572a445560a..9048565b01f9bac874f4bd8c4c5774fc83c89354 100644 (file)
@@ -360,6 +360,32 @@ static int buttons_context_path_texture(ButsContextPath *path)
        return 0;
 }
 
+static int buttons_context_path_game(ButsContextPath *path)
+{
+       /* XXX temporary context. Using material slot instead of ob->game_data */
+       Object *ob;
+       PointerRNA *ptr= &path->ptr[path->len-1];
+       Material *ma;
+
+       /* if we already have a (pinned) material, we're done */
+       if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
+               return 1;
+       }
+       /* if we have an object, use the object material slot */
+       else if(buttons_context_path_object(path)) {
+               ob= path->ptr[path->len-1].data;
+
+               if(ob && ob->type && (ob->type<OB_LAMP)) {
+                       ma= give_current_material(ob, ob->actcol);
+                       RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
+                       path->len++;
+                       return 1;
+               }
+       }
+
+       /* no path to a material possible */
+       return 0;
+}
 static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int worldtex)
 {
        SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
@@ -404,6 +430,9 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
                case BCONTEXT_DATA:
                        found= buttons_context_path_data(path, -1);
                        break;
+               case BCONTEXT_GAME:
+                       found= buttons_context_path_game(path);
+                       break;
                case BCONTEXT_PARTICLE:
                        found= buttons_context_path_particle(path);
                        break;
@@ -496,8 +525,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
        /* here we handle context, getting data from precomputed path */
        if(CTX_data_dir(member)) {
                static const char *dir[] = {
-                       "world", "object", "meshe", "armature", "lattice", "curve",
-                       "meta_ball", "lamp", "camera", "material", "material_slot",
+                       "world", "object", "mesh", "armature", "lattice", "curve",
+                       "meta_ball", "lamp", "camera", "material", "material_slot", "game",
                        "texture", "texture_slot", "bone", "edit_bone", "particle_system",
                        "cloth", "soft_body", "fluid", "collision", NULL};
 
@@ -736,4 +765,3 @@ void buttons_context_register(ARegionType *art)
        pt->flag= PNL_NO_HEADER;
        BLI_addtail(&art->paneltypes, pt);
 }
-
index ff906b7f539135d37529ab93bb238a7f934c501a..e569ed324cdab10049d5bfd38b02f96f75a4601b 100644 (file)
@@ -187,7 +187,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
                uiDefIconButS(block, ROW, B_CONTEXT_SWITCH,     ICON_PARTICLES, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles");
        if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS))
                uiDefIconButS(block, ROW, B_CONTEXT_SWITCH,     ICON_PHYSICS,   xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics");
-
+       if(sbuts->pathflag & (1<<BCONTEXT_GAME))
+               uiDefIconButS(block, ROW, B_CONTEXT_SWITCH,     ICON_GAME,      xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_GAME, 0, 0, "Game");
        xco+= XIC;
        
        uiBlockEndAlign(block);
index 4a741f85d855f2551d32aaeef1d01dd200c4b43f..0c1f735451aeb9f50defadf21d8bf4d0036bfbf9 100644 (file)
@@ -172,6 +172,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
                ED_region_panels(C, ar, vertical, "modifier");
        else if (sbuts->mainb == BCONTEXT_CONSTRAINT)
                ED_region_panels(C, ar, vertical, "constraint");
+       else if (sbuts->mainb == BCONTEXT_GAME)
+               ED_region_panels(C, ar, vertical, "game");
 
     sbuts->re_align= 0;
        sbuts->mainbo= sbuts->mainb;
index 572913f10d0a833369c7e19b6f0dfacbaa8c0498..31d7a63b31b2bdb9ee315bf1889e387209ad6213 100644 (file)
@@ -183,10 +183,10 @@ typedef struct RenderData {
        /** For UR edge rendering: give the edges this color */
        float edgeR, edgeG, edgeB;
        
-       short fullscreen, xplay, yplay, freqplay;       /* standalone player */
-       short depth, attrib, rt1, rt2;                  /* standalone player */
+       short fullscreen, xplay, yplay, freqplay;       /* standalone player */  //  XXX deprecated since 2.5
+       short depth, attrib, rt1, rt2;                  /* standalone player */  //  XXX deprecated since 2.5
 
-       short stereomode;       /* standalone player stereo settings */
+       short stereomode;       /* standalone player stereo settings */  //  XXX deprecated since 2.5
        
        short dimensionspreset;         /* for the dimensions presets menu */
        
@@ -327,12 +327,12 @@ typedef struct RenderData {
        short jp2_preset, jp2_depth;
        int rpad3;
 
-       /* Dome variables */
-       short domeres, domemode;
-       short domeangle, dometilt;
-       float domeresbuf;
-       float pad2;
-       struct Text *dometext;
+       /* Dome variables */ //  XXX deprecated since 2.5
+       short domeres, domemode;        //  XXX deprecated since 2.5
+       short domeangle, dometilt;      //  XXX deprecated since 2.5
+       float domeresbuf;       //  XXX deprecated since 2.5
+       float pad2;                     //  XXX deprecated since 2.5
+       struct Text *dometext;  //  XXX deprecated since 2.5
 
 } RenderData;
 
@@ -350,6 +350,20 @@ typedef struct RenderProfile {
        
 } RenderProfile;
 
+typedef struct GameDome {
+       short res, mode;
+       short angle, tilt;
+       float resbuf, pad2;
+       struct Text *warptext;
+} GameDome;
+
+#define DOME_FISHEYE                   1
+#define DOME_TRUNCATED_FRONT   2
+#define DOME_TRUNCATED_REAR            3
+#define DOME_ENVMAP                            4
+#define DOME_PANORAM_SPH               5
+#define DOME_NUM_MODES                 6
+
 typedef struct GameFraming {
        float col[3];
        char type, pad1, pad2, pad3;
@@ -359,6 +373,56 @@ typedef struct GameFraming {
 #define SCE_GAMEFRAMING_EXTEND 1
 #define SCE_GAMEFRAMING_SCALE  2
 
+typedef struct GameData {
+
+       /* physics (it was in world)*/
+       float gravity; /*Gravitation constant for the game world*/
+
+       /*
+        * Radius of the activity bubble, in Manhattan length. Objects
+        * outside the box are activity-culled. */
+       float activityBoxRadius; //it's not being used ANYWHERE !!!!!!!!!!!!!!
+       /*
+        * bit 3: (gameengine): Activity culling is enabled.
+        * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling
+       */
+       short mode, pad11;
+       short occlusionRes;             /* resolution of occlusion Z buffer in pixel */
+       short physicsEngine;
+       short ticrate, maxlogicstep, physubstep, maxphystep;
+
+       /*  standalone player */
+       struct GameFraming framing;
+       short pad9, pad10;
+       short fullscreen, xplay, yplay, freqplay;
+       short depth, attrib, rt1, rt2;
+
+       /* stereo/dome mode */
+       struct GameDome dome;
+       short stereoflag, stereomode, xsch, ysch; //xsch and ysch can be deleted !!!
+       float pad12;
+} GameData;
+#define STEREO_NOSTEREO                1
+#define STEREO_ENABLE          2
+#define STEREO_DOME                    3
+
+//#define STEREO_NOSTEREO               1
+#define STEREO_QUADBUFFERED 2
+#define STEREO_ABOVEBELOW       3
+#define STEREO_INTERLACED       4
+#define STEREO_ANAGLYPH                5
+#define STEREO_SIDEBYSIDE      6
+#define STEREO_VINTERLACE      7
+//#define STEREO_DOME          8
+
+/* physicsEngine */
+#define WOPHY_NONE             0
+#define WOPHY_ENJI             1
+#define WOPHY_SUMO             2
+#define WOPHY_DYNAMO   3
+#define WOPHY_ODE              4
+#define WOPHY_BULLET   5
+
 typedef struct TimeMarker {
        struct TimeMarker *next, *prev;
        int frame;
@@ -588,8 +652,6 @@ typedef struct Scene {
        
        struct Editing *ed;                                                             /* sequence editor data is allocated here */
        
-       struct GameFraming framing;
-
        struct ToolSettings *toolsettings;              /* default allocated now */
        struct SceneStats *stats;                               /* default allocated now */
 
@@ -617,6 +679,10 @@ typedef struct Scene {
        /* User-Defined KeyingSets */
        int active_keyingset;                   /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */
        ListBase keyingsets;                    /* KeyingSets for the given frame */
+       
+       /* Game Settings */
+       struct GameFraming framing; // XXX  deprecated since 2.5
+       struct GameData gm;
 } Scene;
 
 
index 608a4ca982ef8fa0cfbbaa8b3bca959a3a7de2d2..b6e387fbede59a0826f12f33a14f773af171ac32 100644 (file)
@@ -72,12 +72,12 @@ typedef struct World {
        /**
         * Gravitation constant for the game world
         */
-       float gravity;
+       float gravity; // moved to scene->gamedata in 2.5
 
        /**
         * Radius of the activity bubble, in Manhattan length. Objects
         * outside the box are activity-culled. */
-       float activityBoxRadius;
+       float activityBoxRadius; // moved to scene->gamedata in 2.5
        
        short skytype;
        /**
@@ -89,10 +89,10 @@ typedef struct World {
         * bit 4: ambient occlusion
         * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling 
         */
-       short mode;
-       short occlusionRes;             /* resolution of occlusion Z buffer in pixel */
-       short physicsEngine;    /* here it's aligned */
-       short ticrate, maxlogicstep, physubstep, maxphystep;
+       short mode;                                                                                             // partially moved to scene->gamedata in 2.5
+       short occlusionRes;             /* resolution of occlusion Z buffer in pixel */ // moved to scene->gamedata in 2.5
+       short physicsEngine;    /* here it's aligned */                                 // moved to scene->gamedata in 2.5
+       short ticrate, maxlogicstep, physubstep, maxphystep;    // moved to scene->gamedata in 2.5
        
        float misi, miststa, mistdist, misthi;
        
@@ -181,14 +181,6 @@ typedef struct World {
 #define WOMAP_ZENDOWN  8
 #define WOMAP_MIST             16
 
-/* physicsEngine */
-#define WOPHY_NONE             0
-#define WOPHY_ENJI             1
-#define WOPHY_SUMO             2
-#define WOPHY_DYNAMO   3
-#define WOPHY_ODE              4
-#define WOPHY_BULLET   5
-
 /* flag */
 #define WO_DS_EXPAND   (1<<0)
 
index 9ad71f4e1d75b691d5f1d7c62bbd00c773cef988..90270483adb65891e24326a86710fac77de661a2 100644 (file)
@@ -320,6 +320,7 @@ extern StructRNA RNA_RaySensor;
 extern StructRNA RNA_Region;
 extern StructRNA RNA_RigidBodyJointConstraint;
 extern StructRNA RNA_Scene;
+extern StructRNA RNA_SceneGameData;
 extern StructRNA RNA_SceneRenderData;
 extern StructRNA RNA_SceneSequence;
 extern StructRNA RNA_Screen;
index d1ef9dbbef3e1dc7be007fe80c7d4257fc95344f..a41bff8431c32a934e0f64e5746c43a1f42e591b 100644 (file)
@@ -554,6 +554,216 @@ void rna_def_scene_render_layer(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 }
 
+void rna_def_scene_game_data(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       static EnumPropertyItem framing_types_items[] ={
+               {SCE_GAMEFRAMING_BARS, "BARS", 0, "Stretch", ""},
+               {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", ""},
+               {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       static EnumPropertyItem dome_modes_items[] ={
+               {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
+               {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
+               {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
+               {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""},
+               {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
+               {0, NULL, 0, NULL, NULL}};
+               
+       static EnumPropertyItem stereo_modes_items[] ={
+//             {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""},
+               {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
+               {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
+               {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
+               {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""},
+               {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""},
+               {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
+//             {STEREO_DOME, "DOME", 0, "Dome", ""},
+               {0, NULL, 0, NULL, NULL}};
+               
+       static EnumPropertyItem stereo_items[] ={
+               {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""},
+               {STEREO_ENABLE, "STEREO", 0, "Stereo", ""},
+               {STEREO_DOME, "DOME", 0, "Dome", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       static EnumPropertyItem physics_engine_items[] = {
+               {WOPHY_NONE, "NONE", 0, "None", ""},
+               //{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
+               //{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""},
+               //{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""},
+               //{WOPHY_ODE, "ODE", 0, "ODE", ""},
+               {WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
+               {0, NULL, 0, NULL, NULL}};
+
+       srna= RNA_def_struct(brna, "SceneGameData", NULL);
+       RNA_def_struct_sdna(srna, "GameData");
+       RNA_def_struct_nested(brna, srna, "Scene");
+       RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock.");
+       
+       prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "xplay");
+       RNA_def_property_range(prop, 4, 10000);
+       RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "yplay");
+       RNA_def_property_range(prop, 4, 10000);
+       RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "depth");
+       RNA_def_property_range(prop, 8, 32);
+       RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       // Do we need it here ? (since we already have it in World
+       prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "freqplay");
+       RNA_def_property_range(prop, 4, 2000);
+       RNA_def_property_ui_text(prop, "Freq", "Displays clock frequency of fullscreen display.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "fullscreen", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "fullscreen", 1.0);
+       RNA_def_property_ui_text(prop, "Fullscreen", "Starts player in a new fullscreen display");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       /* Framing */
+       prop= RNA_def_property(srna, "framing_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "framing.type");
+       RNA_def_property_enum_items(prop, framing_types_items);
+       RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "framing_color", PROP_FLOAT, PROP_COLOR);
+       RNA_def_property_float_sdna(prop, NULL, "framing.col");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "", "");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       /* Stereo */
+       prop= RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
+       RNA_def_property_enum_items(prop, stereo_items);
+       RNA_def_property_ui_text(prop, "Stereo Options", "");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "stereomode");
+       RNA_def_property_enum_items(prop, stereo_modes_items);
+       RNA_def_property_ui_text(prop, "Stereo Mode", "");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       /* Dome */
+       prop= RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
+       RNA_def_property_enum_items(prop, dome_modes_items);
+       RNA_def_property_ui_text(prop, "Dome Mode", "");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "dome_tesselation", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "dome.res");
+       RNA_def_property_ui_range(prop, 1, 8, 1, 1);
+       RNA_def_property_ui_text(prop, "Tesselation", "Tesselation level - check the generated mesh in wireframe mode");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
+       RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 0.1);
+       RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "dome.angle");
+       RNA_def_property_ui_range(prop, 90, 250, 1, 1);
+       RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
+       RNA_def_property_ui_range(prop, -180, 180, 1, 1);
+       RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       prop= RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
+       RNA_def_property_struct_type(prop, "Text");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       /* physics */
+       prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
+       RNA_def_property_enum_items(prop, physics_engine_items);
+       RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "gravity");
+       RNA_def_property_range(prop, 0.0, 25.0);
+       RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "occlusionRes");
+       RNA_def_property_range(prop, 128.0, 1024.0);
+       RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precsion (slower)");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "ticrate");
+       RNA_def_property_ui_range(prop, 1, 60, 1, 1);
+       RNA_def_property_range(prop, 1, 250);
+       RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate.");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
+       RNA_def_property_ui_range(prop, 1, 5, 1, 1);
+       RNA_def_property_range(prop, 1, 5);
+       RNA_def_property_ui_text(prop, "Max Logic Steps", "Sets the maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "maxphystep");
+       RNA_def_property_ui_range(prop, 1, 5, 1, 1);
+       RNA_def_property_range(prop, 1, 5);
+       RNA_def_property_ui_text(prop, "Max Physics Steps", "Sets the maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "physubstep");
+       RNA_def_property_ui_range(prop, 1, 5, 1, 1);
+       RNA_def_property_range(prop, 1, 5);
+       RNA_def_property_ui_text(prop, "Physics Sub Steps", "Sets the number of simulation substep per physic timestep, higher value give better physics precision");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       /* mode */
+       prop= RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); //XXX mode hardcoded // WO_DBVT_CULLING
+       RNA_def_property_ui_text(prop, "DBVT culling", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+       
+       // not used // deprecated !!!!!!!!!!!!!
+       prop= RNA_def_property(srna, "activity_culling", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); //XXX mode hardcoded
+       RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       // not used // deprecated !!!!!!!!!!!!!
+       prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
+       RNA_def_property_range(prop, 0.0, 1000.0);
+       RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+}
 void rna_def_scene_render_data(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1360,8 +1570,15 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_struct_type(prop, "TimelineMarker");
        RNA_def_property_ui_text(prop, "Timeline Markers", "Markers used in all timelines for the current scene.");
 
+       /* Game Settings */
+       prop= RNA_def_property(srna, "game_data", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "gm");
+       RNA_def_property_struct_type(prop, "SceneGameData");
+       RNA_def_property_ui_text(prop, "Game Data", "");
+       
        rna_def_tool_settings(brna);
        rna_def_scene_render_data(brna);
+       rna_def_scene_game_data(brna);
        rna_def_scene_render_layer(brna);
 }
 
index ba8f4ce9024ec0e40d5982a2bc600376a1bd09d9..d959c26a49ae3d238f9c15770d787ce2a39d4e43 100644 (file)
@@ -658,6 +658,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
                {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
                {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"},
                {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
+               {BCONTEXT_GAME, "GAME", ICON_GAME, "Game", "Game"},
                {0, NULL, 0, NULL, NULL}};
                
        static EnumPropertyItem panel_alignment_items[] = {
index 773037176deb0193a7a33564a48807da432cf44e..b40f3de43ef453068e02c54d6eb020c82d3ab86b 100644 (file)
@@ -361,6 +361,7 @@ void RNA_def_world(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
+/*
        static EnumPropertyItem physics_engine_items[] = {
                {WOPHY_NONE, "NONE", 0, "None", ""},
                //{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
@@ -369,6 +370,7 @@ void RNA_def_world(BlenderRNA *brna)
                //{WOPHY_ODE, "ODE", 0, "ODE", ""},
                {WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
                {0, NULL, 0, NULL, NULL}};
+*/
 
        srna= RNA_def_struct(brna, "World", "ID");
        RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene.");
@@ -422,49 +424,6 @@ void RNA_def_world(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle.");
        RNA_def_property_update(prop, NC_WORLD, NULL);
 
-       /* game settings */
-       /* should go in a fake substruct however not sure if they move about */
-       prop= RNA_def_property(srna, "game_fps", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "ticrate");
-       RNA_def_property_range(prop, 1, 120);
-       RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate.");
-
-       prop= RNA_def_property(srna, "game_logic_step_max", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
-       RNA_def_property_range(prop, 1, 5);
-       RNA_def_property_ui_text(prop, "Max Logic Steps", "The maxmimum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics.");
-
-       prop= RNA_def_property(srna, "game_physics_substep", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "physubstep");
-       RNA_def_property_range(prop, 1, 5);
-       RNA_def_property_ui_text(prop, "Physics Sub Steps", "The maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime.");
-
-       prop= RNA_def_property(srna, "game_physics_step_max", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "maxphystep");
-       RNA_def_property_range(prop, 1, 5);
-       RNA_def_property_ui_text(prop, "Max Physics Steps", "The number of simulation substep per physic timestep, higher value give better physics precision.");
-
-       prop= RNA_def_property(srna, "game_use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING);
-       RNA_def_property_ui_text(prop, "Enabled", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling");
-
-       prop= RNA_def_property(srna, "game_occlusion_culling_resolution", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
-       RNA_def_property_range(prop, 128, 1024);
-       RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precsion (slower).");
-
-
-       /* physics */
-       prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
-       RNA_def_property_enum_items(prop, physics_engine_items);
-       RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine.");
-
-       prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "gravity");
-       RNA_def_property_range(prop, 0.0, 25.0);
-       RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine.");
-
        /* nested structs */
        prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "WorldAmbientOcclusion");
index fb222b419c30c05959ae6e2268d63d419960ca7d..b62667627a1dd73144feb9e1d266088ea39cdec0 100644 (file)
@@ -332,8 +332,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
                        ketsjiengine->SetGame2IpoMode(game2ipo,startFrame);
                        
                        // Quad buffered needs a special window.
-                       if (blscene->r.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
-                               rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->r.stereomode);
+                       if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
+                               rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode);
                }
                
                if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
@@ -396,8 +396,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami
 #endif
 
                        //initialize Dome Settings
-                       if(blscene->r.stereomode == RAS_IRasterizer::RAS_STEREO_DOME)
-                               ketsjiengine->InitDome(blscene->r.domeres, blscene->r.domemode, blscene->r.domeangle, blscene->r.domeresbuf, blscene->r.dometilt, blscene->r.dometext);
+                       if(blscene->gm.stereoflag == STEREO_DOME)
+                               ketsjiengine->InitDome(blscene->gm.dome.res, blscene->gm.dome.mode, blscene->gm.dome.angle, blscene->gm.dome.resbuf, blscene->gm.dome.tilt, blscene->gm.dome.warptext);
 
                        if (sceneconverter)
                        {
@@ -672,8 +672,8 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
                }
 
                // Quad buffered needs a special window.
-               if (blscene->r.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
-                       rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->r.stereomode);
+               if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
+                       rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode);
 
                if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
                {
index 177f261e40badc130d43e2799926d83cef10f0c5..072889a530fbd19feb62aed20beb909f851e67d3 100644 (file)
@@ -1931,39 +1931,35 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                aspect_width = canvas->GetWidth();
                aspect_height = canvas->GetHeight();
        } else {
-               if (blenderscene->framing.type == SCE_GAMEFRAMING_BARS) {
+               if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_BARS) {
                        frame_type = RAS_FrameSettings::e_frame_bars;
-               } else if (blenderscene->framing.type == SCE_GAMEFRAMING_EXTEND) {
+               } else if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_EXTEND) {
                        frame_type = RAS_FrameSettings::e_frame_extend;
                } else {
                        frame_type = RAS_FrameSettings::e_frame_scale;
                }
                
-               aspect_width = blenderscene->r.xsch;
-               aspect_height = blenderscene->r.ysch;
+               aspect_width = blenderscene->gm.xsch;
+               aspect_height = blenderscene->gm.ysch;
        }
        
        RAS_FrameSettings frame_settings(
                frame_type,
-               blenderscene->framing.col[0],
-               blenderscene->framing.col[1],
-               blenderscene->framing.col[2],
+               blenderscene->gm.framing.col[0],
+               blenderscene->gm.framing.col[1],
+               blenderscene->gm.framing.col[2],
                aspect_width,
                aspect_height
        );
        kxscene->SetFramingType(frame_settings);
 
-       kxscene->SetGravity(MT_Vector3(0,0,(blenderscene->world != NULL) ? -blenderscene->world->gravity : -9.8));
+       kxscene->SetGravity(MT_Vector3(0,0, -blenderscene->gm.gravity));
        
        /* set activity culling parameters */
-       if (blenderscene->world) {
-               kxscene->SetActivityCulling( (blenderscene->world->mode & WO_ACTIVITY_CULLING) != 0);
-               kxscene->SetActivityCullingRadius(blenderscene->world->activityBoxRadius);
-               kxscene->SetDbvtCulling((blenderscene->world->mode & WO_DBVT_CULLING) != 0);
-       } else {
-               kxscene->SetActivityCulling(false);
-               kxscene->SetDbvtCulling(false);
-       }
+       kxscene->SetActivityCulling( (blenderscene->gm.mode & WO_ACTIVITY_CULLING) != 0);
+       kxscene->SetActivityCullingRadius(blenderscene->gm.activityBoxRadius);
+       kxscene->SetDbvtCulling((blenderscene->gm.mode & WO_DBVT_CULLING) != 0);
+       
        // no occlusion culling by default
        kxscene->SetDbvtOcclusionRes(0);
 
index e5932180fe1aff68dbeab0259212701b876ff1a2..a3805bd4317b409b68088fe0b52493c684bca454 100644 (file)
@@ -700,8 +700,8 @@ bool GPG_Application::startEngine(void)
 #endif
 
                //initialize Dome Settings
-               if(m_startScene->r.stereomode == RAS_IRasterizer::RAS_STEREO_DOME)
-                       m_ketsjiengine->InitDome(m_startScene->r.domeres, m_startScene->r.domemode, m_startScene->r.domeangle, m_startScene->r.domeresbuf, m_startScene->r.dometilt, m_startScene->r.dometext);
+               if(m_startScene->gm.stereoflag == STEREO_DOME)
+                       m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext);
 
                // Set the GameLogic.globalDict from marshal'd data, so we can
                // load new blend files and keep data in GameLogic.globalDict
index 83ba2778ad66312dd3f113beb19641661dd0fcaf..d16348defb2e2a67e74dd692d9d196dbddb457fd 100644 (file)
@@ -451,10 +451,10 @@ RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode()
 
 bool RAS_OpenGLRasterizer::Stereo()
 {
-       if(m_stereomode == RAS_STEREO_NOSTEREO || m_stereomode == RAS_STEREO_DOME)
-               return false;
-       else
+       if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0
                return true;
+       else
+               return false;
 }
 
 bool RAS_OpenGLRasterizer::InterlacedStereo()