Cleaned up logic buttons in logic space slightly.
[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__ = "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()
59                 col.itemL(text="Resolution:")
60                 colsub = col.column(align=True)
61                 colsub.itemR(gs, "resolution_x", slider=False, text="X")
62                 colsub.itemR(gs, "resolution_y", slider=False, text="Y")
63
64                 col = split.column()
65                 col.itemL(text="Quality:")
66                 colsub = col.column(align=True)
67                 colsub.itemR(gs, "depth", text="Bit Depth", slider=False)
68                 colsub.itemR(gs, "frequency", text="FPS", slider=False)
69                 
70
71                 # framing:
72                 col = layout.column()
73                 col.itemL(text="Framing:")
74                 col.row().itemR(gs, "framing_type", expand=True)
75
76                 colsub = col.column()
77                 colsub.itemR(gs, "framing_color", text="")
78
79 class LOGIC_PT_stereo(bpy.types.Panel):
80         __space_type__ = "LOGIC_EDITOR"
81         __region_type__ = "UI"
82         __label__ = "Stereo"
83
84         def draw(self, context):
85                 layout = self.layout
86                 gs = context.scene.game_data
87
88
89                 # stereo options:
90                 col= layout.column()
91                 row = col.row()
92                 row.itemR(gs, "stereo", expand=True)
93  
94                 stereo_mode = gs.stereo
95  
96
97                 # stereo:
98                 if stereo_mode == 'STEREO':
99
100                         row = layout.row()
101                         row.itemR(gs, "stereo_mode")
102
103                 # dome:
104                 if stereo_mode == 'DOME':
105                         row = layout.row()
106                         row.itemR(gs, "dome_mode", text="Dome Type")
107
108                         split=layout.split()
109                         col=split.column()
110                         col.itemR(gs, "dome_angle", slider=True)
111                         col.itemR(gs, "dome_tesselation", text="Tesselation")
112                         col=split.column()
113                         col.itemR(gs, "dome_tilt")
114                         col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
115                         col=layout.column()
116                         col.itemR(gs, "dome_text")
117
118
119 class LOGIC_PT_physics(bpy.types.Panel):
120         __space_type__ = "LOGIC_EDITOR"
121         __region_type__ = "UI"
122         __label__ = "World Physics"
123  
124         def draw(self, context):
125                 layout = self.layout
126                 gs = context.scene.game_data
127                 flow = layout.column_flow()
128                 flow.itemR(gs, "physics_engine")
129                 if gs.physics_engine != "NONE":
130                         flow.itemR(gs, "physics_gravity", text="Gravity")
131  
132                         split = layout.split()
133                         col = split.column()
134                         col.itemL(text="Physics Steps:")
135                         colsub = col.column(align=True)
136                         colsub.itemR(gs, "physics_step_max", text="Max")
137                         colsub.itemR(gs, "physics_step_sub", text="Substeps")
138                         col.itemR(gs, "fps", text="FPS")
139                         
140                         col = split.column()
141                         col.itemL(text="Logic Steps:")
142                         col.itemR(gs, "logic_step_max", text="Max")
143                         col.itemS()
144                         col.itemR(gs, "use_occlusion_culling", text="Occlusion Culling")
145                         colsub = col.column()
146                         colsub.active = gs.use_occlusion_culling
147                         colsub.itemR(gs, "occlusion_culling_resolution", text="Resolution")
148                         
149
150                 else:
151                         split = layout.split()
152                         col = split.column()
153                         col.itemL(text="Physics Steps:")
154                         col.itemR(gs, "fps", text="FPS")
155                         col = split.column()
156                         col.itemL(text="Logic Steps:")
157                         col.itemR(gs, "logic_step_max", text="Max")
158
159 bpy.types.register(LOGIC_PT_properties)
160 bpy.types.register(LOGIC_PT_player)
161 bpy.types.register(LOGIC_PT_stereo)
162 bpy.types.register(LOGIC_PT_physics)