BGE panels: wip

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....
This commit is contained in:
Dalai Felinto
2009-07-20 20:28:29 +00:00
parent 1b7f1bc72d
commit 9a9d118bbf
19 changed files with 725 additions and 230 deletions

View File

@@ -1,89 +1,5 @@
import bpy
class LOGIC_PT_physics(bpy.types.Panel):
__space_type__ = "LOGIC_EDITOR"
__region_type__ = "UI"
__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 LOGIC_PT_collision_bounds(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
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")
class LOGIC_PT_properties(bpy.types.Panel):
__space_type__ = "LOGIC_EDITOR"
__region_type__ = "UI"
@@ -92,10 +8,9 @@ class LOGIC_PT_properties(bpy.types.Panel):
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
@@ -106,6 +21,159 @@ class LOGIC_PT_properties(bpy.types.Panel):
flow.itemR(prop, "value", text="") # we dont care about the type. rna will display correctly
flow.itemR(prop, "debug")
bpy.types.register(LOGIC_PT_physics)
bpy.types.register(LOGIC_PT_collision_bounds)
"""
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(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")
"""
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()
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)
colsub = col.column()
colsub.itemR(gs, "framing_color", text="")
class LOGIC_PT_stereo(bpy.types.Panel):
__space_type__ = "LOGIC_EDITOR"
__region_type__ = "UI"
__label__ = "Stereo and Dome"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
# 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__ = "World Physics"
def draw(self, context):
layout = self.layout
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_properties)
bpy.types.register(LOGIC_PT_player)
bpy.types.register(LOGIC_PT_stereo)
bpy.types.register(LOGIC_PT_physics)