1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
import bpy
class PhysicsButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "physics"
def poll(self, context):
ob = context.active_object
rd = context.scene.render_data
return ob and ob.game and (rd.engine == 'BLENDER_GAME')
class PHYSICS_PT_game_physics(PhysicsButtonsPanel):
__label__ = "Physics"
def draw(self, context):
layout = self.layout
ob = context.active_object
game = ob.game
layout.itemR(game, "physics_type")
layout.itemS()
split = layout.split()
col = split.column()
col.itemR(game, "actor")
col.itemR(game, "ghost")
col.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
col = split.column()
col.itemR(game, "do_fh", text="Use Material Physics")
col.itemR(game, "rotation_fh", text="Rotate From Normal")
col.itemR(game, "no_sleeping")
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Attributes:")
sub = col.column(align=True)
sub.itemR(game, "mass")
sub.itemR(game, "radius")
sub.itemR(game, "form_factor")
col.itemS()
col.itemL(text="Damping:")
sub = col.column(align=True)
sub.itemR(game, "damping", text="Translation", slider=True)
sub.itemR(game, "rotation_damping", text="Rotation", slider=True)
col = split.column()
col.itemL(text="Velocity:")
sub = col.column(align=True)
sub.itemR(game, "minimum_velocity", text="Minimum")
sub.itemR(game, "maximum_velocity", text="Maximum")
col.itemS()
col.itemR(game, "anisotropic_friction")
sub = col.column()
sub.active = game.anisotropic_friction
sub.itemR(game, "friction_coefficients", text="", slider=True)
layout.itemS()
split = layout.split()
col = split.column()
col.itemL(text="Lock Translation:")
col.itemR(game, "lock_x_axis", text="X")
col.itemR(game, "lock_y_axis", text="Y")
col.itemR(game, "lock_z_axis", text="Z")
col = split.column()
col.itemL(text="Lock Rotation:")
col.itemR(game, "lock_x_rot_axis", text="X")
col.itemR(game, "lock_y_rot_axis", text="Y")
col.itemR(game, "lock_z_rot_axis", text="Z")
class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel):
__label__ = "Collision Bounds"
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
layout.active = game.use_collision_bounds
layout.itemR(game, "collision_bounds", text="Bounds")
row = layout.row()
row.itemR(game, "collision_compound", text="Compound")
row.itemR(game, "collision_margin", text="Margin", slider=True)
bpy.types.register(PHYSICS_PT_game_physics)
bpy.types.register(PHYSICS_PT_game_collision_bounds)
class SceneButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "scene"
def poll(self, context):
rd = context.scene.render_data
return (rd.engine == 'BLENDER_GAME')
class SCENE_PT_game(SceneButtonsPanel):
__label__ = "Game"
def draw(self, context):
layout = self.layout
rd = context.scene.render_data
row = layout.row()
row.itemO("view3d.game_start", text="Start")
row.itemL()
class SCENE_PT_game_player(SceneButtonsPanel):
__label__ = "Player"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemR(gs, "fullscreen")
split = layout.split()
col = split.column()
col.itemL(text="Resolution:")
sub = col.column(align=True)
sub.itemR(gs, "resolution_x", slider=False, text="X")
sub.itemR(gs, "resolution_y", slider=False, text="Y")
col = split.column()
col.itemL(text="Quality:")
sub = col.column(align=True)
sub.itemR(gs, "depth", text="Bit Depth", slider=False)
sub.itemR(gs, "frequency", text="FPS", slider=False)
# framing:
col = layout.column()
col.itemL(text="Framing:")
col.row().itemR(gs, "framing_type", expand=True)
sub = col.column()
sub.itemR(gs, "framing_color", text="")
class SCENE_PT_game_stereo(SceneButtonsPanel):
__label__ = "Stereo"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
stereo_mode = gs.stereo
# stereo options:
layout.itemR(gs, "stereo", expand=True)
# stereo:
if stereo_mode == 'STEREO':
layout.itemR(gs, "stereo_mode")
layout.itemL(text="To do: Focal Length")
layout.itemL(text="To do: Eye Separation")
# dome:
elif stereo_mode == 'DOME':
layout.itemR(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
split=layout.split()
if dome_type == 'FISHEYE' or \
dome_type == 'TRUNCATED_REAR' or \
dome_type == 'TRUNCATED_FRONT':
col=split.column()
col.itemR(gs, "dome_angle", slider=True)
col.itemR(gs, "dome_tilt")
col=split.column()
col.itemR(gs, "dome_tesselation", text="Tesselation")
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
elif dome_type == 'PANORAM_SPH':
col=split.column()
col.itemR(gs, "dome_tesselation", text="Tesselation")
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
else: # cube map
col=split.column()
col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
layout.itemR(gs, "dome_text")
bpy.types.register(SCENE_PT_game)
bpy.types.register(SCENE_PT_game_player)
bpy.types.register(SCENE_PT_game_stereo)
class WorldButtonsPanel(bpy.types.Panel):
__space_type__ = "BUTTONS_WINDOW"
__region_type__ = "WINDOW"
__context__ = "world"
def poll(self, context):
rd = context.scene.render_data
return (rd.engine == 'BLENDER_GAME')
class WORLD_PT_game_context_world(WorldButtonsPanel):
__show_header__ = False
def poll(self, context):
rd = context.scene.render_data
return (context.scene) and (rd.use_game_engine)
def draw(self, context):
layout = self.layout
scene = context.scene
world = context.world
space = context.space_data
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
class WORLD_PT_game_world(WorldButtonsPanel):
__label__ = "World"
def draw(self, context):
layout = self.layout
world = context.world
row = layout.row()
row.column().itemR(world, "horizon_color")
row.column().itemR(world, "ambient_color")
layout.itemR(world.mist, "enabled", text="Mist")
row = layout.column_flow()
row.active = world.mist.enabled
row.itemR(world.mist, "start")
row.itemR(world.mist, "depth")
class WORLD_PT_game_physics(WorldButtonsPanel):
__label__ = "Physics"
def draw(self, context):
layout = self.layout
gs = context.scene.game_data
layout.itemR(gs, "physics_engine")
if gs.physics_engine != 'NONE':
layout.itemR(gs, "physics_gravity", text="Gravity")
split = layout.split()
col = split.column()
col.itemL(text="Physics Steps:")
sub = col.column(align=True)
sub.itemR(gs, "physics_step_max", text="Max")
sub.itemR(gs, "physics_step_sub", text="Substeps")
col.itemR(gs, "fps", text="FPS")
col = split.column()
col.itemL(text="Logic Steps:")
col.itemR(gs, "logic_step_max", text="Max")
col = layout.column()
col.itemR(gs, "use_occlusion_culling", text="Occlusion Culling")
sub = col.column()
sub.active = gs.use_occlusion_culling
sub.itemR(gs, "occlusion_culling_resolution", text="Resolution")
else:
split = layout.split()
col = split.column()
col.itemL(text="Physics Steps:")
col.itemR(gs, "fps", text="FPS")
col = split.column()
col.itemL(text="Logic Steps:")
col.itemR(gs, "logic_step_max", text="Max")
bpy.types.register(WORLD_PT_game_context_world)
bpy.types.register(WORLD_PT_game_world)
bpy.types.register(WORLD_PT_game_physics)
|