|
|
@@ -50,11 +50,8 @@ parser.add_option("", "--dual-vpu", dest="dual_vpu",default=0,
|
|
|
help=" --dual-vpu=1/0") #, metavar="FILE")
|
|
|
|
|
|
|
|
|
-parser.add_option("", "--grid-a1-idim", dest="grid_a1_idim",default=0,
|
|
|
- help=" grid_a1_idim") #, metavar="FILE")
|
|
|
-
|
|
|
-parser.add_option("", "--grid-a2-idim", dest="grid_a2_idim",default=0,
|
|
|
- help=" grid_a2_idim") #, metavar="FILE")
|
|
|
+parser.add_option("", "--out-idim", dest="out_idim",default="",
|
|
|
+ help=" out_idim") #, metavar="FILE")
|
|
|
|
|
|
|
|
|
parser.add_option("", "--countdown", dest="countdown",#default=1,
|
|
|
@@ -159,37 +156,10 @@ try:
|
|
|
MEDIALIST = open_medialist()
|
|
|
except:pass
|
|
|
|
|
|
-#import json
|
|
|
-#import pickle
|
|
|
|
|
|
from tool.video_capture import scan_capture #as scan_capture
|
|
|
|
|
|
|
|
|
-
|
|
|
-def VideoMeta():
|
|
|
- out = {}
|
|
|
- out["run"] = 1
|
|
|
- out["x"] = 0
|
|
|
- out["y"] = 0
|
|
|
- out["ang"] = 0
|
|
|
- out["scale"] = 0
|
|
|
- out["fname"] = "xxx.mp4"
|
|
|
- out["fpath"] = "xxx.mp4"
|
|
|
-
|
|
|
-class VideoPlayer(): # concept / mokup
|
|
|
- def __init__():
|
|
|
- self.data = VideoMeta()
|
|
|
- def play(self):
|
|
|
- pass
|
|
|
- def pause(self):
|
|
|
- pass
|
|
|
- def reset(self):
|
|
|
- pass
|
|
|
- def select(self):
|
|
|
- pass
|
|
|
- def draw(self):
|
|
|
- pass
|
|
|
-
|
|
|
def _rescale_frame_by_width(frame, width):
|
|
|
#print(type(frame)) #np array
|
|
|
height = int(frame.shape[0]/frame.shape[1] * width )
|
|
|
@@ -934,41 +904,6 @@ def loop_videoplayer():
|
|
|
break
|
|
|
|
|
|
thread.start_new_thread(loop_videoplayer,())
|
|
|
-# ===== ======
|
|
|
-
|
|
|
-#self.fname = MEDIALIST[0]
|
|
|
-videoplayer2 = []
|
|
|
-def loop2_videoplayer():
|
|
|
- while 1:
|
|
|
- print()
|
|
|
- print()
|
|
|
- print()
|
|
|
- for i,v in enumerate(MEDIALIST):
|
|
|
- try:
|
|
|
- video1 = videoplayer2[i]
|
|
|
- video1.select_video(i)
|
|
|
- except:
|
|
|
- vi = PixelMedia(181,1)
|
|
|
- videoplayer2.append( vi )
|
|
|
-
|
|
|
-
|
|
|
- _videoplayer = videoplayer2[:]
|
|
|
-
|
|
|
- ok = 0
|
|
|
- j =0
|
|
|
- for i in _videoplayer: #.append( PixelMedia(cdmx,_id=_vid) )
|
|
|
- try:
|
|
|
- r = i.read() # read next frame from file
|
|
|
- if r:
|
|
|
- print(j,len(videoplayer2),i,len(i.buffer))
|
|
|
- ok = 1
|
|
|
- except Exception as e:
|
|
|
- cprint("EXCEPTION loop2_videoplayer ",e,color="red")
|
|
|
-
|
|
|
- time.sleep(0.002)
|
|
|
- j += 1
|
|
|
-
|
|
|
-
|
|
|
|
|
|
p = 16
|
|
|
block = [p,p]
|
|
|
@@ -990,13 +925,18 @@ if options.mode:
|
|
|
cprint( "Exc",options.mode,e,color="red")
|
|
|
|
|
|
# PARSE COMMANDLINE ARGUMENTS
|
|
|
-CFG_IN = {"name":"CFG_IN","x1":40,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300}
|
|
|
-CFG_OUT = {"name":"CFG_OUT","x1":40,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
|
|
|
-#CFG_OUT2 = {"name":"CFG_OUT2","x1":p*8+142,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
|
|
|
-CFG_OUT2 = {"name":"CFG_OUT2","x1":p*8+(16*2)+8,"y1":60,"x2":300,"y2":300 ,"w":300,"h":300,"on":0}
|
|
|
-CFG_BLOCK = {"name":"CFG_BLOCK","size":16,"h-split":2,"v-split":2,"h-count":8,"v-count":8}
|
|
|
+CFG_IN = {"name":"CFG_IN","x1":40,"y1":60,"x2":0,"y2":0 ,"w":0,"h":300}
|
|
|
|
|
|
-
|
|
|
+# OUTPUT CFG INIT
|
|
|
+CFG_OUT = []
|
|
|
+out_idim = options.out_idim.split(",")
|
|
|
+x1 = 40
|
|
|
+for i,v in enumerate(out_idim):
|
|
|
+ _t = {"name":"CFG_OUT{}".format(i+1),"x1":x1,"y1":60,"x2":0,"y2":0 ,"w":30,"h":30,"on":1,"DMX-CH":v}
|
|
|
+ CFG_OUT.append(_t)
|
|
|
+ x1 += p*8
|
|
|
+
|
|
|
+CFG_BLOCK = {"name":"CFG_BLOCK","size":16,"h-split":2,"v-split":2,"h-count":8,"v-count":8}
|
|
|
|
|
|
if _x < 1:
|
|
|
_x = 1
|
|
|
@@ -1086,27 +1026,22 @@ def clean_path(path):
|
|
|
PIXEL_MAPPING = 0
|
|
|
vpu_wall_conf_file = HOME+"/LibreLight/vpu_wall_conf.csv"
|
|
|
|
|
|
-grid_file = "/tmp/vpu_grid_hd.csv"
|
|
|
-text_file = HOME+"/LibreLight/vpu_text_hd.csv"
|
|
|
-media_list = "/tmp/vpu_medialist_hd.csv"
|
|
|
+grid_file = "/tmp/vpu_grid_hd.csv"
|
|
|
+text_file = HOME+"/LibreLight/vpu_text_hd.csv"
|
|
|
media_list = HOME+"/LibreLight/video/" #.format(path)
|
|
|
+
|
|
|
pm_wy = 0
|
|
|
if options.pixel_mapping:
|
|
|
PIXEL_MAPPING = 1
|
|
|
- CFG_OUT["on"] = 1
|
|
|
path = options.pixel_mapping
|
|
|
path = clean_path(path)
|
|
|
grid_file = HOME+"/LibreLight/vpu_grid_hd{}.csv".format(path)
|
|
|
if options.dual_vpu:
|
|
|
grid_file = HOME+"/LibreLight/vpu_grid_dual{}.csv".format(path)
|
|
|
+
|
|
|
text_file = HOME+"/LibreLight/vpu_text_hd{}.csv".format(path)
|
|
|
- media_list = HOME+"/LibreLight/vpu_medialist_hd{}.csv".format(path)
|
|
|
media_list = HOME+"/LibreLight/video/" #.format(path)
|
|
|
- #_x = 8
|
|
|
- #_y = 8
|
|
|
|
|
|
-if options.dual_vpu:
|
|
|
- CFG_OUT2["on"] = 1
|
|
|
|
|
|
print(" ",[options.pixel_mapping],"grid_file",grid_file)
|
|
|
#grid_file = HOME+"/LibreLight/vpu_grid_hd.csv"
|
|
|
@@ -1141,11 +1076,9 @@ except Exception as e:
|
|
|
CFG_IN["w"] = CFG_BLOCK["size"] * CFG_BLOCK["h-count"]
|
|
|
CFG_IN["h"] = CFG_BLOCK["size"] * CFG_BLOCK["v-count"]
|
|
|
|
|
|
-CFG_OUT["w"] = CFG_BLOCK["size"] * 8
|
|
|
-CFG_OUT["h"] = CFG_BLOCK["size"] * 8
|
|
|
-
|
|
|
-CFG_OUT2["w"] = CFG_BLOCK["size"] * 8
|
|
|
-CFG_OUT2["h"] = CFG_BLOCK["size"] * 8
|
|
|
+for CFG_OUTx in CFG_OUT:
|
|
|
+ CFG_OUTx["w"] = CFG_BLOCK["size"] * 8
|
|
|
+ CFG_OUTx["h"] = CFG_BLOCK["size"] * 8
|
|
|
|
|
|
|
|
|
def CFG_CALC_P(CFG):
|
|
|
@@ -1159,8 +1092,9 @@ def CFG_CALC_P(CFG):
|
|
|
#CFG_IN["w"] = int(CFG_BLOCK["v-count"]-2) * CFG_BLOCK["size"]
|
|
|
|
|
|
CFG_CALC_P(CFG_IN)
|
|
|
-CFG_CALC_P(CFG_OUT)
|
|
|
-CFG_CALC_P(CFG_OUT2)
|
|
|
+
|
|
|
+for CFG_OUTx in CFG_OUT:
|
|
|
+ CFG_CALC_P(CFG_OUTx)
|
|
|
|
|
|
print("CFG_BLOCK",CFG_BLOCK)
|
|
|
print()
|
|
|
@@ -1519,11 +1453,13 @@ frame_t = time.time()
|
|
|
frame2_t = time.time()
|
|
|
IP = "yyy"
|
|
|
|
|
|
+vplay=[]
|
|
|
vplay1=0
|
|
|
vplay2=0
|
|
|
if options.videoplayer:
|
|
|
try:
|
|
|
t=options.videoplayer.split(",")
|
|
|
+ vplay=t
|
|
|
vplay1=t[0]
|
|
|
vplay2=t[1]
|
|
|
except:pass
|
|
|
@@ -1570,21 +1506,15 @@ def draw_main_overlay():
|
|
|
fr = font15.render("start-uni: {:}.xx dRGB".format(START_UNIV) ,1, (200,0,255))
|
|
|
window.blit(fr,(90,2))
|
|
|
|
|
|
- fr = font15.render("a1_idim: {}.{:}".format(START_UNIV_A,options.grid_a1_idim) ,1, (200,0,255))
|
|
|
- window.blit(fr,(90,12))
|
|
|
-
|
|
|
- fr = font15.render("a2_idim: {}.{:}".format(START_UNIV_A,options.grid_a2_idim) ,1, (200,0,255))
|
|
|
- window.blit(fr,(90,22))
|
|
|
-
|
|
|
fr = font15.render("gobo_ch1: {}.{:}".format(START_UNIV_A,options.gobo_ch) ,1, (200,0,255))
|
|
|
- window.blit(fr,(180,12))
|
|
|
+ window.blit(fr,(210,2))
|
|
|
fr = font15.render("gobo_ch2: {}.{:}".format(START_UNIV_A,options.gobo_ch2) ,1, (200,0,255))
|
|
|
- window.blit(fr,(180,22))
|
|
|
+ window.blit(fr,(210,12))
|
|
|
|
|
|
- fr = font15.render("v-play1: {}.{:}".format(START_UNIV_A,vplay1) ,1, (200,0,255))
|
|
|
- window.blit(fr,(270,12))
|
|
|
- fr = font15.render("v-play2: {}.{:}".format(START_UNIV_A,vplay2) ,1, (200,0,255))
|
|
|
- window.blit(fr,(270,22))
|
|
|
+
|
|
|
+ for i,v in enumerate(vplay):
|
|
|
+ fr = font15.render("v-play{}: {}.{:}".format(i+1,START_UNIV_A,v) ,1, (200,0,255))
|
|
|
+ window.blit(fr,(300,2+12*i))
|
|
|
|
|
|
try:
|
|
|
global pointer
|
|
|
@@ -1596,15 +1526,40 @@ def draw_main_overlay():
|
|
|
except Exception as e:
|
|
|
print("Overlay err:",e)
|
|
|
|
|
|
- rgb = [255,255,200]
|
|
|
- global CFG
|
|
|
+def draw_marker():
|
|
|
+ # kennlinie linker rand
|
|
|
+ # limit marker INPUT AREA
|
|
|
+ rgb = [0,127,255] # orange
|
|
|
+ for CFG_OUTx in CFG_OUT: #["y1"]
|
|
|
+ f_x = CFG_OUTx["y1"]
|
|
|
+ pygame.draw.line(window,rgb,[0,f_x],[20,f_x])
|
|
|
+ f_x = CFG_OUTx["y2"]
|
|
|
+ pygame.draw.line(window,rgb,[0,f_x],[20,f_x])
|
|
|
+
|
|
|
+ if CFG_OUT:
|
|
|
+ f_x = CFG_OUT[0]["y1"]
|
|
|
+ for i,v in enumerate("OUTPUT"):
|
|
|
+ fr = font15.render(v ,1, rgb) #(200,0,255))
|
|
|
+ if v == "I":
|
|
|
+ window.blit(fr,(10+2,f_x+i*15+15))
|
|
|
+ else:
|
|
|
+ window.blit(fr,(10,f_x+i*15+15))
|
|
|
|
|
|
- # kennlinie linker rand
|
|
|
+ # kennlinie linker rand
|
|
|
+ # limit marker INPUT AREA
|
|
|
+ rgb = [255,127,0] # orange
|
|
|
f_x = CFG_IN["y1"]
|
|
|
pygame.draw.line(window,rgb,[0,f_x],[20,f_x])
|
|
|
f_x = CFG_IN["y2"]
|
|
|
pygame.draw.line(window,rgb,[0,f_x],[20,f_x])
|
|
|
|
|
|
+ f_x = CFG_IN["y1"]
|
|
|
+ for i,v in enumerate("INPUT"):
|
|
|
+ fr = font15.render(v ,1, rgb) #(200,0,255))
|
|
|
+ if v == "I":
|
|
|
+ window.blit(fr,(10+2,f_x+i*15+15))
|
|
|
+ else:
|
|
|
+ window.blit(fr,(10,f_x+i*15+15))
|
|
|
|
|
|
def draw_box_frame(window,rgb,pos,offset=0):
|
|
|
p1 = [pos[0],pos[1]]
|
|
|
@@ -1703,7 +1658,7 @@ def open_medialist():
|
|
|
l = l.strip()
|
|
|
if "_" in l:
|
|
|
ll = l.split("_",1)
|
|
|
- print(">> ",ll)
|
|
|
+ #print(">> ",ll)
|
|
|
try:
|
|
|
lll = int(ll[0])
|
|
|
lines[lll] = l
|
|
|
@@ -1845,43 +1800,6 @@ if options.gobo_ch:
|
|
|
if gobo_ch <= 0:
|
|
|
gobo_ch = 1
|
|
|
|
|
|
-
|
|
|
-def draw_box(pos1,pos2,color=[128,128,128],text=1):
|
|
|
-
|
|
|
- color = [200,0,0,127]
|
|
|
-
|
|
|
- if text:
|
|
|
- fr = font15.render("A" ,1, (200,200,200))
|
|
|
- window.blit(fr,pos1)
|
|
|
-
|
|
|
- fr = font15.render("B" ,1, (200,200,200))
|
|
|
- window.blit(fr,[pos2[0]-10,pos2[1]-10])
|
|
|
-
|
|
|
- # h unten
|
|
|
- _pos1 = [pos1[0],pos2[1]]
|
|
|
- _pos2 = [pos2[0],pos2[1]]
|
|
|
- pygame.draw.aaline(window,color,_pos1,_pos2,1)
|
|
|
-
|
|
|
- color = [255,255,0,127]
|
|
|
- # h rechts
|
|
|
- _pos1 = [pos2[0],pos1[1]]
|
|
|
- _pos2 = [pos2[0],pos2[1]]
|
|
|
- pygame.draw.aaline(window,color,_pos1,_pos2,1)
|
|
|
-
|
|
|
-
|
|
|
- color = [0,200,0,127]
|
|
|
- # h links
|
|
|
- _pos1 = [pos1[0],pos1[1]]
|
|
|
- _pos2 = [pos1[0],pos2[1]]
|
|
|
- pygame.draw.aaline(window,color,_pos1,_pos2,1)
|
|
|
-
|
|
|
-
|
|
|
- color = [0,0,200,127]
|
|
|
- # h oben
|
|
|
- _pos1 = [pos1[0],pos1[1]]
|
|
|
- _pos2 = [pos2[0],pos1[1]]
|
|
|
- pygame.draw.aaline(window,color,_pos1,_pos2,1)
|
|
|
-
|
|
|
def grab(x=55,y=55,w=60,h=60):
|
|
|
crop = None
|
|
|
rect = pygame.Rect(x, y, w, h)
|
|
|
@@ -1946,6 +1864,7 @@ def read_wall_pix(init=0):
|
|
|
|
|
|
if not ok:
|
|
|
return
|
|
|
+ print("read_wall_pix",vpu_wall_conf_file)
|
|
|
|
|
|
_last_wall_config_time = time.time()
|
|
|
if not os.path.isfile(vpu_wall_conf_file):
|
|
|
@@ -1970,8 +1889,8 @@ def read_wall_pix(init=0):
|
|
|
_l.append(i)
|
|
|
grid.append(_l)
|
|
|
|
|
|
- for i,v in enumerate(grid):
|
|
|
- print(i,v)
|
|
|
+ #for i,v in enumerate(grid):
|
|
|
+ # print(i,v)
|
|
|
|
|
|
wall_data = grid
|
|
|
read_wall_pix(init=1)
|
|
|
@@ -2019,7 +1938,7 @@ def reshape2(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
target_x=40+(_wall[4]-1)*_w
|
|
|
target_y=60+(_wall[5]-1)*_h
|
|
|
sub = grab(from_x,from_y,_w,_h)
|
|
|
- #draw_box_frame(window,[0,40,0],[from_x+x,from_y+y,_w,_h])
|
|
|
+
|
|
|
if sub:
|
|
|
sub = pygame.transform.rotate(sub,ang)
|
|
|
window.blit(sub,(target_x,target_y))
|
|
|
@@ -2029,133 +1948,6 @@ def reshape2(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
|
|
|
|
|
|
|
|
|
-def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
- """reshape LED-WALL Block/Pixel mapping"""
|
|
|
- if PIXEL_MAPPING <= 0:
|
|
|
- return None
|
|
|
-
|
|
|
-
|
|
|
- x = _x
|
|
|
- y = _y
|
|
|
- i = 0
|
|
|
- counter = 0
|
|
|
- z=0
|
|
|
- x_min = 99999
|
|
|
- x_max = 0
|
|
|
- y_min = 99999
|
|
|
- y_max = 0
|
|
|
-
|
|
|
- pos= [0,0]
|
|
|
- pos[0] = _x+p*3 #+10
|
|
|
- pos[1] = p*8+65 #-10 #_y+p*8+80
|
|
|
-
|
|
|
-
|
|
|
- tmp_font = pygame.font.SysFont("freemonobold",int(p*0.8))
|
|
|
-
|
|
|
- #fr = tmp_font.render("OUTPUT: "+str(name) ,1, (255,255,255))
|
|
|
- #fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
- #window.blit(fr,pos)
|
|
|
-
|
|
|
- fr = tmp_font.render("INPUT" ,1, (255,255,255))
|
|
|
- fr_r = fr.get_rect(center=(int(wx/2),int(60+pm_wy-p/2)))
|
|
|
- window.blit(fr,fr_r)
|
|
|
-
|
|
|
-
|
|
|
- j = 0
|
|
|
- for fix in GRID_OUT:
|
|
|
- if j >= 64:
|
|
|
- break
|
|
|
- j+=1
|
|
|
- ii = i
|
|
|
- #pos = fix.POS(40,60)
|
|
|
- pos = fix.POS() #(0,0)
|
|
|
- rgb = fix.rgb
|
|
|
- pos[0]+=_x
|
|
|
- pos[1]+=_y
|
|
|
-
|
|
|
- # green
|
|
|
- pygame.draw.rect(window,[0,40,0],pos)
|
|
|
-
|
|
|
- xposs = [] #None #pos[:]
|
|
|
- for fix2 in GRID:
|
|
|
- if fix._id == fix2._id:
|
|
|
- #_xposs = fix2.POS(40,60)
|
|
|
- #_xposs = fix2.POS(0,0)#_x,_y)
|
|
|
- _xposs = fix2.POS() #(CFG_IN["x1"],CFG_IN["y1"])
|
|
|
- xposs.append( _xposs) #fix2.POS(40,60) )
|
|
|
- # ToDo
|
|
|
- #sub = grab(10,10,60,60)
|
|
|
- #sub = pygame.transform.rotate(sub,90)
|
|
|
- #wn.blit(sub, (500,10))
|
|
|
- for xpos in xposs:
|
|
|
- #sub = grab(xpos[0],xpos[1]+pm_wy,xpos[2],xpos[3])
|
|
|
- sub = grab(xpos[0],xpos[1],xpos[2],xpos[3])
|
|
|
- if NR:
|
|
|
- pygame.draw.rect(window,[255,0,255],xpos,1) # frame on grab area
|
|
|
- if sub:
|
|
|
- window.blit(sub, (pos[0]+z,pos[1]+z))
|
|
|
- else:
|
|
|
- # red
|
|
|
- pygame.draw.rect(window,[40,0,0],pos) #[x+pos[0]+2+z,y+pos[1]+2+z-pm_wy,12,9])
|
|
|
-
|
|
|
-
|
|
|
- if xpos[0] < x_min:
|
|
|
- x_min = xpos[0]
|
|
|
- if xpos[0] > x_max:
|
|
|
- x_max += xpos[2]
|
|
|
-
|
|
|
- if xpos[1] < y_min:
|
|
|
- y_min = xpos[1]
|
|
|
- if xpos[1] > x_max:
|
|
|
- y_max += xpos[3]
|
|
|
- # DRAW FIX NUMBER on TOP
|
|
|
-
|
|
|
- #apos = fix.POS(40,60)#+pm_wy)
|
|
|
- apos = fix.POS() #0,0)#+pm_wy)
|
|
|
- apos[0]+=_x
|
|
|
- apos[1]+=_y
|
|
|
- argb = fix.rgb
|
|
|
-
|
|
|
- # overwrite number overlay
|
|
|
- if NR:
|
|
|
- pygame.draw.rect(window,[20,20,20],[apos[0],apos[1],12,8])
|
|
|
-
|
|
|
- fix_id = fix._id
|
|
|
- if fix_id > 8*8:
|
|
|
- fix_id -= 8*8
|
|
|
- if NR:# == 2: # sub fix_nr
|
|
|
- if fix_id != i+1:
|
|
|
- fr = font12.render("{:02}".format(fix._id) ,1, (255,255,0))
|
|
|
- window.blit(fr,(apos[0],apos[1]))
|
|
|
- else:
|
|
|
- fr = font12.render("{:02}".format(fix._id) ,1, (100,100,255))
|
|
|
- window.blit(fr,(apos[0],apos[1]))
|
|
|
- i += 1
|
|
|
- #print("--#")
|
|
|
-
|
|
|
- # frame box
|
|
|
- pos1= [x+x_min,y+x_min]
|
|
|
- pos2= [x_max+x_min,y_min+y_max]
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-class Timer():
|
|
|
- def __init__(self,start=120):
|
|
|
- self.start = start
|
|
|
- self.timer = self.start
|
|
|
-
|
|
|
- self.timer_t = time.time()
|
|
|
-
|
|
|
- def reset(self):
|
|
|
- self.timer = self.start
|
|
|
-
|
|
|
- def get(self):
|
|
|
- self.timer -= time.time()-self.timer_t
|
|
|
- self.timer_t = time.time()
|
|
|
- if self.timer <= 0:
|
|
|
- self.reset()
|
|
|
- return self.timer
|
|
|
-
|
|
|
def reload_grid():
|
|
|
print("==== reload_grid")
|
|
|
global GRID
|
|
|
@@ -2166,14 +1958,7 @@ def reload_grid():
|
|
|
except Exception as e:
|
|
|
cprint("Except: grid re init",e,color="red")
|
|
|
|
|
|
-VPU_TEXT = []
|
|
|
-def load_vpu_text(nr=0):
|
|
|
- txt = "NONE"
|
|
|
- if len(VPU_TEXT) > nr:
|
|
|
- txt = VPU_TEXT[0]
|
|
|
- return txt
|
|
|
|
|
|
-import string
|
|
|
def draw_kachel_nr(): #GRID,_x=0,_y=0):
|
|
|
if not NR:
|
|
|
return
|
|
|
@@ -2182,20 +1967,16 @@ def draw_kachel_nr(): #GRID,_x=0,_y=0):
|
|
|
_y=0
|
|
|
for i in range(8): # ROW / ZEILEN -> ->
|
|
|
_x=0
|
|
|
- for j in range(30): # COLUMS / SPALTEN | |
|
|
|
+ OUT_COUNT = len(CFG_OUT)
|
|
|
+
|
|
|
+ for j in range(8*OUT_COUNT): # COLUMS / SPALTEN | |
|
|
|
pygame.draw.rect(window,[10,20,10],[40+_x+2,60+_y+2,14,9]) #background
|
|
|
- _j=j #string.ascii_uppercase[j]
|
|
|
+ _j=j
|
|
|
fr = font12.render("{}:{}".format(_j+1,i+1) ,1, (200,200,55))
|
|
|
window.blit(fr,(40+_x+2,60+_y+2))
|
|
|
- #fr = font12.render("{}".format(_j) ,1, (200,200,55))
|
|
|
- #window.blit(fr,(40+_x+2,60+_y+2))
|
|
|
- #fr = font12.render(":{}".format(i+1) ,1, (200,200,55))
|
|
|
- #window.blit(fr,(40+_x+2+6,60+_y+2))
|
|
|
_x+=16 # pix
|
|
|
_y +=16 # pix
|
|
|
|
|
|
-grid_counter = time.time()
|
|
|
-
|
|
|
|
|
|
def draw_counter(COUNTER):
|
|
|
for count in COUNTER:
|
|
|
@@ -2263,13 +2044,6 @@ def draw_counter(COUNTER):
|
|
|
pygame.draw.rect(window,[0,0,0],fr_r)
|
|
|
window.blit(fr,fr_r)
|
|
|
|
|
|
-class FADE():
|
|
|
- def __init__(self,sec):
|
|
|
- self.start = time.time()
|
|
|
- self.sec = sec
|
|
|
- self.val
|
|
|
- def next(self):
|
|
|
- pass
|
|
|
|
|
|
def video_overlay_draw(wn=None,lines=["line1","line2"],i=0):
|
|
|
# overlay
|
|
|
@@ -2623,65 +2397,22 @@ def grid_label(GRID,_x=0,_y=0):
|
|
|
fr = font12.render("{}".format(pos[0]+1) ,1, (200,200,200))
|
|
|
window.blit(fr,(pos[0]+2,35 ))
|
|
|
|
|
|
- #pygame.draw.rect(window,rgb,pos)
|
|
|
|
|
|
|
|
|
|
|
|
-def grid_sub_label(GRID,_x=0,_y=0):
|
|
|
- h = 1
|
|
|
- v = 1
|
|
|
- for fix in GRID:
|
|
|
- j = 0
|
|
|
- #pos = fix.POS(_x,_y)
|
|
|
- pos = fix.POS() #CFG_IN["x1"],CFG_IN["y1"])
|
|
|
-
|
|
|
- for subfix in fix.sub_fix:
|
|
|
- subfix.dmx_calc(data)
|
|
|
- spos = subfix.POS() #(_x,_y)
|
|
|
- srgb = subfix.rgb
|
|
|
-
|
|
|
- # draw row/col grid number
|
|
|
- if subfix.pos[0] == 0:
|
|
|
- fr = font12.render("{}".format(v ) ,1, (200,200,200))
|
|
|
- window.blit(fr,(25,spos[1] ))
|
|
|
- v += 1
|
|
|
- if subfix.pos[1] == 0:
|
|
|
- fr = font12.render("{}".format(1) ,1, (200,200,200))
|
|
|
- fr = font12.render("{}".format(h ) ,1, (200,200,200))
|
|
|
- h+=1
|
|
|
- window.blit(fr,(spos[0],50 ))
|
|
|
-
|
|
|
- if p >= 40:
|
|
|
- if NR:
|
|
|
- fr = font15.render("{:02}".format(subfix._id) ,1, (250,200,5))
|
|
|
- window.blit(fr,(spos[0]+2,spos[1]+10))
|
|
|
- j += 1
|
|
|
-
|
|
|
-def frame_area():
|
|
|
+def out_frame():
|
|
|
rgb = [255,255,0]
|
|
|
- CFG = CFG_IN
|
|
|
-
|
|
|
-
|
|
|
- p1 = CFG_IN["p1"]
|
|
|
- p2 = CFG_IN["p2"]
|
|
|
- draw_frame(window,rgb,p1,p2,offset=2)
|
|
|
rgb = [255,0,0]
|
|
|
- #draw_frame(window,rgb,p1,p2,offset=4)
|
|
|
-
|
|
|
|
|
|
- if CFG_OUT["on"]:
|
|
|
- rgb = [255,0,0]
|
|
|
- p1 = CFG_OUT["p1"]
|
|
|
- p2 = CFG_OUT["p2"]
|
|
|
- #pygame.draw.line(window,rgb,p1,p2)
|
|
|
- draw_frame(window,rgb,p1,p2,offset=3)
|
|
|
+ for CFG_OUTx in CFG_OUT:
|
|
|
+ if CFG_OUTx["on"]:
|
|
|
+ rgb = [255,0,0]
|
|
|
+ p1 = CFG_OUTx["p1"][:]
|
|
|
+ p2 = CFG_OUTx["p2"][:]
|
|
|
+ p1[0] += 4
|
|
|
+ p2[0] -= 4
|
|
|
+ draw_frame(window,rgb,p1,p2,offset=3)
|
|
|
|
|
|
- if CFG_OUT2["on"]:
|
|
|
- rgb = [255,0,0]
|
|
|
- p1 = CFG_OUT2["p1"]
|
|
|
- p2 = CFG_OUT2["p2"]
|
|
|
- #pygame.draw.line(window,rgb,p1,p2)
|
|
|
- draw_frame(window,rgb,p1,p2,offset=3)
|
|
|
|
|
|
ips=[]
|
|
|
dataA=[]
|
|
|
@@ -2714,79 +2445,55 @@ def dmx_loop():
|
|
|
while 1:
|
|
|
dmx_raw()
|
|
|
time.sleep(1/40) # fast high cpu
|
|
|
- #time.sleep(1/25)
|
|
|
if QUIT:
|
|
|
break
|
|
|
|
|
|
-dmx_raw()
|
|
|
-
|
|
|
thread.start_new_thread(dmx_loop,())
|
|
|
|
|
|
def draw_output_label(CFG,value,dmx="0.0",name="GRID_XX"):
|
|
|
dim_raw = value
|
|
|
|
|
|
- pygame.draw.rect(window,[5,5,155],[CFG["x1"]-5,CFG["y2"]+4,130,35]) # background
|
|
|
+ pygame.draw.rect(window,[5,5,155],[CFG["x1"]+2,CFG["y2"]+5,CFG["w"]-6,25]) # background
|
|
|
|
|
|
# GRID_A1_DIM_LABEL
|
|
|
- fr = font15.render("Output:"+name,1, (255,255,255))
|
|
|
+ fr = font15.render("Name: "+name,1, (255,255,255))
|
|
|
fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
- window.blit(fr,(CFG["x1"],CFG["y2"]+5))
|
|
|
+ window.blit(fr,(CFG["x1"]+4,CFG["y2"]+5))
|
|
|
|
|
|
fr = font15.render("inv-dim: "+str(dim_raw) ,1, (255,255,255))
|
|
|
fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
- window.blit(fr,(CFG["x1"]+60,CFG["y2"]+15))
|
|
|
+ window.blit(fr,(CFG["x1"]+64,CFG["y2"]+20))
|
|
|
|
|
|
fr = font15.render("dmx: {}.{}".format(START_UNIV_A,dmx) ,1, (255,255,255))
|
|
|
- window.blit(fr,(CFG["x1"],CFG["y2"]+15))
|
|
|
+ window.blit(fr,(CFG["x1"]+4,CFG["y2"]+20))
|
|
|
|
|
|
-def GRID_DIM(dim,x,y):
|
|
|
+def _check_dim(_dim):
|
|
|
+ dim = 255
|
|
|
try:
|
|
|
- dim = int(grid_dim_v)
|
|
|
+ dim = int(_dim)
|
|
|
if dim > 255:
|
|
|
dim = 255
|
|
|
if dim <=0:
|
|
|
dim = 0
|
|
|
- except:pass
|
|
|
+ except:
|
|
|
+ pass
|
|
|
+ return dim
|
|
|
+
|
|
|
+def _GRID_DIM(dim,x,y):
|
|
|
+ dim = _check_dim(dim)
|
|
|
dim_raw = dim*-1
|
|
|
s = pygame.Surface((p*8,p*8)) # the size of your rect
|
|
|
s.set_alpha(dim) # alpha level
|
|
|
s.fill((0,0,0)) # this fills the entire surface
|
|
|
window.blit(s, (x,y))
|
|
|
|
|
|
-def GRID_A1_DIM():
|
|
|
- # GRID_A1 DIM
|
|
|
- if options.grid_a1_idim:
|
|
|
- CFG=CFG_OUT
|
|
|
- grid_dim_ch = int(options.grid_a1_idim)
|
|
|
- grid_dim_v = dataA[grid_dim_ch-1]
|
|
|
- dim=255
|
|
|
- dim=grid_dim_v
|
|
|
- #dim=120
|
|
|
- GRID_DIM(dim,x=CFG["x1"],y=CFG["y2"]-p*8)
|
|
|
- a=options.grid_a1_idim
|
|
|
- draw_output_label(CFG,dim,a,name="GRID_A1_DIM")
|
|
|
+def GRID_DIM():
|
|
|
+ for CFG in CFG_OUT:
|
|
|
+ dim_ch = int(CFG["DMX-CH"])
|
|
|
+ dim = dataA[dim_ch-1]
|
|
|
+ _GRID_DIM(dim,x=CFG["x1"],y=CFG["y2"]-p*8)
|
|
|
+ draw_output_label(CFG,dim,dim_ch,name=CFG["name"])
|
|
|
|
|
|
-def GRID_A2_DIM():
|
|
|
- # GRID_A2 DIM
|
|
|
- if options.grid_a2_idim:
|
|
|
- CFG=CFG_OUT2
|
|
|
- grid_dim_ch = int(options.grid_a2_idim)
|
|
|
- grid_dim_v = dataA[grid_dim_ch-1]
|
|
|
- dim=255
|
|
|
- try:
|
|
|
- dim = int(grid_dim_v)
|
|
|
- if dim > 255:
|
|
|
- dim = 255
|
|
|
- if dim <=0:
|
|
|
- dim = 0
|
|
|
- except:pass
|
|
|
- dim_raw = dim*-1
|
|
|
- s = pygame.Surface((p*8,p*8)) # the size of your rect
|
|
|
- s.set_alpha(dim) # alpha level
|
|
|
- s.fill((0,0,0)) # this fills the entire surface
|
|
|
- window.blit(s, (CFG["x1"],CFG["y2"]-p*8))
|
|
|
- a=options.grid_a2_idim
|
|
|
- draw_output_label(CFG,dim_raw,a,name="GRID_A2_DIM")
|
|
|
|
|
|
def cvImageToSurface(cvImage):
|
|
|
if cvImage.dtype.name == 'uint16':
|
|
|
@@ -2869,10 +2576,7 @@ def img_rescale(img, percent=75):
|
|
|
dim = (width, height)
|
|
|
return cv2.resize(frame, dim, interpolation =cv2.INTER_LINEAR)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
def img_draw_raw(img_meta):
|
|
|
-
|
|
|
#img_jitter(img_meta)
|
|
|
|
|
|
pos = img_meta["pos"]
|
|
|
@@ -2891,11 +2595,7 @@ def img_draw_raw(img_meta):
|
|
|
window.blit(im2, (x-w2,y-h2))
|
|
|
|
|
|
img_meta_a = create_img_meta()
|
|
|
-img_open(img_meta_a)
|
|
|
|
|
|
-t1 = Timer(143)
|
|
|
-time.sleep(0.33)
|
|
|
-t2 = Timer(11)
|
|
|
|
|
|
count_tilt = 0
|
|
|
def main():
|
|
|
@@ -2912,6 +2612,7 @@ def main():
|
|
|
global dataA
|
|
|
global frame2
|
|
|
global runnung
|
|
|
+
|
|
|
reload_grid()
|
|
|
|
|
|
s=time.time()
|
|
|
@@ -2930,15 +2631,12 @@ def main():
|
|
|
|
|
|
pygame.display.flip()
|
|
|
set_pos(GRID,_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
- #set_pos(GRID,600,600)#_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
|
|
|
event()
|
|
|
|
|
|
window.fill((10,0,30))
|
|
|
calc_fps()
|
|
|
calc_fps2()
|
|
|
- #draw_overlay()
|
|
|
-
|
|
|
|
|
|
# GRID loop
|
|
|
try:
|
|
|
@@ -2947,28 +2645,20 @@ def main():
|
|
|
except Exception as e:
|
|
|
print("EXC FUNC",e)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- #if int(time.time()) % 2: # BLINK
|
|
|
- #set_gobo_pos(GRID,_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
-
|
|
|
draw_gobo(GRID,data) #,_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
- #if int(time.time()) % 2: # BLINK
|
|
|
grid_label(GRID,_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
- #grid_sub_label(GRID) #,_x=CFG_IN["x1"],_y=CFG_IN["y1"])
|
|
|
-
|
|
|
|
|
|
if VIDEO:
|
|
|
draw_all_video(VIDEO)
|
|
|
- #draw_all_video_overlay(VIDEO)
|
|
|
- #img_draw(img_meta_a)
|
|
|
|
|
|
if options.countdown:
|
|
|
draw_counter(COUNTER)
|
|
|
|
|
|
# output background mask
|
|
|
- pygame.draw.rect(window,[0,0,0],[35,57,MAIN_SIZE[0]+200-35,135]) # background
|
|
|
- #pygame.draw.rect(window,[5,5,5],[0,60,MAIN_SIZE[0],p*9]) # background
|
|
|
+ _w = 8*16
|
|
|
+ if len(out_idim):
|
|
|
+ _w = len(out_idim)*8*16
|
|
|
+ pygame.draw.rect(window,[0,0,0],[35,57,_w+16,135]) # background
|
|
|
pointer.draw(0,pm_wy) #wy
|
|
|
|
|
|
|
|
|
@@ -2978,33 +2668,27 @@ def main():
|
|
|
if options.dual_vpu:
|
|
|
GRID_X = GRID_A[8*8:]
|
|
|
xx = p*8
|
|
|
- #reshape(GRID,GRID_X,CFG_OUT2["x1"],CFG_OUT2["y1"]-p*8,name="GRID_A2") #start pos
|
|
|
- #except Exception as e:
|
|
|
- # print("Exception 23123",e)
|
|
|
|
|
|
- reshape2(GRID,GRID_A,CFG_OUT["x1"],CFG_OUT["y1"],name="GRID_A1") #start pos
|
|
|
- #reshape(GRID,GRID_A,CFG_OUT["x1"],CFG_OUT["y1"],name="GRID_A1") #start pos
|
|
|
- else:
|
|
|
- pass #reshape(GRID,GRID_A,spos[0]+spos[2]+20,10) #start pos
|
|
|
+ reshape2(GRID,GRID_A,CFG_OUT[0]["x1"],CFG_OUT[0]["y1"],name="GRID_A1") #start pos
|
|
|
+
|
|
|
|
|
|
- frame_area()
|
|
|
+ out_frame()
|
|
|
|
|
|
# OUTPUT -> MAPING
|
|
|
draw_kachel_nr()
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
input_mask() # mask background
|
|
|
output_mask() # mask background
|
|
|
|
|
|
- GRID_A1_DIM() # overlay
|
|
|
- GRID_A2_DIM() # overlay
|
|
|
+ GRID_DIM() # overlay
|
|
|
|
|
|
if VIDEO:
|
|
|
draw_all_video_overlay(VIDEO)
|
|
|
|
|
|
draw_main_overlay()
|
|
|
+ draw_marker()
|
|
|
+
|
|
|
pointer.draw(0,pm_wy) #wy
|
|
|
pygame.display.flip()
|
|
|
clock.tick(25)
|