|
@@ -0,0 +1,610 @@
|
|
1
|
+#record
|
|
2
|
+from bge import logic
|
|
3
|
+from mathutils import Vector
|
|
4
|
+from SortData import *
|
|
5
|
+
|
|
6
|
+cont = logic.getCurrentController()
|
|
7
|
+own = cont.owner
|
|
8
|
+scene = logic.getCurrentScene()
|
|
9
|
+cube = scene.objects["control_cube.002"]
|
|
10
|
+#obj = scene.objects["control_cube.002"]
|
|
11
|
+#sound_empty = scene.objects['replay_sound_empty']
|
|
12
|
+path = logic.expandPath(own["filePath"])
|
|
13
|
+
|
|
14
|
+PAF = 0
|
|
15
|
+DAF = 0
|
|
16
|
+
|
|
17
|
+deck = scene.objects["deck"]
|
|
18
|
+trucks = scene.objects["trucks"]
|
|
19
|
+
|
|
20
|
+throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
21
|
+wheel1 = scene.objects["rollen.000"]
|
|
22
|
+wheel2 = scene.objects["rollen.001"]
|
|
23
|
+wheel3 = scene.objects["rollen.002"]
|
|
24
|
+wheel4 = scene.objects["rollen.003"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+deckact = deck.actuators["Visibility"]
|
|
28
|
+trucksact = trucks.actuators["Visibility"]
|
|
29
|
+wheel1act = wheel1.actuators["Visibility"]
|
|
30
|
+wheel2act = wheel2.actuators["Visibility"]
|
|
31
|
+wheel3act = wheel3.actuators["Visibility"]
|
|
32
|
+wheel4act = wheel4.actuators["Visibility"]
|
|
33
|
+
|
|
34
|
+class getData:
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+ def savePosition(obj, cut):
|
|
39
|
+
|
|
40
|
+ position = [Vector(obj.worldPosition)[0],
|
|
41
|
+ Vector(obj.worldPosition)[1],
|
|
42
|
+ Vector(obj.worldPosition)[2]]
|
|
43
|
+ position = str(position).strip("[]")
|
|
44
|
+ position = position.replace(", ",",")
|
|
45
|
+
|
|
46
|
+ writeData.addPosition(obj, position, cut)
|
|
47
|
+
|
|
48
|
+ def saveOrientation(obj, cut):
|
|
49
|
+
|
|
50
|
+ orientation = [Vector(obj.localOrientation.to_euler())[0],
|
|
51
|
+ Vector(obj.localOrientation.to_euler())[1],
|
|
52
|
+ Vector(obj.localOrientation.to_euler())[2]]
|
|
53
|
+ orientation = str(orientation).strip("[]")
|
|
54
|
+ orientation = orientation.replace(", ",",")
|
|
55
|
+
|
|
56
|
+ writeData.addOrientation(obj, orientation, cut)
|
|
57
|
+
|
|
58
|
+ def saveScale(obj, cut):
|
|
59
|
+
|
|
60
|
+ scale = [Vector(obj.localScale)[0],
|
|
61
|
+ Vector(obj.localScale)[1],
|
|
62
|
+ Vector(obj.localScale)[2]]
|
|
63
|
+ scale = str(scale).strip("[]")
|
|
64
|
+ scale = scale.replace(", ",",")
|
|
65
|
+
|
|
66
|
+ writeData.addScale(obj, scale, cut)
|
|
67
|
+
|
|
68
|
+ def saveColor(obj, cut):
|
|
69
|
+
|
|
70
|
+ color = [Vector(obj.color)[0],
|
|
71
|
+ Vector(obj.color)[1],
|
|
72
|
+ Vector(obj.color)[2],
|
|
73
|
+ Vector(obj.color)[3]]
|
|
74
|
+ color = str(color).strip("[]")
|
|
75
|
+ color = color.replace(", ",",")
|
|
76
|
+
|
|
77
|
+ writeData.addColor(obj, color, cut)
|
|
78
|
+
|
|
79
|
+ def saveState(obj, cut):
|
|
80
|
+
|
|
81
|
+ state = str(obj.state)
|
|
82
|
+ writeData.addState(obj, state, cut)
|
|
83
|
+
|
|
84
|
+ def saveVisibility(obj, cut):
|
|
85
|
+
|
|
86
|
+ visible = obj.visible
|
|
87
|
+
|
|
88
|
+ if visible:
|
|
89
|
+ visible = 1
|
|
90
|
+ else:
|
|
91
|
+ visible = 0
|
|
92
|
+
|
|
93
|
+ writeData.addVisibility(obj, str(visible), cut)
|
|
94
|
+
|
|
95
|
+ def saveSkaterAnim(obj, cut):
|
|
96
|
+ import bge
|
|
97
|
+ scene = bge.logic.getCurrentScene()
|
|
98
|
+ skater = scene.objects["Char4"]
|
|
99
|
+ deck = scene.objects["deck"]
|
|
100
|
+ trucks = scene.objects["trucks"]
|
|
101
|
+ playing_layer = 0
|
|
102
|
+ for x in range(3020):
|
|
103
|
+ l1 = skater.isPlayingAction(x)
|
|
104
|
+ if l1 == True:
|
|
105
|
+ playing_layer = x
|
|
106
|
+ #print(x)
|
|
107
|
+ playing_action = skater.getActionName(playing_layer)
|
|
108
|
+ playing_action_frame = skater.getActionFrame(playing_layer)
|
|
109
|
+ PAF = playing_action_frame
|
|
110
|
+ own['PAF'] = PAF
|
|
111
|
+ #print(playing_action, playing_action_frame)
|
|
112
|
+ writeData.addSkaterAnim(obj, str(playing_action), cut)
|
|
113
|
+
|
|
114
|
+ def saveSkaterAnimF(obj, cut):
|
|
115
|
+ PAF = own['PAF']
|
|
116
|
+ writeData.addSkaterAnimF(obj, str(PAF), cut)
|
|
117
|
+
|
|
118
|
+ def saveDeckAnim(obj, cut):
|
|
119
|
+ import bge
|
|
120
|
+ scene = bge.logic.getCurrentScene()
|
|
121
|
+ skater = scene.objects["Char4"]
|
|
122
|
+ deck = scene.objects["deck"]
|
|
123
|
+ trucks = scene.objects["trucks"]
|
|
124
|
+ wheel1 = scene.objects["rollen.000"]
|
|
125
|
+ wheel2 = scene.objects["rollen.001"]
|
|
126
|
+ wheel3 = scene.objects["rollen.002"]
|
|
127
|
+ wheel4 = scene.objects["rollen.003"]
|
|
128
|
+ playing_layer = 0
|
|
129
|
+ for x in range(3020):
|
|
130
|
+ l1 = deck.isPlayingAction(x)
|
|
131
|
+ if l1 == True:
|
|
132
|
+ playing_layer = x
|
|
133
|
+ #print(x)
|
|
134
|
+ playing_action = deck.getActionName(playing_layer)
|
|
135
|
+ playing_action_frame = deck.getActionFrame(playing_layer)
|
|
136
|
+ DAF = playing_action_frame
|
|
137
|
+ own['DAF'] = DAF
|
|
138
|
+ #print(playing_action, playing_action_frame)
|
|
139
|
+ writeData.addDeckAnim(obj, str(playing_action), cut)
|
|
140
|
+
|
|
141
|
+ def saveDeckAnimF(obj, cut):
|
|
142
|
+ DAF = own['DAF']
|
|
143
|
+ writeData.addDeckAnimF(obj, str(DAF), cut)
|
|
144
|
+
|
|
145
|
+ def saveSrollVol(obj, cut):
|
|
146
|
+ num = cube['sroll_vol']
|
|
147
|
+ writeData.addSrollVol(obj, str(num), cut)
|
|
148
|
+ def saveSrollPitch(obj, cut):
|
|
149
|
+ num = cube['sroll_pitch']
|
|
150
|
+ writeData.addSrollPitch(obj, str(num), cut)
|
|
151
|
+
|
|
152
|
+ def saveSgrind_cementVol(obj, cut):
|
|
153
|
+ num = cube['grindcement_vol']
|
|
154
|
+ writeData.addSgrind_cementVol(obj, str(num), cut)
|
|
155
|
+ def saveSgrind_cementPitch(obj, cut):
|
|
156
|
+ num = cube['grindcement_pitch']
|
|
157
|
+ writeData.addSgrind_cementPitch(obj, str(num), cut)
|
|
158
|
+ def saveSgrind_railVol(obj, cut):
|
|
159
|
+ num = cube['grindrail_vol']
|
|
160
|
+ writeData.addSgrind_railVol(obj, str(num), cut)
|
|
161
|
+ def saveSgrind_railPitch(obj, cut):
|
|
162
|
+ num = cube['grindrail_pitch']
|
|
163
|
+ writeData.addSgrind_railPitch(obj, str(num), cut)
|
|
164
|
+ def saveSpopsound(obj, cut):
|
|
165
|
+ num = cube['pop_sound']
|
|
166
|
+ writeData.addSpopsound(obj, str(num), cut)
|
|
167
|
+ def saveSlandsound(obj, cut):
|
|
168
|
+ num = cube['land_sound']
|
|
169
|
+ writeData.addSlandsound(obj, str(num), cut)
|
|
170
|
+ def saveSdeckvis(obj, cut):
|
|
171
|
+ num = cube['deckvis']
|
|
172
|
+ writeData.addSdeckvis(obj, str(num), cut)
|
|
173
|
+
|
|
174
|
+def loadData():
|
|
175
|
+
|
|
176
|
+ #Function for loading the data from
|
|
177
|
+ #the disk and setting it.
|
|
178
|
+
|
|
179
|
+ objIndex = own["objIndex"]
|
|
180
|
+ own["valueIndex"] = objIndex + 1
|
|
181
|
+ valueIndex = own["valueIndex"]
|
|
182
|
+ playbackSpeed = own["playbackSpeed"]
|
|
183
|
+ loadedPosition = own["loadedPosition"]
|
|
184
|
+ loadedOrientation = own["loadedOrientation"]
|
|
185
|
+ loadedScale = own["loadedScale"]
|
|
186
|
+ loadedColor = own["loadedColor"]
|
|
187
|
+ loadedVisibility = own["loadedVisibility"]
|
|
188
|
+ loadedSkaterAnim = own["loadedSkaterAnim"]
|
|
189
|
+ loadedSkaterAnimf = own["loadedSkaterAnimF"]
|
|
190
|
+ loadedDeckAnim = own["loadedDeckAnim"]
|
|
191
|
+ loadedDeckAnimf = own["loadedDeckAnimF"]
|
|
192
|
+ loadedSrollVol = own["loadedSrollVol"]
|
|
193
|
+ loadedSrollPitch = own["loadedSrollPitch"]
|
|
194
|
+ loadedSgrind_cementlVol = own["loadedSgrind_cementVol"]
|
|
195
|
+ loadedSgrind_cementPitch = own["loadedSgrind_cementPitch"]
|
|
196
|
+ loadedSgrind_railVol = own["loadedSgrind_railVol"]
|
|
197
|
+ loadedSgrind_railPitch = own["loadedSgrind_railPitch"]
|
|
198
|
+ loadedSpopsound = own["loadedSpopsound"]
|
|
199
|
+ loadedSlandsound = own["loadedSlandsound"]
|
|
200
|
+ loadedSdeckvis = own["loadedSdeckvis"]
|
|
201
|
+
|
|
202
|
+ skater = scene.objects["Char4"]
|
|
203
|
+ deck = scene.objects["deck"]
|
|
204
|
+ trucks = scene.objects["trucks"]
|
|
205
|
+
|
|
206
|
+ num = 1
|
|
207
|
+ obj = scene.objects['control_cube.002']
|
|
208
|
+ if num == 1:
|
|
209
|
+ #for obj in scene.objects:
|
|
210
|
+ if not "recorder" in obj:
|
|
211
|
+ obj.state = 100
|
|
212
|
+ obj.suspendDynamics()
|
|
213
|
+
|
|
214
|
+ readData.loadAll() #Load the file!!!
|
|
215
|
+
|
|
216
|
+ #-----Position-----#
|
|
217
|
+ own["lengthPos"] = readData.getLengthPos()
|
|
218
|
+ lengthPos = own["lengthPos"]
|
|
219
|
+
|
|
220
|
+ if lengthPos:
|
|
221
|
+
|
|
222
|
+ if objIndex > lengthPos-1:
|
|
223
|
+ own["objIndex"] = 0
|
|
224
|
+ if objIndex < 0:
|
|
225
|
+ own["objIndex"] = lengthPos-2
|
|
226
|
+
|
|
227
|
+ name, position = readData.returnPosition(objIndex, valueIndex)
|
|
228
|
+
|
|
229
|
+ if name in scene.objects:
|
|
230
|
+ try:
|
|
231
|
+ scene.objects[name].worldPosition = position
|
|
232
|
+ scene.objects['replay_sound_empty'].worldPosition = position
|
|
233
|
+ #print("replay_sound_empty changing position")
|
|
234
|
+ except:
|
|
235
|
+ pass
|
|
236
|
+ #-----Orientation-----#
|
|
237
|
+ own["lengthOri"] = readData.getLengthOri()
|
|
238
|
+ lengthOri = own["lengthOri"]
|
|
239
|
+
|
|
240
|
+ if lengthPos:
|
|
241
|
+
|
|
242
|
+ if valueIndex > lengthOri-1:
|
|
243
|
+ own["valueIndex"] = 0
|
|
244
|
+ if objIndex < 0:
|
|
245
|
+ own["objIndex"] = lengthOri-2
|
|
246
|
+
|
|
247
|
+ name, orientation = readData.returnOrientation(objIndex, valueIndex)
|
|
248
|
+
|
|
249
|
+ if name in scene.objects:
|
|
250
|
+ oXYZ = scene.objects[name].localOrientation.to_euler()
|
|
251
|
+
|
|
252
|
+ oXYZ[0] = float(orientation[0])
|
|
253
|
+ oXYZ[1] = float(orientation[1])
|
|
254
|
+ oXYZ[2] = float(orientation[2])
|
|
255
|
+
|
|
256
|
+ try:
|
|
257
|
+ scene.objects[name].localOrientation = oXYZ.to_matrix()
|
|
258
|
+ except:
|
|
259
|
+ pass
|
|
260
|
+ #-----Scale-----#
|
|
261
|
+ own["lengthSca"] = readData.getLengthSca()
|
|
262
|
+ lengthSca = own["lengthSca"]
|
|
263
|
+
|
|
264
|
+ if lengthSca:
|
|
265
|
+
|
|
266
|
+ if valueIndex > lengthSca-1:
|
|
267
|
+ own["valueIndex"] = 0
|
|
268
|
+ if objIndex < 0:
|
|
269
|
+ own["objIndex"] = lengthSca-2
|
|
270
|
+
|
|
271
|
+ name, scale = readData.returnScale(objIndex, valueIndex)
|
|
272
|
+
|
|
273
|
+ if name in scene.objects:
|
|
274
|
+ try:
|
|
275
|
+ scene.objects[name].localScale = scale
|
|
276
|
+ except:
|
|
277
|
+ pass
|
|
278
|
+ #-----Color-----#
|
|
279
|
+ own["lengthCol"] = readData.getLengthCol()
|
|
280
|
+ lengthCol = own["lengthCol"]
|
|
281
|
+
|
|
282
|
+ if lengthCol:
|
|
283
|
+
|
|
284
|
+ if valueIndex > lengthCol-1:
|
|
285
|
+ own["valueIndex"] = 0
|
|
286
|
+ if objIndex < 0:
|
|
287
|
+ own["objIndex"] = lengthCol-2
|
|
288
|
+
|
|
289
|
+ name, color = readData.returnColor(objIndex, valueIndex)
|
|
290
|
+
|
|
291
|
+ if name in scene.objects:
|
|
292
|
+ try:
|
|
293
|
+ scene.objects[name].color = color
|
|
294
|
+ except:
|
|
295
|
+ pass
|
|
296
|
+ #-----Visibility-----#
|
|
297
|
+ own["lengthVis"] = readData.getLengthVis()
|
|
298
|
+ lengthVis = own["lengthVis"]
|
|
299
|
+
|
|
300
|
+ if lengthVis:
|
|
301
|
+
|
|
302
|
+ if valueIndex > lengthVis-1:
|
|
303
|
+ own["valueIndex"] = 0
|
|
304
|
+ if objIndex < 0:
|
|
305
|
+ own["objIndex"] = lengthVis-2
|
|
306
|
+
|
|
307
|
+ name, visible = readData.returnVisibility(objIndex, valueIndex)
|
|
308
|
+
|
|
309
|
+ if name in scene.objects:
|
|
310
|
+ try:
|
|
311
|
+ scene.objects[name].visible = int(visible)
|
|
312
|
+ except:
|
|
313
|
+ pass
|
|
314
|
+ #-----Skater Animation Name-----#
|
|
315
|
+ own["lengthSkaterAnim"] = readData.getLengthSkaterAnim()
|
|
316
|
+ lengthSkaterAnim = own["lengthSkaterAnim"]
|
|
317
|
+ #print("lengthskateranim", lengthSkaterAnim)
|
|
318
|
+ if lengthSkaterAnim:
|
|
319
|
+
|
|
320
|
+ if valueIndex > lengthSkaterAnim-1:
|
|
321
|
+ own["valueIndex"] = 0
|
|
322
|
+ if objIndex < 0:
|
|
323
|
+ own["objIndex"] = lengthSkaterAnim-2
|
|
324
|
+
|
|
325
|
+ name, skateranim = readData.returnSkaterAnim(objIndex, valueIndex)
|
|
326
|
+ name, PAF = readData.returnSkaterAnimF(objIndex, valueIndex)
|
|
327
|
+ #print(PAF)
|
|
328
|
+ PAF = float(PAF)
|
|
329
|
+ if name in scene.objects:
|
|
330
|
+ #print("name in")
|
|
331
|
+ try:
|
|
332
|
+ skater.stopAction(0)
|
|
333
|
+ skater.stopAction(1)
|
|
334
|
+ skater.stopAction(2)
|
|
335
|
+ skater.stopAction(3)
|
|
336
|
+ skater.stopAction(9999)
|
|
337
|
+ if skater != '':
|
|
338
|
+ skater.playAction(skateranim, PAF,PAF, layer=9999, play_mode=1, speed=1)
|
|
339
|
+ #print("Playing: ", skateranim, PAF)
|
|
340
|
+ except:
|
|
341
|
+ print("something is wrong")
|
|
342
|
+ #pass
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+ #-----Deck Animation Name-----#
|
|
346
|
+ own["lengthDeckAnim"] = readData.getLengthDeckAnim()
|
|
347
|
+ lengthDeckAnim = own["lengthDeckAnim"]
|
|
348
|
+ #print("lengthDeckanim", lengthDeckAnim)
|
|
349
|
+ if lengthDeckAnim:
|
|
350
|
+
|
|
351
|
+ if valueIndex > lengthDeckAnim-1:
|
|
352
|
+ own["valueIndex"] = 0
|
|
353
|
+ if objIndex < 0:
|
|
354
|
+ own["objIndex"] = lengthDeckAnim-2
|
|
355
|
+
|
|
356
|
+ name, deckanim = readData.returnDeckAnim(objIndex, valueIndex)
|
|
357
|
+ name, DAF = readData.returnDeckAnimF(objIndex, valueIndex)
|
|
358
|
+ #print(DAF)
|
|
359
|
+ DAF = float(DAF)
|
|
360
|
+ if name in scene.objects:
|
|
361
|
+ #print("name in")
|
|
362
|
+ try:
|
|
363
|
+ deck.stopAction(0)
|
|
364
|
+ deck.stopAction(1)
|
|
365
|
+ deck.stopAction(2)
|
|
366
|
+ deck.stopAction(3)
|
|
367
|
+ deck.stopAction(9999)
|
|
368
|
+ #print(deckanim)
|
|
369
|
+ if deckanim != '':
|
|
370
|
+ deck.playAction(deckanim, DAF,DAF, layer=9999, play_mode=1, speed=1)
|
|
371
|
+ trucks.playAction(deckanim, DAF,DAF, layer=9999, play_mode=1, speed=1)
|
|
372
|
+ #print("Playing: ", deckanim, PAF)
|
|
373
|
+ except:
|
|
374
|
+ print("deck something is wrong")
|
|
375
|
+ #pass
|
|
376
|
+
|
|
377
|
+#
|
|
378
|
+ #-----sroll-----#
|
|
379
|
+ own["lengthSrollVol"] = readData.getLengthSrollVol()
|
|
380
|
+ lengthSrollVol = own["lengthSrollVol"]
|
|
381
|
+ if lengthSrollVol:
|
|
382
|
+ if valueIndex > lengthSrollVol-1:
|
|
383
|
+ own["valueIndex"] = 0
|
|
384
|
+ if objIndex < 0:
|
|
385
|
+ own["objIndex"] = lengthSrollVol-2
|
|
386
|
+ name, srollVol = readData.returnSrollVol(objIndex, valueIndex)
|
|
387
|
+ name, srollPitch = readData.returnSrollPitch(objIndex, valueIndex)
|
|
388
|
+ if name in scene.objects:
|
|
389
|
+ try:
|
|
390
|
+ cube = scene.objects["control_cube.002"]
|
|
391
|
+ srollVol = round(srollVol, 2)
|
|
392
|
+ act = cube.actuators["sroll"]
|
|
393
|
+ if srollVol < .12:
|
|
394
|
+ act.volume = srollVol
|
|
395
|
+ act.pitch = srollPitch
|
|
396
|
+ act.startSound()
|
|
397
|
+ except:
|
|
398
|
+ pass
|
|
399
|
+###
|
|
400
|
+#
|
|
401
|
+ #-----grind cement-----#
|
|
402
|
+ own["lengthSgrind_cementVol"] = readData.getLengthSgrind_cementVol()
|
|
403
|
+ lengthSgrind_cementVol = own["lengthSgrind_cementVol"]
|
|
404
|
+ if lengthSgrind_cementVol:
|
|
405
|
+ if valueIndex > lengthSgrind_cementVol-1:
|
|
406
|
+ own["valueIndex"] = 0
|
|
407
|
+ if objIndex < 0:
|
|
408
|
+ own["objIndex"] = lengthSgrind_cementVol-2
|
|
409
|
+ name, sgrind_cementVol = readData.returnSgrind_cementVol(objIndex, valueIndex)
|
|
410
|
+ name, sgrind_cementPitch = readData.returnSgrind_cementPitch(objIndex, valueIndex)
|
|
411
|
+ if name in scene.objects:
|
|
412
|
+ try:
|
|
413
|
+ cube = scene.objects["control_cube.002"]
|
|
414
|
+ sgrind_cementVol = round(sgrind_cementVol, 2)
|
|
415
|
+ act = cube.actuators["grind_cement"]
|
|
416
|
+ if sgrind_cementVol < .2:
|
|
417
|
+ act.volume = sgrind_cementVol
|
|
418
|
+ act.pitch = sgrind_cementPitch
|
|
419
|
+ act.startSound()
|
|
420
|
+
|
|
421
|
+ except:
|
|
422
|
+ pass
|
|
423
|
+###
|
|
424
|
+#
|
|
425
|
+ #-----grind rail-----#
|
|
426
|
+ own["lengthSgrind_railVol"] = readData.getLengthSgrind_railVol()
|
|
427
|
+ lengthSgrind_railVol = own["lengthSgrind_railVol"]
|
|
428
|
+ if lengthSgrind_railVol:
|
|
429
|
+ if valueIndex > lengthSgrind_railVol-1:
|
|
430
|
+ own["valueIndex"] = 0
|
|
431
|
+ if objIndex < 0:
|
|
432
|
+ own["objIndex"] = lengthSgrind_railVol-2
|
|
433
|
+ name, sgrind_railVol = readData.returnSgrind_railVol(objIndex, valueIndex)
|
|
434
|
+ name, sgrind_railPitch = readData.returnSgrind_railPitch(objIndex, valueIndex)
|
|
435
|
+ if name in scene.objects:
|
|
436
|
+ try:
|
|
437
|
+ cube = scene.objects["control_cube.002"]
|
|
438
|
+ sgrind_railVol = round(sgrind_railVol, 2)
|
|
439
|
+ act = cube.actuators["grind_rail"]
|
|
440
|
+ if sgrind_railVol < .2:
|
|
441
|
+ act.volume = sgrind_railVol
|
|
442
|
+ act.pitch = sgrind_railPitch
|
|
443
|
+ act.startSound()
|
|
444
|
+ #print("grindsound = ", sgrind_railVol, sgrind_railPitch)
|
|
445
|
+ except:
|
|
446
|
+ pass
|
|
447
|
+###
|
|
448
|
+#
|
|
449
|
+ #-----pop sound-----#
|
|
450
|
+ own["lengthSpopsound"] = readData.getLengthSpopsound()
|
|
451
|
+ lengthSpopsound = own["lengthSpopsound"]
|
|
452
|
+ if lengthSpopsound:
|
|
453
|
+ if valueIndex > lengthSpopsound-1:
|
|
454
|
+ own["valueIndex"] = 0
|
|
455
|
+ if objIndex < 0:
|
|
456
|
+ own["objIndex"] = lengthSpopsound-2
|
|
457
|
+ name, spopsound = readData.returnSpopsound(objIndex, valueIndex)
|
|
458
|
+ if name in scene.objects:
|
|
459
|
+ try:
|
|
460
|
+ #cube = scene.objects[sound_empty]
|
|
461
|
+ spopsound = round(spopsound, 2)
|
|
462
|
+ act = cube.actuators["pop"]
|
|
463
|
+ if spopsound == 1:
|
|
464
|
+ act.startSound()
|
|
465
|
+ #print("grindsound = ", spopsound, sgrind_railPitch)
|
|
466
|
+ except:
|
|
467
|
+ print("sound passed")
|
|
468
|
+ pass
|
|
469
|
+###
|
|
470
|
+#
|
|
471
|
+ #-----land sound-----#
|
|
472
|
+ own["lengthSlandsound"] = readData.getLengthSlandsound()
|
|
473
|
+ lengthSlandsound = own["lengthSlandsound"]
|
|
474
|
+ if lengthSlandsound:
|
|
475
|
+ if valueIndex > lengthSlandsound-1:
|
|
476
|
+ own["valueIndex"] = 0
|
|
477
|
+ if objIndex < 0:
|
|
478
|
+ own["objIndex"] = lengthSlandsound-2
|
|
479
|
+ name, slandsound = readData.returnSlandsound(objIndex, valueIndex)
|
|
480
|
+ if name in scene.objects:
|
|
481
|
+ try:
|
|
482
|
+ cube = scene.objects["control_cube.002"]
|
|
483
|
+ slandsound = round(slandsound, 2)
|
|
484
|
+ act = cube.actuators["land"]
|
|
485
|
+ if slandsound == 1:
|
|
486
|
+ act.startSound()
|
|
487
|
+ #print("grindsound = ", slandsound, sgrind_railPitch)
|
|
488
|
+ except:
|
|
489
|
+ pass
|
|
490
|
+###
|
|
491
|
+###
|
|
492
|
+#
|
|
493
|
+ #-----land sound-----#
|
|
494
|
+ own["lengthSdeckvis"] = readData.getLengthSdeckvis()
|
|
495
|
+ lengthSdeckvis = own["lengthSdeckvis"]
|
|
496
|
+ if lengthSdeckvis:
|
|
497
|
+ if valueIndex > lengthSdeckvis-1:
|
|
498
|
+ own["valueIndex"] = 0
|
|
499
|
+ if objIndex < 0:
|
|
500
|
+ own["objIndex"] = lengthSdeckvis-2
|
|
501
|
+ name, sdeckvis = readData.returnSdeckvis(objIndex, valueIndex)
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+ if name in scene.objects:
|
|
505
|
+ try:
|
|
506
|
+ cube = scene.objects["control_cube.002"]
|
|
507
|
+ #slandsound = round(slandsound, 2)
|
|
508
|
+ if sdeckvis == 1:
|
|
509
|
+ print('setting deck visible')
|
|
510
|
+ #wheel1.visible = True
|
|
511
|
+ #wheel2.visible = True
|
|
512
|
+ #wheel3.visible = True
|
|
513
|
+ #wheel4.visible = True
|
|
514
|
+ #deck.visible = True
|
|
515
|
+ #trucks.setVisible(True, True)
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+ deckact.visibility = True
|
|
519
|
+ trucksact.visibility = True
|
|
520
|
+ wheel1act.visibility = True
|
|
521
|
+ wheel2act.visibility = True
|
|
522
|
+ wheel3act.visibility = True
|
|
523
|
+ wheel4act.visibility = True
|
|
524
|
+ cont.activate(deck.actuators['Visibility'])
|
|
525
|
+ cont.activate(trucks.actuators['Visibility'])
|
|
526
|
+ cont.activate(wheel1.actuators['Visibility'])
|
|
527
|
+ cont.activate(wheel2.actuators['Visibility'])
|
|
528
|
+ cont.activate(wheel3.actuators['Visibility'])
|
|
529
|
+ cont.activate(wheel4.actuators['Visibility'])
|
|
530
|
+
|
|
531
|
+ else:
|
|
532
|
+ print('setting deck invisible')
|
|
533
|
+ #wheel1.visible = False
|
|
534
|
+ #wheel2.visible = False
|
|
535
|
+ #wheel3.visible = False
|
|
536
|
+ #wheel4.visible = False
|
|
537
|
+ #deck.visible = False
|
|
538
|
+ #trucks.setVisible(False, False)
|
|
539
|
+
|
|
540
|
+ deckact.visibility = False
|
|
541
|
+ trucksact.visibility = False
|
|
542
|
+ wheel1act.visibility = False
|
|
543
|
+ wheel2act.visibility = False
|
|
544
|
+ wheel3act.visibility = False
|
|
545
|
+ wheel4act.visibility = False
|
|
546
|
+ cont.activate(deck.actuators['Visibility'])
|
|
547
|
+ cont.activate(trucks.actuators['Visibility'])
|
|
548
|
+ cont.activate(wheel1.actuators['Visibility'])
|
|
549
|
+ cont.activate(wheel2.actuators['Visibility'])
|
|
550
|
+ cont.activate(wheel3.actuators['Visibility'])
|
|
551
|
+ cont.activate(wheel4.actuators['Visibility'])
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+ except:
|
|
556
|
+ pass
|
|
557
|
+##
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+def main(recording_cutoff, cc):
|
|
562
|
+ num = 1
|
|
563
|
+ obj = scene.objects["control_cube.002"]
|
|
564
|
+ if num == 1:
|
|
565
|
+
|
|
566
|
+ #for obj in scene.objects:
|
|
567
|
+ if "record_position" in obj:
|
|
568
|
+ getData.savePosition(obj, recording_cutoff)
|
|
569
|
+ if "record_orientation" in obj:
|
|
570
|
+ getData.saveOrientation(obj, recording_cutoff)
|
|
571
|
+ if "record_scale" in obj:
|
|
572
|
+ getData.saveScale(obj, recording_cutoff)
|
|
573
|
+ if "record_color" in obj:
|
|
574
|
+ getData.saveColor(obj, recording_cutoff)
|
|
575
|
+ if "record_state" in obj:
|
|
576
|
+ getData.saveState(obj, recording_cutoff)
|
|
577
|
+ if "record_visibility" in obj:
|
|
578
|
+ getData.saveVisibility(obj, recording_cutoff)
|
|
579
|
+ if "record_skateranim" in obj:
|
|
580
|
+ getData.saveSkaterAnim(obj, recording_cutoff)
|
|
581
|
+ if "record_skateranimf" in obj:
|
|
582
|
+ getData.saveSkaterAnimF(obj, recording_cutoff)
|
|
583
|
+ if "record_deckanim" in obj:
|
|
584
|
+ getData.saveDeckAnim(obj, recording_cutoff)
|
|
585
|
+ if "record_deckanimf" in obj:
|
|
586
|
+ getData.saveDeckAnimF(obj, recording_cutoff)
|
|
587
|
+ #if "record_sroll_vol" in obj:
|
|
588
|
+ getData.saveSrollVol(obj, recording_cutoff)
|
|
589
|
+ #if "record_sroll_pitch" in obj:
|
|
590
|
+ getData.saveSrollPitch(obj, recording_cutoff)
|
|
591
|
+ getData.saveSgrind_cementVol(obj, recording_cutoff)
|
|
592
|
+ getData.saveSgrind_cementPitch(obj, recording_cutoff)
|
|
593
|
+ getData.saveSgrind_railVol(obj, recording_cutoff)
|
|
594
|
+ getData.saveSgrind_railPitch(obj, recording_cutoff)
|
|
595
|
+ getData.saveSpopsound(obj, recording_cutoff)
|
|
596
|
+ getData.saveSlandsound(obj, recording_cutoff)
|
|
597
|
+ getData.saveSdeckvis(obj, recording_cutoff)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+def breakOut():
|
|
601
|
+ num = 1
|
|
602
|
+ obj = scene.objects["control_cube.002"]
|
|
603
|
+ if num == 1:
|
|
604
|
+ #for obj in scene.objects:
|
|
605
|
+ obj.restoreDynamics()
|
|
606
|
+ try:
|
|
607
|
+ name, state = readData.returnState(own["objIndex"], own["valueIndex"])
|
|
608
|
+ obj.state = state
|
|
609
|
+ except:
|
|
610
|
+ pass
|