fix from last commit.
[blender.git] / release / ui / space_logic.py
1 import bpy
2
3 class LOGIC_PT_properties(bpy.types.Panel):
4         __space_type__ = "LOGIC_EDITOR"
5         __region_type__ = "UI"
6         __label__ = "Properties"
7
8         def poll(self, context):
9                 ob = context.active_object
10                 return ob and ob.game
11
12         def draw(self, context):
13                 layout = self.layout
14                 ob = context.active_object
15                 game = ob.game
16                 
17                 for prop in game.properties:
18                         flow = layout.row()
19                         flow.itemR(prop, "name", text="")
20                         flow.itemR(prop, "type", text="")
21                         flow.itemR(prop, "value", text="") # we dont care about the type. rna will display correctly
22                         flow.itemR(prop, "debug")
23
24 """
25 class WORLD_PT_game(WorldButtonsPanel):
26         __space_type__ = "LOGIC_EDITOR"
27         __region_type__ = "UI"
28         __label__ = "Game Settings"
29
30         def draw(self, context):
31                 layout = self.layout
32                 world = context.world
33                 
34                 flow = layout.column_flow()
35                 flow.itemR(world, "physics_engine")
36                 flow.itemR(world, "physics_gravity")
37                 
38                 flow.itemR(world, "game_fps")
39                 flow.itemR(world, "game_logic_step_max")
40                 flow.itemR(world, "game_physics_substep")
41                 flow.itemR(world, "game_physics_step_max")
42                 
43                 flow.itemR(world, "game_use_occlusion_culling", text="Enable Occlusion Culling")
44                 flow.itemR(world, "game_occlusion_culling_resolution")
45 """
46 class LOGIC_PT_player(bpy.types.Panel):
47         __space_type__ = "LOGIC_EDITOR"
48         __region_type__ = "UI"
49         __label__ = "Game Player"
50
51         def draw(self, context):
52                 layout = self.layout
53                 gs = context.scene.game_data
54                 row = layout.row()
55                 row.itemR(gs, "fullscreen")
56
57                 split = layout.split()
58                 col = split.column(align=True)
59                 col.itemR(gs, "resolution_x", slider=False, text="Res. X")
60                 col.itemR(gs, "resolution_y", slider=False, text="Res. Y")
61
62                 col = split.column(align=True)
63                 col.itemR(gs, "depth", slider=False)
64                 col.itemR(gs, "frequency", slider=False)
65                 
66
67                 # framing:
68                 col = layout.column()
69                 col.itemL(text="Framing Options:")
70                 col.row().itemR(gs, "framing_type", expand=True)
71
72                 colsub = col.column()
73                 colsub.itemR(gs, "framing_color", text="")
74
75 class LOGIC_PT_stereo(bpy.types.Panel):
76         __space_type__ = "LOGIC_EDITOR"
77         __region_type__ = "UI"
78         __label__ = "Stereo and Dome"
79
80         def draw(self, context):
81                 layout = self.layout
82                 gs = context.scene.game_data
83
84
85                 # stereo options:
86                 col= layout.column()
87                 col.itemL(text="Stereo Options:")
88                 row = col.row()
89                 row.itemR(gs, "stereo", expand=True)
90  
91                 stereo_mode = gs.stereo
92  
93
94                 # stereo:
95                 if stereo_mode == 'STEREO':
96                         col = layout.column(align=True)
97                         row = col.row()
98                         row.item_enumR(gs, "stereo_mode", "QUADBUFFERED")
99                         row.item_enumR(gs, "stereo_mode", "ABOVEBELOW")
100                         
101                         row = col.row()
102                         row.item_enumR(gs, "stereo_mode", "INTERLACED")
103                         row.item_enumR(gs, "stereo_mode", "ANAGLYPH")
104                         
105                         row = col.row()
106                         row.item_enumR(gs, "stereo_mode", "SIDEBYSIDE")
107                         row.item_enumR(gs, "stereo_mode", "VINTERLACE")
108
109 #                       row = layout.column_flow()
110 #                       row.itemR(gs, "stereo_mode")
111
112                 # dome:
113                 if stereo_mode == 'DOME':
114                         row = layout.row()
115                         row.itemR(gs, "dome_mode")
116
117                         split=layout.split()
118                         col=split.column(align=True)
119                         col.itemR(gs, "dome_angle", slider=True)
120                         col.itemR(gs, "dome_tesselation", text="Tessel.")
121                         col=split.column(align=True)
122                         col.itemR(gs, "dome_tilt")
123                         col.itemR(gs, "dome_buffer_resolution", text="Res.", slider=True)
124                         col=layout.column()
125                         col.itemR(gs, "dome_text")
126
127
128 class LOGIC_PT_physics(bpy.types.Panel):
129         __space_type__ = "LOGIC_EDITOR"
130         __region_type__ = "UI"
131         __label__ = "World Physics"
132  
133         def draw(self, context):
134                 layout = self.layout
135                 gs = context.scene.game_data
136                 flow = layout.column_flow()
137                 flow.itemR(gs, "physics_engine")
138                 if gs.physics_engine != "NONE":
139                         flow.itemR(gs, "physics_gravity")
140  
141                         row = layout.row()
142                         row.itemR(gs, "use_occlusion_culling", text="Enable Occlusion Culling")
143         
144                         row = layout.row()
145                         row.active = gs.use_occlusion_culling
146                         row.itemR(gs, "occlusion_culling_resolution", text="resol.")
147
148                         split = layout.split()
149                         col = split.column(align=True)
150                         col.itemR(gs, "physics_step_max", text="phys")
151                         col.itemR(gs, "physics_step_sub", text="sub")
152                         
153                         col = split.column(align=True)
154                         col.itemR(gs, "fps", text="fps")
155                         col.itemR(gs, "logic_step_max", text="log")
156
157                 else:
158                         split = layout.split()
159                         col = split.column(align=True)
160                         col.itemR(gs, "fps", text="fps")
161                         col = split.column(align=True)
162                         col.itemR(gs, "logic_step_max", text="log")
163
164 bpy.types.register(LOGIC_PT_properties)
165 bpy.types.register(LOGIC_PT_player)
166 bpy.types.register(LOGIC_PT_stereo)
167 bpy.types.register(LOGIC_PT_physics)