Upload files to 'studio'
This commit is contained in:
parent
5b81b675d2
commit
b8d4ae74d6
5 changed files with 695 additions and 61 deletions
|
@ -8,6 +8,7 @@ from studio import checklist
|
|||
from studio import story
|
||||
#import checklist
|
||||
#import story
|
||||
from settings import settings
|
||||
|
||||
def get_legacy(project_location):
|
||||
|
||||
|
@ -41,6 +42,15 @@ def get_legacy(project_location):
|
|||
"dates" : {} # Per date, detailed data about the project
|
||||
}
|
||||
|
||||
# For the future we will have to use some kind of network system. Where
|
||||
# different people contribute to one project. For example director, writer,
|
||||
# animator. For this I want to introduce a USERNAME thing. I will add them
|
||||
# later to tasks and schedulings.
|
||||
|
||||
Username = settings.read("Username")
|
||||
if not Username:
|
||||
Username = "Blender-Organizer User"
|
||||
|
||||
# Okay let's get the name, director and status from the old file. Funny that
|
||||
# it still survived from so far back. In the Organizer 1.0 you had to manually
|
||||
# type in the number of assets that had to be done in each category.
|
||||
|
@ -348,7 +358,8 @@ def get_legacy(project_location):
|
|||
"00:00:00",
|
||||
"schedule",
|
||||
fn,
|
||||
t
|
||||
t,
|
||||
Username
|
||||
])
|
||||
|
||||
# Okay I don't really know what exactly did I just do. But it's seems like
|
||||
|
@ -525,7 +536,8 @@ def get_legacy(project_location):
|
|||
"00:00:00",
|
||||
"schedule",
|
||||
fn,
|
||||
missingtask
|
||||
missingtask,
|
||||
Username
|
||||
])
|
||||
|
||||
# Or else it's a checklist whether been checked or unchecked
|
||||
|
@ -533,10 +545,10 @@ def get_legacy(project_location):
|
|||
else:
|
||||
if "[V]" in done:
|
||||
done = done.replace(" [V]", "").split("=:>")
|
||||
check = True
|
||||
check = "[Checked]"
|
||||
else:
|
||||
done = done.replace(" [ ]", "").split("=:>")
|
||||
check = False
|
||||
check = "[Un-Checked]"
|
||||
|
||||
# Putting the thing into the data
|
||||
|
||||
|
@ -553,13 +565,13 @@ def get_legacy(project_location):
|
|||
time,
|
||||
"history",
|
||||
fn,
|
||||
"[Checklist]",
|
||||
[
|
||||
done,
|
||||
check
|
||||
]
|
||||
check,
|
||||
done,
|
||||
Username
|
||||
])
|
||||
|
||||
|
||||
#print(data["dates"][date][ty][url])
|
||||
|
||||
# Now let's add all the others.
|
||||
|
||||
else:
|
||||
|
@ -576,15 +588,23 @@ def get_legacy(project_location):
|
|||
time,
|
||||
"history",
|
||||
fn,
|
||||
done
|
||||
done,
|
||||
Username
|
||||
])
|
||||
|
||||
#print(ty, url, fn, done)
|
||||
|
||||
|
||||
|
||||
#for i in sorted(data["dates"]):
|
||||
# print(i)
|
||||
# print()
|
||||
# print(data["dates"][i])
|
||||
# print()
|
||||
# print()
|
||||
|
||||
data_save(data)
|
||||
#data_save(data)
|
||||
|
||||
return data
|
||||
|
||||
def data_save(data):
|
||||
|
@ -632,13 +652,13 @@ def data_save(data):
|
|||
lines.append("")
|
||||
|
||||
for date in sorted(data["dates"]):
|
||||
lines.append(" "+date)
|
||||
lines.append(" date: "+date)
|
||||
|
||||
date = data["dates"][date]
|
||||
|
||||
if "fractions" in date:
|
||||
lines.append("")
|
||||
lines.append(" Actuall : "+str(date["fractions"]["project"]*100)+"%")
|
||||
lines.append(" Fraction : "+str(date["fractions"]["project"]*100)+"%")
|
||||
lines.append("")
|
||||
lines.append(" Characters: "+str(date["fractions"]["chr"]*100)+"%")
|
||||
lines.append(" Vehicles : "+str(date["fractions"]["veh"]*100)+"%")
|
||||
|
@ -650,41 +670,44 @@ def data_save(data):
|
|||
if thing in date:
|
||||
|
||||
lines.append("")
|
||||
lines.append(" ---- "+thing+" :")
|
||||
lines.append(" type: "+thing+" :")
|
||||
|
||||
for asset in sorted( date[thing] ):
|
||||
lines.append(" ---- "+asset+" : ")
|
||||
lines.append(" link: "+asset+" : ")
|
||||
lines.append("")
|
||||
for task in date[thing][asset]:
|
||||
for task in sorted(date[thing][asset]):
|
||||
|
||||
|
||||
if task[1] == "schedule":
|
||||
lines.append(" "+task[0]+" "+task[1])
|
||||
lines.append(" "+task[2])
|
||||
lines.append(" at: "+task[0])
|
||||
lines.append(" action: "+task[1])
|
||||
lines.append("")
|
||||
lines.append(" "+task[2])
|
||||
spaces = " "
|
||||
for directory in task[3]:
|
||||
spaces = spaces + ":..."
|
||||
lines.append(spaces+directory)
|
||||
|
||||
elif task[3] == "[Checklist]":
|
||||
lines.append(" "+task[0]+" "+task[1]+" "+task[3])
|
||||
lines.append(" "+task[2])
|
||||
elif task[3] in ["[Un-Checked]", "[Checked]"]:
|
||||
|
||||
lines.append(" at: "+task[0])
|
||||
lines.append(" action: "+task[1]+" "+task[3])
|
||||
lines.append("")
|
||||
spaces = " "
|
||||
okay = " [Un-Checked]"
|
||||
if task[4][1]:
|
||||
okay = " [Checked]"
|
||||
for directory in task[4][0]:
|
||||
spaces = spaces + ":..."
|
||||
add_okay = ""
|
||||
if directory == task[4][0][-1]:
|
||||
add_okay = okay
|
||||
lines.append(spaces+directory+add_okay)
|
||||
|
||||
else:
|
||||
lines.append(" "+task[0]+" "+task[1]+" "+task[3])
|
||||
lines.append(" "+task[2])
|
||||
spaces = " "
|
||||
for directory in task[4]:
|
||||
spaces = spaces + ":..."
|
||||
lines.append(spaces+directory)
|
||||
|
||||
else:
|
||||
lines.append(" at: "+task[0])
|
||||
lines.append(" action: "+task[1]+" "+task[3])
|
||||
lines.append(" "+task[2])
|
||||
|
||||
# Username
|
||||
|
||||
lines.append("")
|
||||
lines.append(" user: "+task[-1])
|
||||
|
||||
lines.append("")
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ def get_legacy(project_location):
|
|||
data = {
|
||||
"fraction": 0.0, # Percentage of the Scenes finished.
|
||||
"camera" : [0,0], # The position of where the user left
|
||||
"selected": [], # List of selected items in the story editor
|
||||
"active": None, # Active item.
|
||||
"scenes" : {}, # List of scenes.
|
||||
"arrows" : [], # List of connections. (A LIST. NOT DICT.)
|
||||
"links" : [], # List of links to files or assets.
|
||||
|
@ -46,6 +48,8 @@ def get_legacy(project_location):
|
|||
bos = open(project_location+"/pln/main.bos")
|
||||
bos = bos.read()
|
||||
|
||||
cx, cy = 1, 1
|
||||
|
||||
if "</camera>" in bos:
|
||||
camera = bos[bos.find("<camera>")+8:]
|
||||
camera = camera[:camera.find("</camera>")]
|
||||
|
@ -57,6 +61,13 @@ def get_legacy(project_location):
|
|||
except:
|
||||
camera[num] = 0.0
|
||||
|
||||
try:
|
||||
cx = float(camera[2])
|
||||
cy = float(camera[3])
|
||||
except:
|
||||
pass
|
||||
print (cy, cx)
|
||||
|
||||
# Some stupid me made decision early in a story editor's life to use
|
||||
# per-pixel X coordinates and per line Y coordinates. Which is something
|
||||
# like 100 times the difference. Okay 50 ish is a default value for Y.
|
||||
|
@ -93,8 +104,8 @@ def get_legacy(project_location):
|
|||
c = event[event.find('[')+1:event.find(']')]
|
||||
c = c.split(",")
|
||||
|
||||
eventpositon = [float(c[0]),float(c[2])]
|
||||
eventsize = [float(c[1]),30.0]
|
||||
eventpositon = [float(c[0])*cx,float(c[2])*cy]
|
||||
eventsize = [float(c[1])*cx,60.0]
|
||||
|
||||
# Now since we know the name of the event and the sizes. We can
|
||||
# start parsing the scenes from the text with in the event.
|
||||
|
@ -128,28 +139,37 @@ def get_legacy(project_location):
|
|||
# If there are more then 1 scene per event. We want to create
|
||||
# an event, frame thing for them.
|
||||
|
||||
aos = eventtext.count("<scene>")
|
||||
|
||||
parent = "" #This will be it's name
|
||||
|
||||
if eventtext.count("<scene>") > 1:
|
||||
if aos > 1:
|
||||
parent = eventname
|
||||
|
||||
data["events"][eventname] = {
|
||||
"position":eventpositon
|
||||
"position":eventpositon,
|
||||
"size":[0,0]
|
||||
}
|
||||
|
||||
# Now let's continue parsing the scenes.
|
||||
|
||||
for scene in eventtext.split("</scene>")[:-1]:
|
||||
for num, scene in enumerate(eventtext.split("</scene>")[:-1]):
|
||||
|
||||
scenename = scene[scene.find('"')+1:scene.replace('"'," ",1).find('"')]
|
||||
scenename = scenename.replace(" ", "_")
|
||||
scenetext = scene[scene.replace('"', " ", 1).find('"')+1:-1]
|
||||
|
||||
|
||||
scenesize = [eventsize[0] / aos , eventsize[1]]
|
||||
sceneposition = [eventpositon[0] + scenesize[0]*num,
|
||||
eventpositon[1]]
|
||||
|
||||
|
||||
data["scenes"][scenename] = {
|
||||
"fraction":0.0, # Percentage
|
||||
"position":eventpositon,
|
||||
"size":eventsize,
|
||||
"parent":"", # For when it's in a Frame (Event)
|
||||
"position":sceneposition,
|
||||
"size":scenesize,
|
||||
"parent":parent, # For when it's in a Frame (Event)
|
||||
"shots":[[
|
||||
"text_block",[["text", scenetext]]
|
||||
]]
|
||||
|
@ -487,12 +507,12 @@ def get_legacy(project_location):
|
|||
link = stuff[3][1:-1]
|
||||
coordinates = []
|
||||
try:
|
||||
coordinates.append(float(stuff[0].replace("<image>", "")))
|
||||
coordinates.append(float(stuff[0].replace("<image>", ""))*cx)
|
||||
except:
|
||||
coordinates.append(0.0)
|
||||
|
||||
try:
|
||||
coordinates.append(float(stuff[1]))
|
||||
coordinates.append(float(stuff[1])*cy)
|
||||
except:
|
||||
coordinates.append(0.0)
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ def run(win):
|
|||
win.url = "story_editor"
|
||||
win.update = {"versions":{}}
|
||||
win.project = project
|
||||
win.out_dots = {}
|
||||
|
||||
|
||||
if pm_project.is_legacy(project):
|
||||
win.story = story.get_legacy(project)
|
||||
|
@ -102,6 +104,7 @@ def run(win):
|
|||
win.current["key_letter"] = ""
|
||||
win.current["scroll"] = [0,0]
|
||||
win.current["project"] = ""
|
||||
win.current["tool"] = "selection"
|
||||
|
||||
previous(win)
|
||||
|
||||
|
|
476
studio/studio_nodes.py
Normal file
476
studio/studio_nodes.py
Normal file
|
@ -0,0 +1,476 @@
|
|||
# THIS FILE IS A PART OF VCStudio
|
||||
# PYTHON 3
|
||||
|
||||
import os
|
||||
import datetime
|
||||
|
||||
# GTK module ( Graphical interface
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk
|
||||
import cairo
|
||||
|
||||
# Own modules
|
||||
from settings import settings
|
||||
from settings import talk
|
||||
|
||||
# UI modules
|
||||
from UI import UI_testing
|
||||
from UI import UI_color
|
||||
from UI import UI_elements
|
||||
from UI import UI_math
|
||||
|
||||
def node_dot(layer, win, x, y, direction="in", entry="end"):
|
||||
|
||||
# This function will draw a dot to which various nodes are connected. And
|
||||
# from which connections going off.
|
||||
|
||||
# This is a very alpha version of the dot thing
|
||||
|
||||
UI_color.set(layer, win, "progress_background")
|
||||
UI_elements.roundrect(layer, win,
|
||||
x,
|
||||
y,
|
||||
0,
|
||||
0,
|
||||
6)
|
||||
|
||||
raw_entry = entry
|
||||
|
||||
if type(entry) == list:
|
||||
entry = entry[0]+":"+entry[1]
|
||||
|
||||
if direction != "in":
|
||||
win.out_dots[entry] = [x+6, y+6]
|
||||
else:
|
||||
for arrow in win.story["arrows"]:
|
||||
if raw_entry == arrow[1]:
|
||||
|
||||
fr = arrow[0]
|
||||
if type(fr) == list:
|
||||
fr = fr[0]+":"+fr[1]
|
||||
|
||||
try:
|
||||
UI_color.set(layer, win, "progress_background")
|
||||
layer.move_to(
|
||||
win.out_dots[fr][0],
|
||||
win.out_dots[fr][1]
|
||||
)
|
||||
layer.line_to(x+6, y+6)
|
||||
layer.stroke()
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
def start_node(outlayer, win, x, y, width, height):
|
||||
|
||||
# This function will draw a start node in the top left corner of the story
|
||||
# editor. This is where the story begins.
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
# top banner
|
||||
|
||||
UI_color.set(layer, win, "node_badfile")
|
||||
layer.rectangle(0,0,width, 20)
|
||||
layer.fill()
|
||||
|
||||
# Text saying START
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(width/2-len(talk.text("Start"))*9/2,15)
|
||||
layer.show_text(talk.text("Start"))
|
||||
|
||||
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
||||
# Dot
|
||||
node_dot(outlayer, win, x+width-7, y+height-12, direction="out", entry="start")
|
||||
|
||||
|
||||
def end_node(outlayer, win, x, y, width, height):
|
||||
|
||||
# This function will draw a end node in the bottom right corner of the story
|
||||
# editor. This is where the story ends.
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
# top banner
|
||||
|
||||
UI_color.set(layer, win, "node_badfile")
|
||||
layer.rectangle(0,0,width, 20)
|
||||
layer.fill()
|
||||
|
||||
# Text saying END
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(width/2-len(talk.text("End"))*9/2,15)
|
||||
layer.show_text(talk.text("End"))
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
||||
# Dot
|
||||
node_dot(outlayer, win, x-2, y+height-12)
|
||||
|
||||
|
||||
def scene_node(outlayer, win, x, y, width, height, name="Unknown", fraction=0.0):
|
||||
|
||||
# This function will draw scene nodes.
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
entry = ['scene', name]
|
||||
|
||||
selected = False
|
||||
if win.url == "story_editor":
|
||||
|
||||
if win.current["LMB"] and entry in win.story["selected"]:
|
||||
if int(win.current["LMB"][0]) in range(int(x), int(x+width))\
|
||||
and int(win.current["LMB"][1]) in range(int(y), int(y+height)):
|
||||
win.current["tool"] = "grab"
|
||||
win.story["active"] = entry
|
||||
|
||||
#else:
|
||||
# win.current["tool"] = "selection"
|
||||
|
||||
if win.current["LMB"] and win.current["tool"] == "selection":
|
||||
|
||||
# If mouse over. But way more complex. Because we might select more then
|
||||
# 1 scene at ones.
|
||||
|
||||
mx = win.current["mx"]
|
||||
my = win.current["my"]
|
||||
pmx = win.current["LMB"][0]
|
||||
pmy = win.current["LMB"][1]
|
||||
|
||||
intersect = UI_math.rectangle_overlap(
|
||||
[mx, my, pmx-mx, pmy-my],
|
||||
[x,y,width, height])
|
||||
|
||||
# Now let's make a higlight
|
||||
if intersect:
|
||||
selected = True
|
||||
|
||||
elif win.previous["LMB"] and win.previous["tool"] == "selection":
|
||||
|
||||
# If you released the mouse while selecting. Then do selecting. I guess.
|
||||
mx = win.previous["mx"]
|
||||
my = win.previous["my"]
|
||||
pmx = win.previous["LMB"][0]
|
||||
pmy = win.previous["LMB"][1]
|
||||
|
||||
intersect = UI_math.rectangle_overlap(
|
||||
[mx, my, pmx-mx, pmy-my],
|
||||
[x,y,width, height])
|
||||
|
||||
# Now let's make a selection
|
||||
if intersect:
|
||||
win.story["selected"].append(entry)
|
||||
|
||||
if win.story["active"] not in win.story["selected"]:
|
||||
win.story["active"] = entry
|
||||
|
||||
if entry in win.story["selected"]:
|
||||
selected = True
|
||||
|
||||
if selected:
|
||||
|
||||
|
||||
if win.current["tool"] == "grab":
|
||||
try:
|
||||
if win.current["LMB"]:
|
||||
x += win.current["mx"] - win.current["LMB"][0]
|
||||
y += win.current["my"] - win.current["LMB"][1]
|
||||
|
||||
|
||||
elif win.previous["LMB"]:
|
||||
win.story["scenes"][name]["position"][0]\
|
||||
+= win.previous["mx"] - win.previous["LMB"][0]
|
||||
win.story["scenes"][name]["position"][1]\
|
||||
+= win.previous["my"] - win.previous["LMB"][1]
|
||||
|
||||
x += win.previous["mx"] - win.previous["LMB"][0]
|
||||
y += win.previous["my"] - win.previous["LMB"][1]
|
||||
|
||||
|
||||
# In case there is a parent event in the scene.
|
||||
|
||||
if win.story["scenes"][name]["parent"]:
|
||||
|
||||
|
||||
parent = win.story["scenes"][name]["parent"]
|
||||
win.story["events"][parent]["position"] = [x, y]
|
||||
win.story["events"][parent]["size"] = [0, 0]
|
||||
|
||||
else:
|
||||
win.current["tool"] = "selection"
|
||||
|
||||
|
||||
except:
|
||||
raise()
|
||||
|
||||
# The selected outline
|
||||
|
||||
UI_color.set(outlayer, win, "progress_background")
|
||||
|
||||
if win.story["active"] == entry:
|
||||
UI_color.set(outlayer, win, "text_normal")
|
||||
outlayer.set_line_width(4)
|
||||
UI_elements.roundrect(outlayer, win,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
outlayer.stroke()
|
||||
outlayer.set_line_width(2)
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
# top banner
|
||||
|
||||
UI_color.set(layer, win, "node_blendfile")
|
||||
layer.rectangle(0,0,width, 20)
|
||||
layer.fill()
|
||||
|
||||
# Text saying The name of the scene
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(15,15)
|
||||
layer.show_text(name)
|
||||
|
||||
# Fraction
|
||||
UI_color.set(layer, win, "progress_background")
|
||||
UI_elements.roundrect(layer, win,
|
||||
10,
|
||||
height-20,
|
||||
width-20,
|
||||
0,
|
||||
5)
|
||||
|
||||
UI_color.set(layer, win, "progress_active")
|
||||
UI_elements.roundrect(layer, win,
|
||||
10,
|
||||
height-20,
|
||||
(width-20)*fraction,
|
||||
0,
|
||||
5)
|
||||
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
||||
|
||||
# Dots
|
||||
node_dot(outlayer, win, x-5, y+25, entry=entry)
|
||||
node_dot(outlayer, win, x+width-7, y+25, direction="out",entry=entry)
|
||||
|
||||
def event_node(outlayer, win, x, y, width, height, name="Unknown"):
|
||||
|
||||
# This function draws events.
|
||||
|
||||
x = x - 20
|
||||
y = y - 20
|
||||
width = width + 40
|
||||
height = height + 40
|
||||
|
||||
entry = ['event', name]
|
||||
|
||||
|
||||
# Making sure the size is alright
|
||||
if width < 100:
|
||||
width = 100
|
||||
if height < 100:
|
||||
height = 100
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
|
||||
|
||||
# Text saying The name of the event
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(15,15)
|
||||
layer.show_text(name)
|
||||
|
||||
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
||||
def file_node(outlayer, win, x, y, width=150, height=150, name=""):
|
||||
|
||||
# This node will output links to files.
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
if os.path.exists(win.project+"/"+name):
|
||||
UI_elements.image(layer, win,
|
||||
win.project+"/"+name,
|
||||
0, 0, width, height)
|
||||
|
||||
else:
|
||||
UI_elements.image(layer, win,
|
||||
name,
|
||||
0, 0, width, height)
|
||||
|
||||
# top banner
|
||||
|
||||
UI_color.set(layer, win, "progress_active")
|
||||
layer.rectangle(0,0,width, 20)
|
||||
layer.fill()
|
||||
|
||||
# Text saying The name of the event
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(15,15)
|
||||
layer.show_text(name)
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
||||
def asset_node(outlayer, win, x, y, width=150, height=150, name=""):
|
||||
|
||||
# This node will output links to files.
|
||||
|
||||
# Making the layer
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
|
||||
layer = cairo.Context(surface)
|
||||
|
||||
|
||||
# Clip
|
||||
UI_elements.roundrect(layer, win,
|
||||
0,
|
||||
0,
|
||||
width,
|
||||
height,
|
||||
10,
|
||||
fill=False)
|
||||
layer.clip()
|
||||
|
||||
# Background
|
||||
UI_color.set(layer, win, "dark_overdrop")
|
||||
layer.rectangle(0,0,width, height)
|
||||
layer.fill()
|
||||
|
||||
if os.path.exists(win.project+"/dev"+name+"/renders/Preview.png"):
|
||||
UI_elements.image(layer, win,
|
||||
win.project+"/dev"+name+"/renders/Preview.png",
|
||||
0, 0, width, height)
|
||||
else:
|
||||
UI_elements.image(layer, win,
|
||||
win.project+"/dev"+name+"/renders/Preview.jpg",
|
||||
0, 0, width, height)
|
||||
|
||||
# top banner
|
||||
|
||||
UI_color.set(layer, win, "progress_time")
|
||||
layer.rectangle(0,0,width, 20)
|
||||
layer.fill()
|
||||
|
||||
# Text saying The name of the event
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(15)
|
||||
layer.move_to(15,15)
|
||||
layer.show_text(name)
|
||||
|
||||
# Outputting the layer
|
||||
outlayer.set_source_surface(surface, x, y)
|
||||
outlayer.paint()
|
||||
|
|
@ -17,6 +17,7 @@ from settings import talk
|
|||
from project_manager import pm_project
|
||||
|
||||
from studio import analytics
|
||||
from studio import studio_nodes
|
||||
|
||||
#UI modules
|
||||
from UI import UI_elements
|
||||
|
@ -384,27 +385,138 @@ def layer(win):
|
|||
layer.fill()
|
||||
|
||||
|
||||
# Setting up scroll for Projects
|
||||
if "pm_scroll" not in win.current:
|
||||
win.current["pm_scroll"] = 0.0
|
||||
# You probably intersted where is the scroll function for this part. Well
|
||||
# see there is a thing. It's easier to write one from screach here. Because
|
||||
# you geassed it we are starting to draw story editor.
|
||||
|
||||
# Setting up tilling
|
||||
tileY = 0
|
||||
tileX = 0
|
||||
# Let's prepare the camera first.
|
||||
|
||||
|
||||
UI_elements.scroll_area(layer, win, "pm_main",
|
||||
50,
|
||||
5,
|
||||
win.current["w"] - 55,
|
||||
win.current["h"] - 30,
|
||||
tileY+340,
|
||||
bar=True,
|
||||
mmb=True,
|
||||
url="project_manager"
|
||||
)
|
||||
if win.url == "story_editor":
|
||||
if win.current["MMB"]:
|
||||
win.story["camera"][0] += ( win.current["mx"]-win.previous["mx"])
|
||||
win.story["camera"][1] += ( win.current["my"]-win.previous["my"])
|
||||
|
||||
win.story["camera"][0] -= win.current["scroll"][0]*50
|
||||
win.story["camera"][1] -= win.current["scroll"][1]*50
|
||||
|
||||
cx, cy = win.story["camera"]
|
||||
|
||||
|
||||
# EVENTS (Frames)
|
||||
|
||||
for event in win.story["events"]:
|
||||
|
||||
# Loaction
|
||||
sx, sy = win.story["events"][event]["position"]
|
||||
|
||||
|
||||
sx = sx + cx
|
||||
sy = sy + cy
|
||||
|
||||
# Scale
|
||||
ssx, ssy = win.story["events"][event]["size"]
|
||||
|
||||
|
||||
#Draw
|
||||
studio_nodes.event_node(layer, win, sx, sy, ssx, ssy, name=event)
|
||||
|
||||
|
||||
# SCENES
|
||||
|
||||
for scene in win.story["scenes"]:
|
||||
|
||||
# Loaction
|
||||
sx, sy = win.story["scenes"][scene]["position"]
|
||||
sx = sx + cx
|
||||
sy = sy + cy
|
||||
|
||||
|
||||
# Scale
|
||||
ssx, ssy = win.story["scenes"][scene]["size"]
|
||||
|
||||
#Fraction
|
||||
sf = win.story["scenes"][scene]["fraction"]
|
||||
|
||||
|
||||
#Draw
|
||||
studio_nodes.scene_node(layer, win, sx, sy, ssx, ssy, name=scene, fraction=sf)
|
||||
|
||||
# Let's get events arround the scene. If it's inside the event.
|
||||
|
||||
if win.story["scenes"][scene]["parent"]:
|
||||
parent = win.story["scenes"][scene]["parent"]
|
||||
|
||||
|
||||
try:
|
||||
|
||||
# Don't touch these. It's a hard rigging thing.
|
||||
|
||||
if win.story["events"][parent]["position"][0] > sx - cx:
|
||||
win.story["events"][parent]["position"][0] = sx - cx
|
||||
|
||||
if win.story["events"][parent]["position"][1] > sy - cy:
|
||||
win.story["events"][parent]["position"][1] = sy - cy
|
||||
|
||||
if win.story["events"][parent]["size"][0]\
|
||||
+ win.story["events"][parent]["position"][0]+cx < ssx + sx:
|
||||
win.story["events"][parent]["size"][0] = ssx + sx\
|
||||
- win.story["events"][parent]["position"][0] - cx
|
||||
|
||||
if win.story["events"][parent]["size"][1]\
|
||||
+ win.story["events"][parent]["position"][1]+cy < ssy + sy:
|
||||
win.story["events"][parent]["size"][1] = ssy + sy\
|
||||
- win.story["events"][parent]["position"][1] - cy
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
# LINKS (Images, Stuff)
|
||||
|
||||
for num, link in enumerate(win.story["links"]):
|
||||
|
||||
linktype = link[0]
|
||||
linkname = link[1]
|
||||
lx = link[2][0] + cx
|
||||
ly = link[2][1] + cy
|
||||
|
||||
|
||||
if linktype == "file":
|
||||
|
||||
studio_nodes.file_node(layer, win, lx, ly, name=linkname)
|
||||
else:
|
||||
studio_nodes.asset_node(layer, win, lx, ly, name=linkname)
|
||||
|
||||
# In case there is a selection bug
|
||||
if not win.story["selected"]:
|
||||
win.current["tool"] = "selection"
|
||||
|
||||
# Selector visualization
|
||||
if win.current["LMB"] and win.current["tool"] == "selection" and win.url == "story_editor":
|
||||
|
||||
# Undo selection
|
||||
if int(win.current["LMB"][0] - win.current["mx"]) in range(-10, 10)\
|
||||
and int(win.current["LMB"][1] - win.current["my"])in range(-10, 10)\
|
||||
and 65505 not in win.current["keys"]:
|
||||
win.story["selected"] = []
|
||||
|
||||
# Draw selection box
|
||||
UI_color.set(layer, win, "progress_background")
|
||||
layer.rectangle(
|
||||
win.current["mx"],
|
||||
win.current["my"],
|
||||
win.current["LMB"][0] - win.current["mx"],
|
||||
win.current["LMB"][1] - win.current["my"]
|
||||
)
|
||||
layer.stroke()
|
||||
|
||||
# Let's put in the start and the end nodes. These are drawn on top of
|
||||
# everything.
|
||||
|
||||
studio_nodes.start_node(layer, win, 60,60,100,40)
|
||||
studio_nodes.end_node(layer, win, win.current["w"] - 160,
|
||||
win.current["h"] - 80,
|
||||
100,40)
|
||||
|
||||
return surface
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue