Hi, I have a strange behavior with my execute Dat. I run it every frame to get position form a Kinect. It works perfectly except when I lunch TouchDesigner. I have to manually change a value and then save again to make it works.
Player1_x = op('Kinect/output_spine_x')['p1/spine:tx']
Player2_x = op('Kinect/output_spine_x')['p2/spine:tx']
Player3_x = op('Kinect/output_spine_x')['p3/spine:tx']
Player4_x = op('Kinect/output_spine_x')['p4/spine:tx']
Player5_x = op('Kinect/output_spine_x')['p5/spine:tx']
Player6_x = op('Kinect/output_spine_x')['p6/spine:tx']
players_x = [Player1_x, Player2_x, Player3_x, Player4_x, Player5_x, Player6_x]
Player1_z = op('Kinect/output_spine_z')['p1/spine:tz']
Player2_z = op('Kinect/output_spine_z')['p2/spine:tz']
Player3_z = op('Kinect/output_spine_z')['p3/spine:tz']
Player4_z = op('Kinect/output_spine_z')['p4/spine:tz']
Player5_z = op('Kinect/output_spine_z')['p5/spine:tz']
Player6_z = op('Kinect/output_spine_z')['p6/spine:tz']
players_z = [Player1_z, Player2_z, Player3_z, Player4_z, Player5_z, Player6_z]
p1_pos_id = 0
p2_pos_id = 0
p3_pos_id = 0
p4_pos_id = 0
p5_pos_id = 0
p6_pos_id = 0
players_pos_id = [p1_pos_id, p2_pos_id, p3_pos_id, p4_pos_id, p5_pos_id, p6_pos_id]
p_detect1 = op('Kinect/output_id')['p1/id']
p_detect2 = op('Kinect/output_id')['p2/id']
p_detect3 = op('Kinect/output_id')['p3/id']
p_detect4 = op('Kinect/output_id')['p4/id']
p_detect5 = op('Kinect/output_id')['p5/id']
p_detect6 = op('Kinect/output_id')['p6/id']
players_detection = [p_detect1, p_detect2, p_detect3, p_detect4, p_detect5, p_detect6]
index_G = op('ecran_G/ecran_Jeu_G/null1')['index']
index_C = op('ecran_C/ecran_Jeu_C/null1')['index']
index_D = op('ecran_D/ecran_Jeu_D/null1')['index']
index_transition_G = op('ecran_G/ecran_Jeu_G/null2')['index']
index_transition_C = op('ecran_C/ecran_Jeu_C/null2')['index']
index_transition_D = op('ecran_D/ecran_Jeu_D/null2')['index']
lenght = 1334
lenght_transition = 117
def onFrameStart(frame):
leftOn = False
centerOn = False
rightOn = False
# Players ID
for i in range(len(players_x)) :
if players_detection[i] != 0 and players_z[i] < 5.0 : # <- inscrire la distance maximum en z ici
if players_x[i] <=0.33 :
players_pos_id[i] = 1
elif players_x[i] > 0.33 and players_x[i] <= 0.66 :
players_pos_id[i] = 2
elif players_x[i] > 0.66 :
players_pos_id[i] = 3
# conditions
if players_pos_id[i] == 1 :
leftOn = True
if players_pos_id[i] == 2 :
centerOn = True
if players_pos_id[i] == 3 :
rightOn = True
# -------------- LEFT --------------- #
# ----- ON ----- #
if leftOn :
op('ecran_G/ecran_Jeu_G/playback').par.value0 = 60
op('ecran_G/ecran_Veille_G/On_Off').par.value0 = 0
op('ecran_G/ecran_Veille_G/BG_alpha').par.value0 = 0
op('ecran_G/ecran_Veille_G/aspiration').par.value0 = 25
if index_G == lenght -1 :
op('ecran_G/ecran_Jeu_G/limit1').par.min = 0
if index_transition_G > lenght_transition :
op('ecran_G/ecran_Jeu_G/playback_transition').par.value0 = 0
else :
op('ecran_G/ecran_Jeu_G/playback_transition').par.value0 = 60
# ----- OFF ----- #
else :
op('ecran_G/ecran_Veille_G/On_Off').par.value0 = 0.4
op('ecran_G/ecran_Veille_G/BG_alpha').par.value0 = 1
op('ecran_G/ecran_Veille_G/aspiration').par.value0 = 2
op('ecran_G/ecran_Jeu_G/limit1').par.min = 0
if op('ecran_G/ecran_Jeu_G/null3')['vitesse'] < 3 :
op('ecran_G/ecran_Jeu_G/playback').par.value0 = 0
else :
op('ecran_G/ecran_Jeu_G/playback').par.value0 = -60
if index_transition_G < 3 :
op('ecran_G/ecran_Jeu_G/playback_transition').par.value0 = 0
else :
op('ecran_G/ecran_Jeu_G/playback_transition').par.value0 = -60
# -------------- CENTER ---------------- #
# ----- ON ----- #
if centerOn :
op('ecran_C/ecran_Jeu_C/playback').par.value0 = 60
op('ecran_C/ecran_Veille_C/On_Off').par.value0 = 0
op('ecran_C/ecran_Veille_C/BG_alpha').par.value0 = 0
op('ecran_C/ecran_Veille_C/aspiration').par.value0 = 25
if index_C == lenght -1 :
op('ecran_C/ecran_Jeu_C/limit1').par.min = 0
if index_transition_C > lenght_transition :
op('ecran_C/ecran_Jeu_C/playback_transition').par.value0 = 0
else :
op('ecran_C/ecran_Jeu_C/playback_transition').par.value0 = 60
# ----- OFF ----- #
else :
op('ecran_C/ecran_Veille_C/On_Off').par.value0 = 0.4
op('ecran_C/ecran_Veille_C/BG_alpha').par.value0 = 1
op('ecran_C/ecran_Veille_C/aspiration').par.value0 = 2
op('ecran_C/ecran_Jeu_C/limit1').par.min = 0
if op('ecran_C/ecran_Jeu_C/null3')['vitesse'] < 3 :
op('ecran_C/ecran_Jeu_C/playback').par.value0 = 0
else :
op('ecran_C/ecran_Jeu_C/playback').par.value0 = -60
if index_transition_C < 3 :
op('ecran_C/ecran_Jeu_C/playback_transition').par.value0 = 0
else :
op('ecran_C/ecran_Jeu_C/playback_transition').par.value0 = -60
# -------------- RIGHT ---------------- #
# ----- ON ----- #
if rightOn :
op('ecran_D/ecran_Jeu_D/playback').par.value0 = 60
op('ecran_D/ecran_Veille_D/On_Off').par.value0 = 0
op('ecran_D/ecran_Veille_D/BG_alpha').par.value0 = 0
op('ecran_D/ecran_Veille_D/aspiration').par.value0 = 25
if index_D == lenght -1 :
op('ecran_D/ecran_Jeu_D/limit1').par.min = 0
if index_transition_D > lenght_transition :
op('ecran_D/ecran_Jeu_D/playback_transition').par.value0 = 0
else :
op('ecran_D/ecran_Jeu_D/playback_transition').par.value0 = 60
# ----- OFF ----- #
else :
op('ecran_D/ecran_Veille_D/On_Off').par.value0 = 0.4
op('ecran_D/ecran_Veille_D/BG_alpha').par.value0 = 1
op('ecran_D/ecran_Veille_D/aspiration').par.value0 = 2
op('ecran_D/ecran_Jeu_D/limit1').par.min = 0
if op('ecran_D/ecran_Jeu_D/null3')['vitesse'] < 3 :
op('ecran_D/ecran_Jeu_D/playback').par.value0 = 0
else :
op('ecran_D/ecran_Jeu_D/playback').par.value0 = -60
if index_transition_D < 3 :
op('ecran_D/ecran_Jeu_D/playback_transition').par.value0 = 0
else :
op('ecran_D/ecran_Jeu_D/playback_transition').par.value0 = -60
return
It says : cannot find function named : OnFrameStart as an error on my script.
Do you have any way to make this work without having to change it manually?
Thanks