IdiotIA anims
This commit is contained in:
parent
b6139525a5
commit
28b1fb71f4
10
LJ.conf
10
LJ.conf
@ -1,13 +1,13 @@
|
||||
[General]
|
||||
lasernumber = 4
|
||||
debug = 0
|
||||
ljayserverip = 192.168.2.13
|
||||
debug = 2
|
||||
ljayserverip = 127.0.0.1
|
||||
nozoscip = 127.0.0.1
|
||||
bhoroscip = 192.168.2.13
|
||||
bhoroscip = 127.0.0.1
|
||||
|
||||
[laser0]
|
||||
color = -1
|
||||
ip = 127.0.0.1
|
||||
ip = 192.168.1.4
|
||||
kpps = 25000
|
||||
centerx = -1610
|
||||
centery = 0
|
||||
@ -64,7 +64,7 @@ warpdest = [[-1500., 1500.],
|
||||
|
||||
[laser3]
|
||||
color = -1
|
||||
ip = 192.168.1.4
|
||||
ip = 192.168.1.5
|
||||
kpps = 25000
|
||||
centerx = -12
|
||||
centery = 0
|
||||
|
9
cli.py
9
cli.py
@ -24,7 +24,7 @@ def handle():
|
||||
#have to be done before importing bhorosc.py to get correct port assignment
|
||||
argsparser = argparse.ArgumentParser(description="LJ v0.8")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP address to bind builtin servers (OSC and websocket) also must be the Redis server IP ",type=str)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected.",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (4 by default).",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Debug mode 0,1 or 2 (0 by default)",type=int)
|
||||
argsparser.add_argument("-x","--invx",help="Invert laser 0 X axis again",action="store_true")
|
||||
argsparser.add_argument("-y","--invy",help="Invert laser 0 Y axis again",action="store_true")
|
||||
@ -109,12 +109,15 @@ def handle():
|
||||
# Lasers = number of laser connected
|
||||
if args.Lasers != None:
|
||||
gstt.LaserNumber = args.Lasers
|
||||
|
||||
else:
|
||||
gstt.LaserNumber = 4
|
||||
|
||||
|
||||
if args.bhoroscIP != None:
|
||||
gstt.oscIPin = args.bhoroscIP
|
||||
else:
|
||||
gstt.oscIPin = gstt.LjayServerIP
|
||||
gstt.oscIPin = '127.0.0.1'
|
||||
|
||||
|
||||
if args.nozoidIP != None:
|
||||
gstt.nozoscIP = args.nozoidIP
|
||||
|
@ -117,6 +117,7 @@ def OSCsend(name, oscaddress, oscargs =''):
|
||||
def Ping(name):
|
||||
|
||||
return OSCsend(name,"/ping")
|
||||
#return True
|
||||
|
||||
|
||||
def Kill(name):
|
||||
|
@ -9,6 +9,7 @@ IdiotIA for THSF 10
|
||||
|
||||
Include IdiotIA and Starfields
|
||||
|
||||
/pose/ljclient
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, Loloster,
|
||||
@ -41,15 +42,22 @@ xy_center = [screen_size[0]/2,screen_size[1]/2]
|
||||
message = "LO"
|
||||
OSCinPort = 8011
|
||||
|
||||
redisIP = '127.0.0.1'
|
||||
ljclient = 0
|
||||
|
||||
idiotiaDisplay = [True,True,True,True]
|
||||
liveDisplay = [False,False,False,False]
|
||||
fieldsDisplay = [False,False,False,False]
|
||||
currentIdiotia = 0
|
||||
|
||||
print ("")
|
||||
print ("Arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Pose bank for LJ")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-a","--anim",help="IdiotIA anim (0 by default)",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (4 by default).",type=int)
|
||||
|
||||
args = argsparser.parse_args()
|
||||
|
||||
@ -64,12 +72,29 @@ if args.client:
|
||||
else:
|
||||
ljclient = 0
|
||||
|
||||
if args.anim:
|
||||
currentIdiotia = args.anim
|
||||
else:
|
||||
currentIdiotia = 0
|
||||
|
||||
# Redis Computer IP
|
||||
if args.redisIP != None:
|
||||
redisIP = args.redisIP
|
||||
else:
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
# Lasers = number of laser connected
|
||||
if args.Lasers != None:
|
||||
LaserNumber = args.Lasers
|
||||
else:
|
||||
LaserNumber = 4
|
||||
|
||||
|
||||
lj3.Config(redisIP,ljclient)
|
||||
|
||||
@ -135,6 +160,16 @@ def eyeL(pose_json, people):
|
||||
pose_points = [42,43,44,45,46,47,42]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupR(pose_json, people):
|
||||
pose_points = [68,68]
|
||||
print(getFACE(pose_json,pose_points, people))
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupL(pose_json, people):
|
||||
pose_points = [69,69]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
|
||||
def nose(pose_json, people):
|
||||
pose_points = [27,28,29,30]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
@ -145,34 +180,65 @@ def mouth(pose_json, people):
|
||||
|
||||
|
||||
|
||||
def prepareIdiotIA():
|
||||
def prepareIdiotIA(currentAnim):
|
||||
|
||||
|
||||
WebStatus("Init IdiotIA...")
|
||||
WebStatus("Checking anims...")
|
||||
|
||||
print()
|
||||
print("Reading available IdiotIA anims...")
|
||||
# anim format (name, xpos, ypos, resize, currentframe, totalframe, count, speed)
|
||||
# 0 1 2 3 4 5 6 7
|
||||
# total frames is fetched from directory by lengthPOSE()
|
||||
|
||||
anims[0] = [['idiotia1', xy_center[0], xy_center[1], 300,0,0,0,5]]
|
||||
anims[1] = [['idiotia1', xy_center[0], xy_center[1] + 50, 400,0,0,0,15]]
|
||||
anims[2] = [['idiotia1', xy_center[0], xy_center[1] + 50, 500,0,0,0,25]]
|
||||
anims[3] = [['idiotia1', xy_center[0], xy_center[1], 500,0,0,0,25]]
|
||||
anims[0] = [['boredhh', xy_center[0], xy_center[1] + 130, 550,0,0,0,5]]
|
||||
anims[1] = [['belka4', xy_center[0], xy_center[1] + 280, 600,0,0,0,5]]
|
||||
anims[2] = [['belka3', xy_center[0], xy_center[1] + 280, 600,0,0,0,5]]
|
||||
anims[3] = [['hhbored2', xy_center[0], xy_center[1]+ 300, 600,0,0,0,5]]
|
||||
anims[4] = [['hhhead', xy_center[0], xy_center[1]+ 300, 600,0,0,0,5]]
|
||||
anims[5] = [['hhhead2', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[6] = [['hhhead4', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[7] = [['hhred', xy_center[0], xy_center[1]+ 300, 600,0,0,0,25]]
|
||||
anims[8] = [['hhred2', xy_center[0], xy_center[1]+ 300, 600,0,0,0,5]]
|
||||
anims[9] = [['lady1', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[10] = [['lady2', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[11] = [['lady3', xy_center[0], xy_center[1]+ 300, 600,0,0,0,25]]
|
||||
anims[12] = [['lady4', xy_center[0], xy_center[1]+ 300, 600,0,0,0,5]]
|
||||
anims[13] = [['mila6', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[14] = [['mila5', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[15] = [['idiotia1', xy_center[0], xy_center[1]+ 300, 600,0,0,0,25]]
|
||||
anims[16] = [['idiotia1', xy_center[0], xy_center[1]+ 300, 600,0,0,0,5]]
|
||||
anims[17] = [['belka4', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
anims[18] = [['belka3', xy_center[0], xy_center[1] + 280, 600,0,0,0,30]]
|
||||
|
||||
|
||||
for laseranims in anims:
|
||||
|
||||
for anim in laseranims:
|
||||
anim[5] = lengthPOSE(anim[0])
|
||||
|
||||
WebStatus("Checking "+ anim[0] +"...")
|
||||
if debug > 0:
|
||||
print("anim :", 'poses/' + anim[0], "length :", anim[5], "frames")
|
||||
print('poses/' + anim[0], "length :", anim[5], "frames")
|
||||
|
||||
print("Current IdiotIA anim is",anims[currentIdiotia][0],"("+str(currentIdiotia)+")")
|
||||
|
||||
|
||||
# display the face animation describe in PoseDir
|
||||
|
||||
|
||||
# display the currentIdiotia animation on all lasers according to display flag
|
||||
def IdiotIA():
|
||||
|
||||
for laseranims in range(3):
|
||||
for anim in anims[laseranims]:
|
||||
PL = laseranims
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if idiotiaDisplay[laser]:
|
||||
|
||||
anim = anims[currentIdiotia][0]
|
||||
#print(anim)
|
||||
|
||||
PL = laser
|
||||
#print PL, anim
|
||||
|
||||
dots = []
|
||||
@ -189,23 +255,25 @@ def IdiotIA():
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
# Face
|
||||
# Draw Face
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
#lj3.rPolyLineOneColor(face(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browL(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browR(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeR(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeL(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(nose(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(mouth(pose_json, people), c=color, PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(face(pose_json, people), c = white, PL = laser closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(nose(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(mouth(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
lj3.DrawPL(PL)
|
||||
time.sleep(0.02)
|
||||
|
||||
|
||||
# many starfields
|
||||
# Init Starfields
|
||||
def prepareSTARFIELD():
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
@ -230,6 +298,9 @@ def prepareSTARFIELD():
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars2.append(star)
|
||||
|
||||
|
||||
# Todo : Currently compute all starfields even if field display flag is False.
|
||||
|
||||
def Starfield(hori=0,verti=0):
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
@ -313,16 +384,16 @@ def Starfield(hori=0,verti=0):
|
||||
y2 = int(stars2[starnumber][1] * k2 + xy_center[1] + (verti*300))
|
||||
|
||||
|
||||
# Add star to pointlist PL 0
|
||||
if 0 <= x0 < screen_size[0] - 2 and 0 <= y0 < screen_size[1] - 2:
|
||||
# Add star to pointlist PL 0 if field display flag is true
|
||||
if fieldsDisplay[0] and 0 <= x0 < screen_size[0] - 2 and 0 <= y0 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x0,y0),((x0+1),(y0+1))], c = white, PL = 0, closed = False)
|
||||
|
||||
# Add star to pointlist PL 1
|
||||
if 0 <= x1 < screen_size[0] - 2 and 0 <= y1 < screen_size[1] - 2:
|
||||
# Add star to pointlist PL 1 if field display flag is true
|
||||
if fieldsDisplay[1] and 0 <= x1 < screen_size[0] - 2 and 0 <= y1 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x1,y1),((x1+1),(y1+1))], c = white, PL = 1, closed = False)
|
||||
|
||||
# Add star to pointlist PL 2
|
||||
if 0 <= x2 < screen_size[0] - 2 and 0 <= y2 < screen_size[1] - 2:
|
||||
# Add star to pointlist PL 2 if field display flag is true
|
||||
if fieldsDisplay[2] and 0 <= x2 < screen_size[0] - 2 and 0 <= y2 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x2,y2),((x2+1),(y2+1))], c= white, PL = 2, closed = False)
|
||||
|
||||
'''
|
||||
@ -332,41 +403,105 @@ def Starfield(hori=0,verti=0):
|
||||
fwork.PolyLineOneColor([(x3,y3),((x3+2),(y3+2))], c=colorify.rgb2hex([255,255,255]), PL = 3, closed = False)
|
||||
'''
|
||||
|
||||
|
||||
lj3.Text(message, white, PL = 3, xpos = 300, ypos = 300, resize = 1, rotx =0, roty =0 , rotz=0)
|
||||
lj3.DrawPL(0)
|
||||
lj3.DrawPL(1)
|
||||
lj3.DrawPL(2)
|
||||
lj3.DrawPL(3)
|
||||
|
||||
|
||||
def OSCidiotia(address,value):
|
||||
print("idiotia",address,value)
|
||||
# Laser 3 Display a word.
|
||||
if fieldsDisplay[3]:
|
||||
lj3.Text(message, white, PL = 3, xpos = 300, ypos = 300, resize = 1, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
# If field display is True for each laser
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
# Actually send the field point list.
|
||||
if fieldsDisplay[laser]:
|
||||
lj3.DrawPL(laser)
|
||||
|
||||
|
||||
# display the Realtime open pose face according to flag.
|
||||
def LiveFace():
|
||||
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if liveDisplay[laser]:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# /pose/idiotia/lasernumber 1
|
||||
def OSCidiotia(address, value):
|
||||
|
||||
print("idiotia",address,value)
|
||||
|
||||
laser = int(address[14:])
|
||||
print("laser", laser, value)
|
||||
|
||||
if value == 1:
|
||||
|
||||
idiotiaDisplay[laser] = True
|
||||
liveDisplay[laser] = False
|
||||
fieldsDisplay[laser] = False
|
||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
else:
|
||||
|
||||
idiotiaDisplay[laser] = False
|
||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
|
||||
# /pose/anim
|
||||
def OSCanim(address,state):
|
||||
|
||||
print("/pose/anim",address, state)
|
||||
anim = int(address[12:])
|
||||
print(anim, state)
|
||||
|
||||
if state == 1:
|
||||
currentIdiotia = anim
|
||||
|
||||
|
||||
# /pose/live/lasernumber value
|
||||
def OSClive(address,value):
|
||||
|
||||
print("live",address,value)
|
||||
laser = int(address[11:])
|
||||
print("laser", laser, value)
|
||||
|
||||
if value == "1":
|
||||
idiotiaDisplay[value] = False
|
||||
liveDisplay[value] = True
|
||||
fieldsDisplay[value] = False
|
||||
|
||||
# /pose/field/lasernumber value
|
||||
def OSCfield(address, value):
|
||||
|
||||
print("Pose bank field got", address, "with value", value)
|
||||
laser = int(address[12:])
|
||||
print("laser", laser, value)
|
||||
|
||||
if value == "1":
|
||||
idiotiaDisplay[value] = False
|
||||
liveDisplay[value] = False
|
||||
fieldsDisplay[value] = True
|
||||
|
||||
|
||||
# /pose/ljclient
|
||||
def OSCljclient(value):
|
||||
print("Pose bank got /pose/ljclient with value", value)
|
||||
ljclient = value
|
||||
lj3.LjClient(ljclient)
|
||||
|
||||
|
||||
def OSCpl(value):
|
||||
|
||||
print("Pose bank got /pose/pl with value", value)
|
||||
lj3.WebStatus("Pose bank to pl "+ str(value))
|
||||
lj3.LjPl(value)
|
||||
|
||||
|
||||
'''
|
||||
# Starfield, idiotia
|
||||
def OSCrun(value):
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Pose bank got /run with value", value)
|
||||
doit = value
|
||||
'''
|
||||
|
||||
# /quit
|
||||
def OSCquit():
|
||||
@ -380,53 +515,85 @@ def WebStatus(message):
|
||||
lj3.SendLJ("/status",message)
|
||||
|
||||
|
||||
# Update Pose webUI
|
||||
def UpdatePoseUI():
|
||||
|
||||
WebStatus("Updating Pose UI...")
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
if idiotiaDisplay[laser]:
|
||||
lj3.SendLJ("pose/idiotia/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("pose/idiotia/" + str(laser) + " 0")
|
||||
|
||||
if liveDisplay[laser]:
|
||||
lj3.SendLJ("pose/live/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("pose/live/" + str(laser) + " 0")
|
||||
|
||||
if fieldsDisplay[laser]:
|
||||
lj3.SendLJ("pose/field/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("pose/field/" + str(laser) + " 0")
|
||||
|
||||
|
||||
for anim in range(19):
|
||||
if anim == currentIdiotia:
|
||||
lj3.SendLJ("pose/anim/" + str(anim) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("pose/anim/" + str(anim) + " 0")
|
||||
|
||||
|
||||
|
||||
print('Loading Pose bank...')
|
||||
|
||||
WebStatus("Loading Pose bank...")
|
||||
|
||||
# OSC Server callbacks
|
||||
print("Starting OSC at 127.0.0.1 port",OSCinPort,"...")
|
||||
print("Starting OSC server at",myIP,":",OSCinPort,"...")
|
||||
osc_startup()
|
||||
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||
|
||||
osc_method("/pose/run*", OSCrun)
|
||||
osc_method("/pose/ping*", lj3.OSCping)
|
||||
#osc_method("/pose/run*", OSCrun)
|
||||
osc_method("/ping*", lj3.OSCping)
|
||||
osc_method("/pose/ljclient", OSCljclient)
|
||||
osc_method("/pose/ljpl", OSCpl)
|
||||
osc_method("/quit", OSCquit)
|
||||
osc_method("/pose/idiotia*", OSCidiotia, argscheme=OSCARG_ADDRESS + OSCARG_DATA)
|
||||
osc_method("/pose/field*", OSCfield, argscheme=OSCARG_ADDRESS + OSCARG_DATA)
|
||||
osc_method("/pose/idiotia/*", OSCidiotia, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/field/*", OSCfield,argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/live/*", OSClive, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/anim/*", OSCanim, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
|
||||
anims =[[],[],[],[]]
|
||||
color = lj3.rgb2int(255,255,255)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
prepareIdiotIA()
|
||||
#prepareSTARFIELD()
|
||||
anims =[[]]*20
|
||||
#color = lj3.rgb2int(255,255,255)
|
||||
|
||||
prepareIdiotIA(0)
|
||||
prepareSTARFIELD()
|
||||
|
||||
#doit = Starfield
|
||||
doit = IdiotIA
|
||||
#doit = IdiotIA
|
||||
|
||||
white = lj3.rgb2int(255,255,255)
|
||||
red = lj3.rgb2int(255,0,0)
|
||||
blue = lj3.rgb2int(0,0,255)
|
||||
green = lj3.rgb2int(0,255,0)
|
||||
|
||||
print("Updating Pose UI...")
|
||||
UpdatePoseUI()
|
||||
|
||||
WebStatus("Pose bank running.")
|
||||
print("Pose bank running")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def Run():
|
||||
|
||||
try:
|
||||
while 1:
|
||||
#Starfield(hori=0,verti=0)
|
||||
doit()
|
||||
|
||||
Starfield(hori=0,verti=0)
|
||||
IdiotIA()
|
||||
LiveFace()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
@ -99,6 +99,7 @@ def OSCping(value):
|
||||
print("Got /ping with value", value)
|
||||
SendLJ("/pong",value)
|
||||
|
||||
|
||||
# /quit
|
||||
def OSCquit(name):
|
||||
|
||||
@ -225,7 +226,7 @@ def rgb2int(r,g,b):
|
||||
|
||||
|
||||
def Config(redisIP,client):
|
||||
global ClientNumber
|
||||
global ClientNumber, r
|
||||
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
ClientNumber = client
|
||||
|
@ -30,6 +30,7 @@ argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str)
|
||||
|
||||
args = argsparser.parse_args()
|
||||
|
||||
@ -52,15 +53,23 @@ else:
|
||||
|
||||
print("redisIP",redisIP)
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
print("redisIP",redisIP)
|
||||
|
||||
if args.verbose:
|
||||
debug = args.verbose
|
||||
else:
|
||||
debug = 0
|
||||
|
||||
|
||||
r = lj3.Config(redisIP,ljclient)
|
||||
lj3.Config(redisIP,ljclient)
|
||||
|
||||
|
||||
print("r :",r)
|
||||
width = 800
|
||||
height = 600
|
||||
centerX = width / 2
|
||||
|
@ -15,6 +15,7 @@ from osc4py3 import oscbuildparse
|
||||
#from osc4py3 import oscmethod as osm
|
||||
from osc4py3.oscmethod import *
|
||||
|
||||
myIP = "127.0.0.1"
|
||||
|
||||
duration = 300
|
||||
|
||||
@ -35,6 +36,7 @@ else:
|
||||
print ("Words is checking arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Text Cycling for LJ")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
|
||||
@ -52,6 +54,12 @@ if args.redisIP != None:
|
||||
else:
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
|
||||
if args.verbose:
|
||||
debug = args.verbose
|
||||
@ -82,10 +90,10 @@ def OSCword2(value):
|
||||
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Words 2 got /words/text/2 with value", value)
|
||||
Word3 = value
|
||||
Word2 = value
|
||||
|
||||
def OSCword3(value):
|
||||
global Words3
|
||||
global Word3
|
||||
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Words 3 got /words/text/3 with value", value)
|
||||
@ -116,9 +124,9 @@ def OSCquit():
|
||||
def Run():
|
||||
|
||||
# OSC Server callbacks
|
||||
print("Words starting its OSC server at 127.0.0.1 port",OSCinPort,"...")
|
||||
print("Words starting its OSC server at", myIP, "port",OSCinPort,"...")
|
||||
osc_startup()
|
||||
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||
osc_method("/words/text/0*", OSCword0)
|
||||
osc_method("/words/text/1*", OSCword1)
|
||||
osc_method("/words/text/2*", OSCword2)
|
||||
|
322
plugins/lj.py
Normal file
322
plugins/lj.py
Normal file
@ -0,0 +1,322 @@
|
||||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
LJ v0.8.1
|
||||
Some LJ functions useful for python 2.7 clients (was framy.py)
|
||||
Functions and documentation here is low priority as python 2 support will stop soon.
|
||||
Better code your plugin with python 3 and lj3.py.
|
||||
|
||||
|
||||
Config
|
||||
PolyLineOneColor
|
||||
rPolyLineOneColor
|
||||
Text
|
||||
SendLJ : remote control
|
||||
LjClient :
|
||||
LjPl :
|
||||
DrawPL
|
||||
WebStatus
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack
|
||||
|
||||
'''
|
||||
|
||||
import math
|
||||
import redis
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
redisIP = '127.0.0.1'
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
ClientNumber = 0
|
||||
|
||||
point_list = []
|
||||
pl = [[],[],[],[]]
|
||||
|
||||
|
||||
|
||||
def SendLJ(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
print ("sending OSC message : ",oscmsg)
|
||||
try:
|
||||
osclientlj.sendto(oscmsg, (redisIP, 8002))
|
||||
oscmsg.clearData()
|
||||
except:
|
||||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
#time.sleep(0.001
|
||||
|
||||
def WebStatus(message):
|
||||
SendLJ("/status", message)
|
||||
|
||||
|
||||
ASCII_GRAPHICS = [
|
||||
|
||||
#implementé
|
||||
|
||||
[(-50,30), (-30,-30), (30,-30), (10,30), (-50,30)], #0
|
||||
[(-20,30), (0,-30), (-20,30)], #1
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #2
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #3
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #4
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #5
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #6
|
||||
[(-30,-30), (30,-30), (-30,30)], #7
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #8
|
||||
[(30,0), (-30,0), (-30,-10), (0,-30), (30,-30), (30,10), (0,30), (-30,30)], #9
|
||||
|
||||
# A implementer
|
||||
[(-30,10), (30,-10), (30,10), (0,30), (-30,10), (-30,-10), (0,-30), (30,-10)], #:
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #;
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #<
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #=
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #>
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #?
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #@
|
||||
|
||||
# Implementé
|
||||
|
||||
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #B
|
||||
[(30,30), (-30,30), (-30,-30), (30,-30)], #C
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #D
|
||||
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #E
|
||||
[(-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #F
|
||||
[(0,0), (30,0), (30,30), (-30,30), (-30,-30),(30,-30)], #G
|
||||
[(-30,-30), (-30,30), (-30,0), (30,0), (30,30), (30,-30)], #H
|
||||
[(0,30), (0,-30)], #I
|
||||
[(-30,30), (0,-30), (0,-30), (-30,-30), (30,-30)], #J
|
||||
[(-30,-30), (-30,30), (-30,0), (30,-30), (-30,0), (30,30)], #K
|
||||
[(30,30), (-30,30), (-30,-30)], #L
|
||||
[(-30,30), (-30,-30), (0,0), (30,-30), (30,30)], #M
|
||||
[(-30,30), (-30,-30), (30,30), (30,-30)], #N
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #O
|
||||
[(-30,0), (30,0), (30,-30), (-30,-30), (-30,30)], #P
|
||||
[(30,30), (30,-30), (-30,-30), (-30,30), (30,30),(35,35)], #Q
|
||||
[(-30,30), (-30,-30), (30,-30), (30,0), (-30,0), (30,30)], #R
|
||||
[(30,-30), (-30,-30), (-30,0), (30,0), (30,30), (-30,30)], #S
|
||||
[(0,30), (0,-30), (-30,-30), (30,-30)], #T
|
||||
[(-30,-30), (-30,30), (30,30), (30,-30)], #U
|
||||
[(-30,-30), (0,30), (30,-30)], #V
|
||||
[(-30,-30), (-30,30), (0,0), (30,30), (30,-30)], #W
|
||||
[(-30,30), (30,-30)], [(-30,-30), (30,30)], #X
|
||||
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], #Y
|
||||
[(30,30), (-30,30), (30,-30), (-30,-30)], #Z
|
||||
|
||||
# A implementer
|
||||
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #[
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #\
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #]
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #^
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #_
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #`
|
||||
|
||||
# Implementé
|
||||
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], #a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], #b
|
||||
[(20,20), (-20,20), (-20,-20), (20,-20)], #c
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #d
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #e
|
||||
[(-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #f
|
||||
[(0,0), (20,0), (20,20), (-20,20), (-20,-20),(20,-20)], #g
|
||||
[(-20,-20), (-20,20), (-20,0), (20,0), (20,20), (20,-20)], #H
|
||||
[(0,20), (0,-20)], #I
|
||||
[(-20,20), (0,-20), (0,-20), (-20,-20), (20,-20)], #J
|
||||
[(-20,-20), (-20,20), (-20,0), (20,-20), (-20,0), (20,20)], #K
|
||||
[(20,20), (-20,20), (-20,-20)], #L
|
||||
[(-20,20), (-20,-20), (0,0), (20,-20), (20,20)], #M
|
||||
[(-20,20), (-20,-20), (20,20), (20,-20)], #N
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #O
|
||||
[(-20,0), (20,0), (20,-20), (-20,-20), (-20,20)], #P
|
||||
[(20,20), (20,-20), (-20,-20), (-20,20), (20,20),(25,25)], #Q
|
||||
[(-20,20), (-20,-20), (20,-20), (20,0), (-20,0), (20,20)], #R
|
||||
[(20,-20), (-20,-20), (-20,0), (20,0), (20,20), (-20,20)], #S
|
||||
[(0,20), (0,-20), (-20,-20), (20,-20)], #T
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], #U
|
||||
[(-20,-20), (0,20), (20,-20)], #V
|
||||
[(-20,-20), (-20,20), (0,0), (20,20), (20,-20)], #W
|
||||
[(-20,20), (20,-20)], [(-20,-20), (20,20)], #X
|
||||
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], #Y
|
||||
[(20,20), (-20,20), (20,-20), (-20,-20)], #Z
|
||||
|
||||
[(-2,15), (2,15)] # Point a la place de {
|
||||
]
|
||||
|
||||
def Config(redisIP,client):
|
||||
global ClientNumber
|
||||
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
ClientNumber = client
|
||||
#print "client configured",ClientNumber
|
||||
|
||||
|
||||
def LjClient(client):
|
||||
global ClientNumber
|
||||
|
||||
ClientNumber = client
|
||||
|
||||
def LjPl(pl):
|
||||
global PL
|
||||
|
||||
PL = pl
|
||||
|
||||
|
||||
def LineTo(xy, c, PL):
|
||||
|
||||
pl[PL].append((xy + (c,)))
|
||||
|
||||
def Line(xy1, xy2, c, PL):
|
||||
LineTo(xy1, 0, PL)
|
||||
LineTo(xy2, c , PL)
|
||||
|
||||
|
||||
def PolyLineOneColor(xy_list, c, PL , closed ):
|
||||
#print "--"
|
||||
#print "c",c
|
||||
#print "xy_list",xy_list
|
||||
#print "--"
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
#print "xy0:",xy0
|
||||
LineTo(xy0,0, PL)
|
||||
LineTo(xy0,c, PL)
|
||||
else:
|
||||
#print "xy:",xy
|
||||
LineTo(xy,c, PL)
|
||||
if closed:
|
||||
LineTo(xy0,c, PL)
|
||||
|
||||
|
||||
# Computing points coordinates for rPolyline function from 3D and around 0,0 to pygame coordinates
|
||||
def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
x = xy[0] * resize
|
||||
y = xy[1] * resize
|
||||
z = 0
|
||||
|
||||
rad = math.radians(rotx)
|
||||
cosaX = math.cos(rad)
|
||||
sinaX = math.sin(rad)
|
||||
|
||||
y2 = y
|
||||
y = y2 * cosaX - z * sinaX
|
||||
z = y2 * sinaX + z * cosaX
|
||||
|
||||
rad = math.radians(roty)
|
||||
cosaY = math.cos(rad)
|
||||
sinaY = math.sin(rad)
|
||||
|
||||
z2 = z
|
||||
z = z2 * cosaY - x * sinaY
|
||||
x = z2 * sinaY + x * cosaY
|
||||
|
||||
rad = math.radians(rotz)
|
||||
cosZ = math.cos(rad)
|
||||
sinZ = math.sin(rad)
|
||||
|
||||
x2 = x
|
||||
x = x2 * cosZ - y * sinZ
|
||||
y = x2 * sinZ + y * cosZ
|
||||
|
||||
#print xy, (x + xpos,y+ ypos)
|
||||
return (x + xpos,y+ ypos)
|
||||
'''
|
||||
to understand why it get negative Y
|
||||
|
||||
# 3D to 2D projection
|
||||
factor = 4 * gstt.cc[22] / ((gstt.cc[21] * 8) + z)
|
||||
print xy, (x * factor + xpos, - y * factor + ypos )
|
||||
return (x * factor + xpos, - y * factor + ypos )
|
||||
'''
|
||||
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, PL , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),0, PL)
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
|
||||
|
||||
def LinesPL(PL):
|
||||
print "Stupido !! your code is to old : use DrawPL() instead of LinesPL()"
|
||||
DrawPL(PL)
|
||||
|
||||
|
||||
def DrawPL(PL):
|
||||
#print '/pl/0/'+str(PL), str(pl[PL])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
pl[PL] = []
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def ResetPL(self, PL):
|
||||
pl[PL] = []
|
||||
|
||||
|
||||
|
||||
def DigitsDots(number,color):
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[number]:
|
||||
#print dot
|
||||
dots.append((gstt.xy_center[0]+dot[0],gstt.xy_center[1]+dot[1],color))
|
||||
#self.point_list.append((xy + (c,)))
|
||||
return dots
|
||||
|
||||
def CharDots(char,color):
|
||||
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[ord(char)-46]:
|
||||
dots.append((dot[0],dot[1],color))
|
||||
return dots
|
||||
|
||||
def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
dots =[]
|
||||
|
||||
l = len(message)
|
||||
i= 0
|
||||
#print message
|
||||
|
||||
for ch in message:
|
||||
|
||||
#print ""
|
||||
# texte centre en x automatiquement selon le nombre de lettres l
|
||||
x_offset = 26 * (- (0.9*l) + 3*i)
|
||||
# Digits
|
||||
if ord(ch)<58:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
else:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
char_draw = []
|
||||
#dots.append((char_pl_list[0][0] + x_offset,char_pl_list[0][1],0))
|
||||
|
||||
for xy in char_pl_list:
|
||||
char_draw.append((xy[0] + x_offset,xy[1],c))
|
||||
i +=1
|
||||
#print ch,char_pl_list,char_draw
|
||||
rPolyLineOneColor(char_draw, c, PL , False, xpos, ypos, resize, rotx, roty, rotz)
|
||||
#dots.append(char_draw)
|
||||
|
||||
|
||||
|
||||
|
@ -99,6 +99,7 @@ def OSCping(value):
|
||||
print("Got /ping with value", value)
|
||||
SendLJ("/pong",value)
|
||||
|
||||
|
||||
# /quit
|
||||
def OSCquit(name):
|
||||
|
||||
@ -225,7 +226,7 @@ def rgb2int(r,g,b):
|
||||
|
||||
|
||||
def Config(redisIP,client):
|
||||
global ClientNumber
|
||||
global ClientNumber, r
|
||||
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
ClientNumber = client
|
||||
|
@ -31,8 +31,10 @@ import pdb
|
||||
import types, ast, argparse
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
|
||||
pl = [[],[],[],[]]
|
||||
|
||||
|
||||
print ("")
|
||||
print ("LJ v0.8.0 : Pygame simulator")
|
||||
print ("")
|
||||
@ -42,8 +44,9 @@ print ("Arguments parsing if needed...")
|
||||
# Arguments parsing
|
||||
#
|
||||
|
||||
argsparser = argparse.ArgumentParser(description="Available commands")
|
||||
argsparser = argparse.ArgumentParser(description="One laser Simulator for LJ")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
@ -76,14 +79,22 @@ else:
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
|
||||
|
||||
#
|
||||
# OSC
|
||||
#
|
||||
|
||||
oscIPin = "127.0.0.1"
|
||||
oscIPin = myIP
|
||||
oscPORTin = 8008
|
||||
|
||||
ljIP = "127.0.0.1"
|
||||
ljIP = redisIP
|
||||
ljPort = 8002
|
||||
|
||||
print ("")
|
||||
|
@ -35,6 +35,7 @@ else:
|
||||
print ("Arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Text Cycling for LJ")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
@ -64,6 +65,14 @@ if args.redisIP != None:
|
||||
else:
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
|
||||
lj3.Config(redisIP,ljclient)
|
||||
#r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
@ -101,8 +110,9 @@ def OSCquit():
|
||||
|
||||
lj3.OSCquit("cycl")
|
||||
|
||||
print("Cycl starting its OSC server at", myIP, "port",OSCinPort,"...")
|
||||
osc_startup()
|
||||
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||
|
||||
osc_method("/ping*", OSCping)
|
||||
osc_method("/quit", OSCquit)
|
||||
|
@ -2,6 +2,10 @@
|
||||
// LJ.js v0.7.1
|
||||
//
|
||||
|
||||
// LJ websocket address. Change here if LJ is not bind to 127.0.0.1
|
||||
|
||||
var LJ = 'ws://127.0.0.1:9001/'
|
||||
|
||||
//
|
||||
// Central horizontal menu
|
||||
//
|
||||
@ -204,7 +208,7 @@
|
||||
var pl = "";
|
||||
var pl2 = new Array();
|
||||
var _WS = {
|
||||
uri: 'ws://192.168.2.13:9001/',
|
||||
uri: LJ,
|
||||
ws: null,
|
||||
|
||||
init : function (e) {
|
||||
@ -238,6 +242,8 @@
|
||||
var res = e.data.split(" ");
|
||||
//console.log(e.data)
|
||||
//console.log(res[0].substring(0,6))
|
||||
//console.log(res)
|
||||
//console.log(res[0].slice(1))
|
||||
|
||||
switch (res[0].substring(0,6)) {
|
||||
|
||||
|
@ -74,7 +74,7 @@
|
||||
height: 400px;
|
||||
width: 400px;
|
||||
grid-template-columns: 66px 66px 66px 66px 66px 66px;
|
||||
grid-template-rows: 30px 67px 67px 67px 30px;
|
||||
grid-template-rows: 30px 67px 67px 67px 30px 30px;
|
||||
background-color: #000;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
|
@ -564,7 +564,7 @@
|
||||
|
||||
<div id = "mgsimu" class="mgsimu">
|
||||
|
||||
<!-- Simu left part : canvas -->
|
||||
<!-- Simu left part : Canvas -->
|
||||
<div>
|
||||
<canvas id="canvas" width="500" height="400" style="border-color: #445;border-style:groove;border-width:1px;"></canvas>
|
||||
</div>
|
||||
@ -730,11 +730,13 @@
|
||||
|
||||
<!-- simu right part : pluginsUI -->
|
||||
|
||||
<div id ="pluginsUI" style = "display: grid;justify-items: center;">
|
||||
<div id ="pluginsUI" style = "display: none;justify-items: center;">
|
||||
<!-- Plugins choice Interface -->
|
||||
|
||||
<div>
|
||||
<webaudio-switch id="pysimu/start" value="0" height="27" width="75" tooltip="Switch-B" src="knobs/pysimu.png"></webaudio-switch>
|
||||
<webaudio-switch id="simu/start" value="0" height="27" width="75" tooltip="Switch-B" src="knobs/pysimu.png"></webaudio-switch>
|
||||
<webaudio-switch id="pose/start" value="0" height="27" width="75" tooltip="Switch-B" src="knobs/pose.png"></webaudio-switch>
|
||||
<webaudio-switch id="bank0/start" value="0" height="27" width="75" tooltip="Switch-B" src="knobs/bank0.png"></webaudio-switch>
|
||||
</div>
|
||||
<div>
|
||||
<webaudio-switch id="glyph/start" value="0" height="27" width="75" tooltip="Switch-B" src="knobs/glyph.png"></webaudio-switch>
|
||||
@ -856,9 +858,9 @@
|
||||
|
||||
<!-- simu right part : poseUI -->
|
||||
|
||||
<div id ="poseUI" class="posebuttons">
|
||||
<div id ="poseUI" class="posebuttons" style = "display: grid;justify-items: center;">
|
||||
|
||||
<!-- IdiotIA laser destination -->
|
||||
<!-- IdiotIA display flag -->
|
||||
<div><span class="lasertext">IdiotIA</span></div>
|
||||
<div><webaudio-switch id="pose/idiotia/0" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/0.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/1" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/1.png"></webaudio-switch></div>
|
||||
@ -867,30 +869,38 @@
|
||||
<div></div>
|
||||
|
||||
<!-- IdiotIA animation selection first line -->
|
||||
<div><webaudio-switch id="pose/idiotia/anim0" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim1" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim2" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim3" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim4" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim5" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/0" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/1" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/2" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/3" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/4" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/5" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
|
||||
<!-- IdiotIA animation selection second line -->
|
||||
<div><webaudio-switch id="pose/idiotia/anim6" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim7" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim8" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim9" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim10" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim11" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/6" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/7" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/8" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/9" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/10" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/11" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
|
||||
<!-- IdiotIA animation selection third line -->
|
||||
<div><webaudio-switch id="pose/idiotia/anim12" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim13" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim14" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim15" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim16" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/idiotia/anim17" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/12" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/13" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/14" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/15" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/16" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/anim/17" value="0" tooltip="Switch-B" height="64" width="64" src="knobs/idiotia.png"></webaudio-switch></div>
|
||||
|
||||
<!-- Starfield laser destination -->
|
||||
<!-- Realtime pose display flag -->
|
||||
<div><span class="lasertext">Live</span></div>
|
||||
<div><webaudio-switch id="pose/live/0" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/0.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/live/1" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/1.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/live/2" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/2.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/live/3" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/3.png"></webaudio-switch></div>
|
||||
<div></div>
|
||||
|
||||
<!-- Starfield display lag -->
|
||||
<div><span class="lasertext">Fields</span></div>
|
||||
<div><webaudio-switch id="pose/field/0" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/0.png"></webaudio-switch></div>
|
||||
<div><webaudio-switch id="pose/field/1" value="0" tooltip="Switch-B" height="24" width="64" src="knobs/1.png"></webaudio-switch></div>
|
||||
|
BIN
webui/knobs/bank0.png
Normal file
BIN
webui/knobs/bank0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
webui/knobs/pose.png
Normal file
BIN
webui/knobs/pose.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Loading…
Reference in New Issue
Block a user