Merge branch 'master' of https://github.com/tmpbci/LJ
This commit is contained in:
commit
4a2d1a5773
4
LJ.conf
4
LJ.conf
@ -1,13 +1,13 @@
|
|||||||
[General]
|
[General]
|
||||||
lasernumber = 4
|
lasernumber = 4
|
||||||
debug = 2
|
debug = 0
|
||||||
ljayserverip = 127.0.0.1
|
ljayserverip = 127.0.0.1
|
||||||
nozoscip = 127.0.0.1
|
nozoscip = 127.0.0.1
|
||||||
bhoroscip = 127.0.0.1
|
bhoroscip = 127.0.0.1
|
||||||
|
|
||||||
[laser0]
|
[laser0]
|
||||||
color = -1
|
color = -1
|
||||||
ip = 192.168.1.4
|
ip = 127.0.0.1
|
||||||
kpps = 25000
|
kpps = 25000
|
||||||
centerx = -1610
|
centerx = -1610
|
||||||
centery = 0
|
centery = 0
|
||||||
|
12
commands.py
12
commands.py
@ -87,7 +87,7 @@ import plugins
|
|||||||
|
|
||||||
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
|
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
|
||||||
|
|
||||||
GenericCommands = ["start","ljclient","clientnumber","noteon","ljpong","ljwars","mouse","emergency","simu","status","run","nozoid","planet","live","words","ai","bank0","pose","lj","cycl","glyph"]
|
GenericCommands = ["start","ljclient","clientnumber","noteon","ljpong","ljwars","mouse","emergency","simu","status","run","nozoid","planet","live","words","ai","bank0","pose","lj","cycl","glyph","pong"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -180,22 +180,28 @@ def handler(oscpath, args):
|
|||||||
|
|
||||||
if oscpath[1] in GenericCommands:
|
if oscpath[1] in GenericCommands:
|
||||||
|
|
||||||
|
print "GenericCommand :",oscpath[1],"with args",args
|
||||||
|
|
||||||
if oscpath[1] == "ljclient":
|
if oscpath[1] == "ljclient":
|
||||||
LasClientChange(int(args[0]))
|
LasClientChange(int(args[0]))
|
||||||
|
|
||||||
|
|
||||||
elif oscpath[1] == "noteon":
|
elif oscpath[1] == "noteon":
|
||||||
NoteOn(int(args[0]))
|
NoteOn(int(args[0]))
|
||||||
|
|
||||||
|
|
||||||
elif oscpath[1] == "pong":
|
elif oscpath[1] == "pong":
|
||||||
print "LJ commands got pong from", args
|
print "LJ commands got pong from", args
|
||||||
plugins.sendWSall("/" + args[0] + "start 1")
|
plugins.sendWSall("/" + args[0] + "start 1")
|
||||||
plugins.sendWSall("/status got pong from "+ args[0] +".")
|
plugins.sendWSall("/status got pong from "+ args[0] +".")
|
||||||
|
|
||||||
|
|
||||||
elif oscpath[1] == "mouse":
|
elif oscpath[1] == "mouse":
|
||||||
Mouse(int(args[0]),int(args[1]),int(args[2]),int(args[3]))
|
Mouse(int(args[0]),int(args[1]),int(args[2]),int(args[3]))
|
||||||
|
|
||||||
|
|
||||||
# /emergency value (0 or 1)
|
# /emergency value (0 or 1)
|
||||||
if oscpath[1] == "emergency":
|
elif oscpath[1] == "emergency":
|
||||||
|
|
||||||
if args[0] == "1":
|
if args[0] == "1":
|
||||||
|
|
||||||
@ -209,6 +215,8 @@ def handler(oscpath, args):
|
|||||||
print "Back to normal for laser ", laser
|
print "Back to normal for laser ", laser
|
||||||
UserOn(laser)
|
UserOn(laser)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Commands with a laser number
|
# Commands with a laser number
|
||||||
else:
|
else:
|
||||||
pathlength = len(oscpath)
|
pathlength = len(oscpath)
|
||||||
|
112
main.py
112
main.py
@ -92,8 +92,8 @@ print "Laser client number :",gstt.LasClientNumber
|
|||||||
serverIP = gstt.LjayServerIP
|
serverIP = gstt.LjayServerIP
|
||||||
print "Redis IP :", serverIP
|
print "Redis IP :", serverIP
|
||||||
|
|
||||||
extoscIP = gstt.oscIPin
|
oscserverIP = gstt.oscIPin
|
||||||
print "extosc IP :", extoscIP
|
print "OSCserver IP :", oscserverIP
|
||||||
|
|
||||||
nozoscIP = gstt.nozoscip
|
nozoscIP = gstt.nozoscip
|
||||||
print "Nozosc IP :", nozoscIP
|
print "Nozosc IP :", nozoscIP
|
||||||
@ -108,36 +108,34 @@ print "Lasers requested :", gstt.LaserNumber
|
|||||||
# Websocket listening port
|
# Websocket listening port
|
||||||
wsPORT = 9001
|
wsPORT = 9001
|
||||||
|
|
||||||
# With extosc
|
# oscserver
|
||||||
# OSC Server : accept OSC message on port 8002
|
# OSC Server : accept OSC message on port 8002
|
||||||
#oscIPin = "192.168.1.10"s
|
#oscIPin = "192.168.1.10"s
|
||||||
extoscIPin = serverIP
|
oscserverIPin = serverIP
|
||||||
|
|
||||||
print "extoscIPin", extoscIPin
|
print "oscserverIPin", oscserverIPin
|
||||||
extoscPORTin = 8002
|
oscserverPORTin = 8002
|
||||||
|
|
||||||
# OSC Client : to send OSC message to an IP port 8001
|
# OSC Client : to send OSC message to an IP port 8001
|
||||||
extoscIPout = extoscIP
|
oscserverIPout = oscserverIP
|
||||||
extoscPORTout = 8001
|
oscserverPORTout = 8001
|
||||||
|
|
||||||
|
|
||||||
# With Nozoid
|
# Nozoid OSC Client : to send OSC message to Nozoid inport 8003
|
||||||
# OSC Client : to send OSC message to Nozoid inport 8003
|
|
||||||
NozoscIPout = nozoscIP
|
NozoscIPout = nozoscIP
|
||||||
NozoscPORTout = plugins.Port("nozoid")
|
NozoscPORTout = plugins.Port("nozoid")
|
||||||
|
|
||||||
|
|
||||||
# With Planetarium
|
# Planetarium OSC Client : to send OSC message to planetarium inport 8005
|
||||||
# OSC Client : to send OSC message to planetarium inport 8005
|
|
||||||
planetIPout = nozoscIP
|
planetIPout = nozoscIP
|
||||||
planetPORTout = plugins.Port("planet")
|
planetPORTout = plugins.Port("planet")
|
||||||
|
|
||||||
# With Bank0
|
# Bank0 OSC Client : to send OSC message to bank0 inport 8010
|
||||||
# OSC Client : to send OSC message to bank0 inport 8010
|
|
||||||
bank0IPout = nozoscIP
|
bank0IPout = nozoscIP
|
||||||
bank0PORTout = plugins.Port("bank0")
|
bank0PORTout = plugins.Port("bank0")
|
||||||
|
|
||||||
oscserver = OSCServer( (extoscIPin, extoscPORTin) )
|
|
||||||
|
oscserver = OSCServer( (oscserverIPin, oscserverPORTin) )
|
||||||
oscserver.timeout = 0
|
oscserver.timeout = 0
|
||||||
OSCRunning = True
|
OSCRunning = True
|
||||||
|
|
||||||
@ -150,23 +148,23 @@ oscserver.handle_timeout = types.MethodType(handle_timeout, oscserver)
|
|||||||
'''
|
'''
|
||||||
osclientext = OSCClient()
|
osclientext = OSCClient()
|
||||||
oscmsg = OSCMessage()
|
oscmsg = OSCMessage()
|
||||||
osclientext.connect((extoscIPout, extoscPORTout))
|
osclientext.connect((oscserverIPout, oscserverPORTout))
|
||||||
|
|
||||||
# send UI string as OSC message to extosc 8001
|
# send UI string as OSC message to oscserver 8001
|
||||||
# sendextosc(oscaddress, [arg1, arg2,...])
|
# sendoscserver(oscaddress, [arg1, arg2,...])
|
||||||
|
|
||||||
def sendextosc(oscaddress,oscargs=''):
|
def sendoscserver(oscaddress,oscargs=''):
|
||||||
|
|
||||||
oscmsg = OSCMessage()
|
oscmsg = OSCMessage()
|
||||||
oscmsg.setAddress(oscaddress)
|
oscmsg.setAddress(oscaddress)
|
||||||
oscmsg.append(oscargs)
|
oscmsg.append(oscargs)
|
||||||
|
|
||||||
#print ("sending to extosc : ",oscmsg)
|
#print ("sending to oscserver : ",oscmsg)
|
||||||
try:
|
try:
|
||||||
osclientext.sendto(oscmsg, (extoscIPout, extoscPORTout))
|
osclientext.sendto(oscmsg, (oscserverIPout, oscserverPORTout))
|
||||||
oscmsg.clearData()
|
oscmsg.clearData()
|
||||||
except:
|
except:
|
||||||
print ('Connection to extosc IP', extoscIPout, 'port', extoscPORTout,'refused : died ?')
|
print ('Connection to oscserver IP', oscserverIPout, 'port', oscserverPORTout,'refused : died ?')
|
||||||
sendWSall("/on 0")
|
sendWSall("/on 0")
|
||||||
sendWSall("/status NoLJay")
|
sendWSall("/status NoLJay")
|
||||||
|
|
||||||
@ -268,6 +266,22 @@ def osc_frame():
|
|||||||
while not oscserver.timed_out:
|
while not oscserver.timed_out:
|
||||||
oscserver.handle_request()
|
oscserver.handle_request()
|
||||||
|
|
||||||
|
def PingAll():
|
||||||
|
|
||||||
|
for plugin in gstt.plugins.keys():
|
||||||
|
|
||||||
|
# Plugin Online
|
||||||
|
if plugins.Ping(plugin):
|
||||||
|
|
||||||
|
sendWSall("/"+ plugin + "/start 1")
|
||||||
|
if gstt.debug >0:
|
||||||
|
print "plugin", plugin, "answered."
|
||||||
|
|
||||||
|
# Plugin Offline
|
||||||
|
else:
|
||||||
|
sendWSall("/"+ plugin + "/start 0")
|
||||||
|
if gstt.debug >0:
|
||||||
|
print "plugin", plugin, "didn't answered."
|
||||||
|
|
||||||
|
|
||||||
# OSC server Thread : handler, dacs reports and simulator points sender to UI.
|
# OSC server Thread : handler, dacs reports and simulator points sender to UI.
|
||||||
@ -367,27 +381,23 @@ def message_received(client, wserver, message):
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
oscpath = message.split(" ")
|
oscpath = message.split(" ")
|
||||||
print "WS Client", client['id'], "said :", message, "splitted in an oscpath :", oscpath
|
if gstt.debug > 0:
|
||||||
|
print "WS Client", client['id'], "said :", message, "splitted in an oscpath :", oscpath
|
||||||
|
PingAll()
|
||||||
|
message4plugin = False
|
||||||
|
|
||||||
|
# WS received Message is for a plugin ?
|
||||||
|
|
||||||
# Ping all plugins connexion and send message if right plugin is online.
|
|
||||||
for plugin in gstt.plugins.keys():
|
for plugin in gstt.plugins.keys():
|
||||||
|
|
||||||
# Plugin Online
|
if oscpath[0].find(plugin) != -1:
|
||||||
if plugins.Ping(plugin):
|
|
||||||
|
|
||||||
sendWSall("/"+ plugin + "/start 1")
|
message4plugin = True
|
||||||
if gstt.debug >0:
|
if plugins.Send(plugin,oscpath):
|
||||||
print "plugin", plugin, "answered."
|
print "message sent correctly to", plugin
|
||||||
|
|
||||||
if oscpath[0].find(plugin) != -1 and plugins.Send(plugin,oscpath):
|
|
||||||
print "message sent correctly to", plugin
|
|
||||||
|
|
||||||
# Plugin Offline
|
#plugins.sendWSall("/status Running...")
|
||||||
else:
|
|
||||||
sendWSall("/"+ plugin + "/start 0")
|
|
||||||
if gstt.debug >0:
|
|
||||||
print "plugin", plugin, "didn't answered."
|
|
||||||
plugins.sendWSall("/status Running...")
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if plugins.Send("planet",oscpath):
|
if plugins.Send("planet",oscpath):
|
||||||
@ -416,21 +426,27 @@ def message_received(client, wserver, message):
|
|||||||
|
|
||||||
if oscpath[0] == "/on":
|
if oscpath[0] == "/on":
|
||||||
if oscpath[1] == "1":
|
if oscpath[1] == "1":
|
||||||
sendextosc("/on")
|
sendoscserver("/on")
|
||||||
else:
|
else:
|
||||||
sendextosc("/off")
|
sendoscserver("/off")
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if len(oscpath) == 1:
|
# WS received message is an LJ command
|
||||||
args[0] = "noargs"
|
|
||||||
#print "noargs command"
|
if message4plugin == False:
|
||||||
|
|
||||||
|
if len(oscpath) == 1:
|
||||||
|
args[0] = "noargs"
|
||||||
|
#print "noargs command"
|
||||||
|
|
||||||
|
|
||||||
elif len(oscpath) > 1:
|
elif len(oscpath) > 1:
|
||||||
args[0] = str(oscpath[1])
|
args[0] = str(oscpath[1])
|
||||||
#print "arg",oscpath[1]
|
#print "arg",oscpath[1]
|
||||||
|
|
||||||
commands.handler(oscpath[0].split("/"),args)
|
commands.handler(oscpath[0].split("/"),args)
|
||||||
|
|
||||||
|
print ""
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -540,10 +556,10 @@ try:
|
|||||||
wserver = WebsocketServer(wsPORT,host=serverIP)
|
wserver = WebsocketServer(wsPORT,host=serverIP)
|
||||||
plugins.Init(wserver)
|
plugins.Init(wserver)
|
||||||
|
|
||||||
# Launch OSC thread listening to extosc
|
# Launch OSC thread listening to oscserver
|
||||||
print ""
|
print ""
|
||||||
print "Launching OSC server..."
|
print "Launching OSC server..."
|
||||||
print "at", extoscIPin, "port",str(extoscPORTin)
|
print "at", oscserverIPin, "port",str(oscserverPORTin)
|
||||||
print "Will update webUI dac status every second"
|
print "Will update webUI dac status every second"
|
||||||
oscserver.addMsgHandler( "/noteon", commands.NoteOn )
|
oscserver.addMsgHandler( "/noteon", commands.NoteOn )
|
||||||
# Default OSC handler for all OSC incoming message
|
# Default OSC handler for all OSC incoming message
|
||||||
|
34
plugins.py
34
plugins.py
@ -83,13 +83,9 @@ def Start(name):
|
|||||||
|
|
||||||
def OSCsend(name, oscaddress, oscargs =''):
|
def OSCsend(name, oscaddress, oscargs =''):
|
||||||
|
|
||||||
|
#print "OSCsend in plugins got for", name, ": oscaddress", oscaddress, "oscargs :", oscargs
|
||||||
PluginPort = Port(name)
|
PluginPort = Port(name)
|
||||||
sendWSall("/status Checking "+ name + "...")
|
#sendWSall("/status Checking "+ name + "...")
|
||||||
if gstt.debug >1:
|
|
||||||
print ""
|
|
||||||
print "OSCSend is checking plugin", name, "..."
|
|
||||||
print "Plugin", name, "is at", gstt.LjayServerIP, ":" + str(PluginPort)
|
|
||||||
print "Sending", oscaddress, oscargs,"to plugin", name
|
|
||||||
|
|
||||||
osclientplugin = OSCClient()
|
osclientplugin = OSCClient()
|
||||||
osclientplugin.connect((gstt.LjayServerIP, PluginPort))
|
osclientplugin.connect((gstt.LjayServerIP, PluginPort))
|
||||||
@ -98,6 +94,9 @@ def OSCsend(name, oscaddress, oscargs =''):
|
|||||||
oscmsg.append(oscargs)
|
oscmsg.append(oscargs)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if gstt.debug > 0:
|
||||||
|
print "OSCSend : sending", oscmsg,"to plugin", name, "at", gstt.LjayServerIP, ":", PluginPort
|
||||||
|
|
||||||
osclientplugin.sendto(oscmsg, (gstt.LjayServerIP, PluginPort))
|
osclientplugin.sendto(oscmsg, (gstt.LjayServerIP, PluginPort))
|
||||||
oscmsg.clearData()
|
oscmsg.clearData()
|
||||||
#if gstt.debug >0:
|
#if gstt.debug >0:
|
||||||
@ -108,15 +107,17 @@ def OSCsend(name, oscaddress, oscargs =''):
|
|||||||
if gstt.debug > 0:
|
if gstt.debug > 0:
|
||||||
print 'OSCSend : Connection to plugin IP', gstt.LjayServerIP ,':', PluginPort,'refused : died ?'
|
print 'OSCSend : Connection to plugin IP', gstt.LjayServerIP ,':', PluginPort,'refused : died ?'
|
||||||
#sendWSall("/status No plugin.")
|
#sendWSall("/status No plugin.")
|
||||||
sendWSall("/status " + name + " is offline")
|
#sendWSall("/status " + name + " is offline")
|
||||||
sendWSall("/" + name + "/start 0")
|
#sendWSall("/" + name + "/start 0")
|
||||||
#PluginStart(name)
|
#PluginStart(name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def Ping(name):
|
def Ping(name):
|
||||||
|
|
||||||
return OSCsend(name,"/ping")
|
|
||||||
|
sendWSall("/"+ name + "/start 0")
|
||||||
|
return OSCsend(name,"/ping",1)
|
||||||
#return True
|
#return True
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ def Kill(name):
|
|||||||
|
|
||||||
|
|
||||||
# Send a command to given plugin. Will also start it if command contain /start 1
|
# Send a command to given plugin. Will also start it if command contain /start 1
|
||||||
def Send(name,oscpath):
|
def Send(name, oscpath):
|
||||||
|
|
||||||
|
|
||||||
if oscpath[0].find(name) != -1:
|
if oscpath[0].find(name) != -1:
|
||||||
@ -147,11 +148,10 @@ def Send(name,oscpath):
|
|||||||
if Ping(name):
|
if Ping(name):
|
||||||
|
|
||||||
# Light up the plugin button
|
# Light up the plugin button
|
||||||
sendWSall("/" + name + "/start 1")
|
#sendWSall("/" + name + "/start 1")
|
||||||
sendWSall("/status " + name + " online")
|
#sendWSall("/status " + name + " online")
|
||||||
if gstt.debug >0:
|
if gstt.debug > 0:
|
||||||
print "Plugin " + name + " online."
|
print "Send got", oscpath, "for plugin", name, "currently online."
|
||||||
print "Command", oscpath
|
|
||||||
|
|
||||||
|
|
||||||
# If start 0, try to kill plugin
|
# If start 0, try to kill plugin
|
||||||
@ -163,9 +163,9 @@ def Send(name,oscpath):
|
|||||||
|
|
||||||
# Send osc command
|
# Send osc command
|
||||||
elif len(oscpath) == 1:
|
elif len(oscpath) == 1:
|
||||||
OSCsend(name,oscpath[0], oscargs='noargs')
|
OSCsend(name, oscpath[0], oscargs='noargs')
|
||||||
else:
|
else:
|
||||||
OSCsend(name,oscpath[0], oscargs=oscpath[1])
|
OSCsend(name, oscpath[0], oscargs=oscpath[1])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Plugin not online..
|
# Plugin not online..
|
||||||
|
@ -719,6 +719,13 @@ def OSCquit():
|
|||||||
def WebStatus(message):
|
def WebStatus(message):
|
||||||
lj3.SendLJ("/status",message)
|
lj3.SendLJ("/status",message)
|
||||||
|
|
||||||
|
# /pose/ping value
|
||||||
|
def OSCping(value):
|
||||||
|
print("bank0 got /pose/ping with value", value)
|
||||||
|
lj3.OSCping("bank0")
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print('Loading Bank0...')
|
print('Loading Bank0...')
|
||||||
@ -731,7 +738,7 @@ osc_startup()
|
|||||||
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
||||||
|
|
||||||
osc_method("/bank0/run*", OSCrun)
|
osc_method("/bank0/run*", OSCrun)
|
||||||
osc_method("/bank0/ping*", lj3.OSCping)
|
osc_method("/bank0/ping*", OSCping)
|
||||||
osc_method("/bank0/ljclient", OSCljclient)
|
osc_method("/bank0/ljclient", OSCljclient)
|
||||||
osc_method("/bank0/ljpl", OSCpl)
|
osc_method("/bank0/ljpl", OSCpl)
|
||||||
osc_method("/quit", OSCquit)
|
osc_method("/quit", OSCquit)
|
||||||
|
@ -25,7 +25,7 @@ from datetime import datetime
|
|||||||
from random import randrange
|
from random import randrange
|
||||||
import redis
|
import redis
|
||||||
import lj3
|
import lj3
|
||||||
import sys,time
|
import sys,time,traceback
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from osc4py3.as_eventloop import *
|
from osc4py3.as_eventloop import *
|
||||||
@ -34,7 +34,8 @@ from osc4py3 import oscbuildparse
|
|||||||
from osc4py3.oscmethod import *
|
from osc4py3.oscmethod import *
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
# 0.25 : each frame will be repeated 4 times.
|
||||||
|
animspeed = 0.25
|
||||||
|
|
||||||
screen_size = [700,700]
|
screen_size = [700,700]
|
||||||
xy_center = [screen_size[0]/2,screen_size[1]/2]
|
xy_center = [screen_size[0]/2,screen_size[1]/2]
|
||||||
@ -44,9 +45,12 @@ OSCinPort = 8011
|
|||||||
|
|
||||||
ljclient = 0
|
ljclient = 0
|
||||||
|
|
||||||
idiotiaDisplay = [True,True,True,True]
|
idiotiaDisplay = [True,True,False,False]
|
||||||
|
#idiotiaDisplay = [False,False,False,False]
|
||||||
liveDisplay = [False,False,False,False]
|
liveDisplay = [False,False,False,False]
|
||||||
fieldsDisplay = [False,False,False,False]
|
|
||||||
|
fieldsDisplay = [False,False,True,True]
|
||||||
|
#fieldsDisplay = [True,True,True,True]
|
||||||
currentIdiotia = 0
|
currentIdiotia = 0
|
||||||
|
|
||||||
print ("")
|
print ("")
|
||||||
@ -99,6 +103,7 @@ else:
|
|||||||
lj3.Config(redisIP,ljclient)
|
lj3.Config(redisIP,ljclient)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def hex2rgb(hexcode):
|
def hex2rgb(hexcode):
|
||||||
return tuple(map(ord,hexcode[1:].decode('hex')))
|
return tuple(map(ord,hexcode[1:].decode('hex')))
|
||||||
|
|
||||||
@ -109,7 +114,7 @@ def rgb2hex(rgb):
|
|||||||
|
|
||||||
# IdiotIA
|
# IdiotIA
|
||||||
import json
|
import json
|
||||||
CurrentPose = 1
|
#CurrentPose = 1
|
||||||
|
|
||||||
# Get frame number for pose path describe in PoseDir
|
# Get frame number for pose path describe in PoseDir
|
||||||
def lengthPOSE(pose_dir):
|
def lengthPOSE(pose_dir):
|
||||||
@ -125,6 +130,47 @@ def lengthPOSE(pose_dir):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def prepareIdiotIA(currentAnim):
|
||||||
|
|
||||||
|
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] = ['boredhh' , xy_center[0] - 100, xy_center[1] + 30, 550, 0, 0, 0, animspeed]
|
||||||
|
anims[1] = ['belka4' , xy_center[0] - 70, xy_center[1] + 380, 680, 0, 0, 0, animspeed]
|
||||||
|
anims[2] = ['belka3' , xy_center[0] - 100, xy_center[1] + 360, 700, 0, 0, 0, animspeed]
|
||||||
|
anims[3] = ['hhhead' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[4] = ['hhhead2', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[5] = ['hhhead4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[6] = ['hhred' , xy_center[0] - 250, xy_center[1] + 220, 550, 0, 0, 0, animspeed]
|
||||||
|
anims[7] = ['hhred2' , xy_center[0] - 200, xy_center[1] + 200, 550, 0, 0, 0, animspeed]
|
||||||
|
anims[8] = ['lady1' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[9] = ['lady1' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[10] = ['lady2' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[11] = ['lady3' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[12] = ['lady4' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[13] = ['mila6' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[14] = ['mila5' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[15] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[16] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[17] = ['belka4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
anims[18] = ['belka3', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||||
|
|
||||||
|
#for laseranims in anims:
|
||||||
|
|
||||||
|
for anim in anims:
|
||||||
|
#print(anim)
|
||||||
|
anim[5] = lengthPOSE(anim[0])
|
||||||
|
WebStatus("Checking "+ anim[0] +"...")
|
||||||
|
if debug > 0:
|
||||||
|
print('poses/' + anim[0], "length :", anim[5], "frames")
|
||||||
|
|
||||||
|
print("Current IdiotIA anim is",anims[currentIdiotia][0],"("+str(currentIdiotia)+")")
|
||||||
|
|
||||||
|
|
||||||
# get absolute face position points
|
# get absolute face position points
|
||||||
def getFACE(pose_json,pose_points, people):
|
def getFACE(pose_json,pose_points, people):
|
||||||
|
|
||||||
@ -180,50 +226,6 @@ def mouth(pose_json, people):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def prepareIdiotIA(currentAnim):
|
|
||||||
|
|
||||||
|
|
||||||
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] = [['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('poses/' + anim[0], "length :", anim[5], "frames")
|
|
||||||
|
|
||||||
print("Current IdiotIA anim is",anims[currentIdiotia][0],"("+str(currentIdiotia)+")")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# display the currentIdiotia animation on all lasers according to display flag
|
# display the currentIdiotia animation on all lasers according to display flag
|
||||||
def IdiotIA():
|
def IdiotIA():
|
||||||
@ -235,7 +237,7 @@ def IdiotIA():
|
|||||||
# if display flag is True, send the face points.
|
# if display flag is True, send the face points.
|
||||||
if idiotiaDisplay[laser]:
|
if idiotiaDisplay[laser]:
|
||||||
|
|
||||||
anim = anims[currentIdiotia][0]
|
anim = anims[currentIdiotia]
|
||||||
#print(anim)
|
#print(anim)
|
||||||
|
|
||||||
PL = laser
|
PL = laser
|
||||||
@ -244,16 +246,19 @@ def IdiotIA():
|
|||||||
dots = []
|
dots = []
|
||||||
|
|
||||||
# increase current frame [4] of speed [7] frames
|
# increase current frame [4] of speed [7] frames
|
||||||
anim[4] += 1
|
#print(anim[4],anim[7],anim[4]+anim[7])
|
||||||
|
|
||||||
|
anim[4] = anim[4]+anim[7]
|
||||||
|
|
||||||
# compare to total frame [5]
|
# compare to total frame [5]
|
||||||
if anim[4] >= anim[5]:
|
if anim[4] >= anim[5]:
|
||||||
anim[4] = 0
|
anim[4] = 0
|
||||||
|
|
||||||
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%anim[4])+'.json'
|
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%int(anim[4]))+'.json'
|
||||||
posefile = open(posename , 'r')
|
posefile = open(posename , 'r')
|
||||||
posedatas = posefile.read()
|
posedatas = posefile.read()
|
||||||
pose_json = json.loads(posedatas)
|
pose_json = json.loads(posedatas)
|
||||||
|
#WebStatus("Frame : "+str("%05d"%int(anim[4])))
|
||||||
|
|
||||||
# Draw Face
|
# Draw Face
|
||||||
|
|
||||||
@ -270,7 +275,6 @@ def IdiotIA():
|
|||||||
lj3.rPolyLineOneColor(mouth(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)
|
lj3.DrawPL(PL)
|
||||||
time.sleep(0.02)
|
|
||||||
|
|
||||||
|
|
||||||
# Init Starfields
|
# Init Starfields
|
||||||
@ -313,8 +317,8 @@ def Starfield(hori=0,verti=0):
|
|||||||
if displayedstars < num_stars and starfieldcount % 15 == 0:
|
if displayedstars < num_stars and starfieldcount % 15 == 0:
|
||||||
displayedstars += 1
|
displayedstars += 1
|
||||||
|
|
||||||
if displayedstars == num_stars and starfieldcount % 10 == 0:
|
#if displayedstars == num_stars and starfieldcount % 10 == 0:
|
||||||
starspeed += 0.005
|
# starspeed += 0.005
|
||||||
|
|
||||||
#print starspeed
|
#print starspeed
|
||||||
|
|
||||||
@ -433,12 +437,11 @@ def LiveFace():
|
|||||||
# /pose/idiotia/lasernumber 1
|
# /pose/idiotia/lasernumber 1
|
||||||
def OSCidiotia(address, value):
|
def OSCidiotia(address, value):
|
||||||
|
|
||||||
print("idiotia",address,value)
|
print("pose idiotia got ",address,value)
|
||||||
|
|
||||||
laser = int(address[14:])
|
laser = int(address[14:])
|
||||||
print("laser", laser, value)
|
print("laser", laser, value)
|
||||||
|
|
||||||
if value == 1:
|
if value == "1" or value == 1:
|
||||||
|
|
||||||
idiotiaDisplay[laser] = True
|
idiotiaDisplay[laser] = True
|
||||||
liveDisplay[laser] = False
|
liveDisplay[laser] = False
|
||||||
@ -450,41 +453,48 @@ def OSCidiotia(address, value):
|
|||||||
idiotiaDisplay[laser] = False
|
idiotiaDisplay[laser] = False
|
||||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||||
|
|
||||||
|
UpdatePoseUI()
|
||||||
|
|
||||||
# /pose/anim
|
# /pose/anim/animnumber 1
|
||||||
def OSCanim(address,state):
|
def OSCanim(address, value):
|
||||||
|
global currentIdiotia
|
||||||
|
|
||||||
print("/pose/anim",address, state)
|
print("pose anim got :", address, type(value), value)
|
||||||
anim = int(address[12:])
|
anim = int(address[11:])
|
||||||
print(anim, state)
|
print("anim", anim)
|
||||||
|
|
||||||
if state == 1:
|
if value == "1" or value == 1:
|
||||||
currentIdiotia = anim
|
currentIdiotia = anim
|
||||||
|
UpdatePoseUI()
|
||||||
|
WebStatus("Running "+ anims[currentIdiotia][0]+"...")
|
||||||
|
|
||||||
|
|
||||||
# /pose/live/lasernumber value
|
# /pose/live/lasernumber value
|
||||||
def OSClive(address,value):
|
def OSClive(address, value):
|
||||||
|
|
||||||
print("live",address,value)
|
print("live",address,value)
|
||||||
laser = int(address[11:])
|
laser = int(address[11:])
|
||||||
print("laser", laser, value)
|
#print("laser", laser, value)
|
||||||
|
|
||||||
if value == "1":
|
if value == "1" or value == 1:
|
||||||
idiotiaDisplay[value] = False
|
idiotiaDisplay[laser] = False
|
||||||
liveDisplay[value] = True
|
liveDisplay[laser] = True
|
||||||
fieldsDisplay[value] = False
|
fieldsDisplay[laser] = False
|
||||||
|
UpdatePoseUI()
|
||||||
|
|
||||||
# /pose/field/lasernumber value
|
# /pose/field/lasernumber value
|
||||||
def OSCfield(address, value):
|
def OSCfield(address, value):
|
||||||
|
|
||||||
print("Pose bank field got", address, "with value", value)
|
print("Pose field got", address, "with value", type(value), value)
|
||||||
laser = int(address[12:])
|
laser = int(address[12:])
|
||||||
print("laser", laser, value)
|
#print("laser", laser, value)
|
||||||
|
|
||||||
if value == "1":
|
if value == "1" or value == 1:
|
||||||
idiotiaDisplay[value] = False
|
print("field",laser,"true")
|
||||||
liveDisplay[value] = False
|
idiotiaDisplay[laser] = False
|
||||||
fieldsDisplay[value] = True
|
liveDisplay[laser] = False
|
||||||
|
fieldsDisplay[laser] = True
|
||||||
|
UpdatePoseUI()
|
||||||
|
|
||||||
|
|
||||||
# /pose/ljclient
|
# /pose/ljclient
|
||||||
@ -494,6 +504,9 @@ def OSCljclient(value):
|
|||||||
lj3.LjClient(ljclient)
|
lj3.LjClient(ljclient)
|
||||||
|
|
||||||
|
|
||||||
|
# /pose/ping value
|
||||||
|
def OSCping(value):
|
||||||
|
lj3.OSCping("pose")
|
||||||
|
|
||||||
'''
|
'''
|
||||||
# Starfield, idiotia
|
# Starfield, idiotia
|
||||||
@ -522,26 +535,26 @@ def UpdatePoseUI():
|
|||||||
for laser in range(LaserNumber):
|
for laser in range(LaserNumber):
|
||||||
|
|
||||||
if idiotiaDisplay[laser]:
|
if idiotiaDisplay[laser]:
|
||||||
lj3.SendLJ("pose/idiotia/" + str(laser) + " 1")
|
lj3.SendLJ("/pose/idiotia/" + str(laser) + " 1")
|
||||||
else:
|
else:
|
||||||
lj3.SendLJ("pose/idiotia/" + str(laser) + " 0")
|
lj3.SendLJ("/pose/idiotia/" + str(laser) + " 0")
|
||||||
|
|
||||||
if liveDisplay[laser]:
|
if liveDisplay[laser]:
|
||||||
lj3.SendLJ("pose/live/" + str(laser) + " 1")
|
lj3.SendLJ("/pose/live/" + str(laser) + " 1")
|
||||||
else:
|
else:
|
||||||
lj3.SendLJ("pose/live/" + str(laser) + " 0")
|
lj3.SendLJ("/pose/live/" + str(laser) + " 0")
|
||||||
|
|
||||||
if fieldsDisplay[laser]:
|
if fieldsDisplay[laser]:
|
||||||
lj3.SendLJ("pose/field/" + str(laser) + " 1")
|
lj3.SendLJ("/pose/field/" + str(laser) + " 1")
|
||||||
else:
|
else:
|
||||||
lj3.SendLJ("pose/field/" + str(laser) + " 0")
|
lj3.SendLJ("/pose/field/" + str(laser) + " 0")
|
||||||
|
|
||||||
|
|
||||||
for anim in range(19):
|
for anim in range(19):
|
||||||
if anim == currentIdiotia:
|
if anim == currentIdiotia:
|
||||||
lj3.SendLJ("pose/anim/" + str(anim) + " 1")
|
lj3.SendLJ("/pose/anim/" + str(anim) + " 1")
|
||||||
else:
|
else:
|
||||||
lj3.SendLJ("pose/anim/" + str(anim) + " 0")
|
lj3.SendLJ("/pose/anim/" + str(anim) + " 0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -549,12 +562,12 @@ print('Loading Pose bank...')
|
|||||||
WebStatus("Loading Pose bank...")
|
WebStatus("Loading Pose bank...")
|
||||||
|
|
||||||
# OSC Server callbacks
|
# OSC Server callbacks
|
||||||
print("Starting OSC server at",myIP,":",OSCinPort,"...")
|
print("Starting OSC server at", myIP, ":", OSCinPort, "...")
|
||||||
osc_startup()
|
osc_startup()
|
||||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||||
|
|
||||||
#osc_method("/pose/run*", OSCrun)
|
#osc_method("/pose/run*", OSCrun)
|
||||||
osc_method("/ping*", lj3.OSCping)
|
osc_method("/ping*", OSCping)
|
||||||
osc_method("/pose/ljclient", OSCljclient)
|
osc_method("/pose/ljclient", OSCljclient)
|
||||||
osc_method("/quit", OSCquit)
|
osc_method("/quit", OSCquit)
|
||||||
osc_method("/pose/idiotia/*", OSCidiotia, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
osc_method("/pose/idiotia/*", OSCidiotia, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||||
@ -562,8 +575,9 @@ osc_method("/pose/field/*", OSCfield,argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPAC
|
|||||||
osc_method("/pose/live/*", OSClive, 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)
|
osc_method("/pose/anim/*", OSCanim, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||||
|
|
||||||
anims =[[]]*20
|
|
||||||
#color = lj3.rgb2int(255,255,255)
|
anims =[[]]*19
|
||||||
|
|
||||||
|
|
||||||
prepareIdiotIA(0)
|
prepareIdiotIA(0)
|
||||||
prepareSTARFIELD()
|
prepareSTARFIELD()
|
||||||
@ -579,24 +593,39 @@ green = lj3.rgb2int(0,255,0)
|
|||||||
print("Updating Pose UI...")
|
print("Updating Pose UI...")
|
||||||
UpdatePoseUI()
|
UpdatePoseUI()
|
||||||
|
|
||||||
WebStatus("Pose bank running.")
|
WebStatus("Running "+ anims[currentIdiotia][0]+"...")
|
||||||
print("Pose bank running")
|
#WebStatus("Pose bank running.")
|
||||||
|
#print("Pose bank running")
|
||||||
|
print("Running "+ anims[currentIdiotia][0]+" on " + str(LaserNumber) +" lasers.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Run():
|
def Run():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while 1:
|
while 1:
|
||||||
|
|
||||||
|
lj3.OSCframe()
|
||||||
|
# If you want an idea
|
||||||
|
# t0 = time.time()
|
||||||
Starfield(hori=0,verti=0)
|
Starfield(hori=0,verti=0)
|
||||||
IdiotIA()
|
IdiotIA()
|
||||||
LiveFace()
|
#LiveFace()
|
||||||
|
time.sleep(0.002)
|
||||||
|
#t1 = time.time()
|
||||||
|
# looptime = t1 - t0
|
||||||
|
# 25 frames/sec -> 1 frame is 0.04 sec long
|
||||||
|
# if looptime is 0.01 sec
|
||||||
|
# 0.04/0.01 = 4 loops with the same anim
|
||||||
|
# so speedanim is 1 / 4 = 0.25
|
||||||
|
# speedanim = 1 / (0.04 / looptime)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
pass
|
#print("Took %f" % (t1 - t0, ))
|
||||||
|
|
||||||
|
#except KeyboardInterrupt:
|
||||||
|
# pass
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
# Gently stop on CTRL C
|
# Gently stop on CTRL C
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ def SendLJ(oscaddress,oscargs=''):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
msg = oscbuildparse.OSCMessage(oscaddress, None, [oscargs])
|
msg = oscbuildparse.OSCMessage(oscaddress, None, [oscargs])
|
||||||
|
# print(msg)
|
||||||
osc_send(msg, "LJ 8002")
|
osc_send(msg, "LJ 8002")
|
||||||
OSCframe()
|
OSCframe()
|
||||||
|
|
||||||
|
@ -133,7 +133,11 @@ def OSCpl(value):
|
|||||||
lj3.WebStatus("Glyph to pl "+ str(value))
|
lj3.WebStatus("Glyph to pl "+ str(value))
|
||||||
lj3.LjPl(value)
|
lj3.LjPl(value)
|
||||||
|
|
||||||
|
# /pose/ping value
|
||||||
|
def OSCping(value):
|
||||||
|
lj3.OSCping("glyph")
|
||||||
|
|
||||||
|
'''
|
||||||
def Proj(x,y,z,angleX,angleY,angleZ):
|
def Proj(x,y,z,angleX,angleY,angleZ):
|
||||||
|
|
||||||
rad = angleX * math.pi / 180
|
rad = angleX * math.pi / 180
|
||||||
@ -176,7 +180,7 @@ def Run():
|
|||||||
print("Starting OSC at",myIP," port",OSCinPort,"...")
|
print("Starting OSC at",myIP," port",OSCinPort,"...")
|
||||||
osc_startup()
|
osc_startup()
|
||||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||||
osc_method("/ping*", lj3.OSCping)
|
osc_method("/ping*", OSCping)
|
||||||
osc_method("/glyph/ljclient", OSCljclient)
|
osc_method("/glyph/ljclient", OSCljclient)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -82,6 +82,7 @@ def SendLJ(oscaddress,oscargs=''):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
msg = oscbuildparse.OSCMessage(oscaddress, None, [oscargs])
|
msg = oscbuildparse.OSCMessage(oscaddress, None, [oscargs])
|
||||||
|
# print(msg)
|
||||||
osc_send(msg, "LJ 8002")
|
osc_send(msg, "LJ 8002")
|
||||||
OSCframe()
|
OSCframe()
|
||||||
|
|
||||||
@ -93,10 +94,8 @@ def WebStatus(message):
|
|||||||
SendLJ("/status", message)
|
SendLJ("/status", message)
|
||||||
|
|
||||||
|
|
||||||
# Answer to LJ pings
|
# Answer to LJ pings with /pong pluginame
|
||||||
def OSCping(value):
|
def OSCping(value):
|
||||||
# Will receive message address, and message data flattened in s, x, y
|
|
||||||
print("Got /ping with value", value)
|
|
||||||
SendLJ("/pong",value)
|
SendLJ("/pong",value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import pdb
|
|||||||
import types, ast, argparse
|
import types, ast, argparse
|
||||||
from OSC import OSCServer, OSCClient, OSCMessage
|
from OSC import OSCServer, OSCClient, OSCMessage
|
||||||
|
|
||||||
|
screen_size = [750,750]
|
||||||
pl = [[],[],[],[]]
|
pl = [[],[],[],[]]
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ def RenderScreen(surface):
|
|||||||
if c: pygame.draw.line(surface,c,xyc_prev[:2],xyc[:2],3)
|
if c: pygame.draw.line(surface,c,xyc_prev[:2],xyc[:2],3)
|
||||||
xyc_prev = xyc
|
xyc_prev = xyc
|
||||||
|
|
||||||
screen_size = [700,700]
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
screen = pygame.display.set_mode(screen_size)
|
screen = pygame.display.set_mode(screen_size)
|
||||||
pygame.display.set_caption("LJ Simulator")
|
pygame.display.set_caption("LJ Simulator")
|
||||||
|
Loading…
Reference in New Issue
Block a user