123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233 |
- # THIS FILE IS A PART OF VCStudio
- # PYTHON 3
- # This a console project manager.
- import os
- import threading
- # GTK module ( Graphical interface
- import gi
- gi.require_version('Gtk', '3.0')
- from gi.repository import Gtk
- from gi.repository import GLib
- from gi.repository import Gdk
- import cairo
- # Own modules
- from settings import settings
- from settings import talk
- from settings import fileformats
- from settings import oscalls
- from project_manager import pm_project
- #UI modules
- from UI import UI_elements
- from UI import UI_color
- # story
- from studio import story
- from studio import checklist
- from studio import analytics
- from studio import studio_dialogs
- from studio import schedule
- from studio import history
- from network import http_client
- def layer(win):
-
-
- # Making the layer
- surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
- win.current['h'])
- layer = cairo.Context(surface)
-
-
- #text setting
- layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
- UI_color.set(layer, win, "dark_overdrop")
- layer.rectangle(
- 0,
- 0,
- win.current["w"],
- win.current["h"],
- )
- layer.fill()
-
-
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- win.current["w"]/4,
- 150,
- win.current["w"]/2,
- win.current["h"]-190,
- 10)
-
- ############################################################################
-
- # This file will be showing stuff about an asset. It's almost like a folder
- # / folders of the asset. But with some extendet functionality. Stuff that
- # will be on screen will include.
-
- # Progress Bar
- # Checklist
- # Scenes list in which the asset is mentioned
- # History / Schedules
-
- # It's similar to the old Blender Organizer's Asset thing. But a bit more
- # modern looking. I would say.
-
- ############################################################################
-
-
- # before we start I want to make a little safe mechanism. Just in case the
- # win.cur is not written properly.
-
- # Parsing the cur to get name and type
- name = win.cur[win.cur.rfind("/")+1:]
- acur = win.cur.replace(name, "").replace("/", "")
-
- if not os.path.exists(win.project+"/dev/"+win.cur) or not win.cur:
-
- def select_character(win, var):
-
- if var:
- win.url = "assets"
- win.cur = var
- else:
- win.url = "story_editor"
-
- if not acur:
- acur = "chr"
- studio_dialogs.asset_select(win, "select_asset_check", select_character, force=True, cur=acur, SEARCH=name)
-
-
- if not "asset_cur_folder" in win.current:
- win.current["asset_cur_folder"] = "blender"
-
- ####### MIDDLE PANNEL #######
-
-
- def do():
- oscalls.Open(win.project+"/dev"+win.cur)
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+20,
- 350,
- 40,
- 40,
- 10,
- do,
- "folder")
-
- folds = {
- "blender":"blend_files_folder",
- "idea":"reference_folder",
- "texture":"tex_folder",
- "render":"renders_folder"
- }
-
- for num, cur in enumerate(folds):
-
- if win.current["asset_cur_folder"] == cur:
-
- UI_color.set(layer, win, "progress_time")
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+150+(40*num),
- 350,
- 40,
- 40,
- 10)
-
- def do():
- win.current["asset_cur_folder"] = cur
- # FUNCTIONS PER THINGS
-
- # # Why?
- # if win.current["asset_cur_folder"] == "idea":
- # fl = "reference"
- # elif win.current["asset_cur_folder"] == "texture":
- # fl = "tex"
- # elif win.current["asset_cur_folder"] == "render":
- # fl = "renders"
- # else:
- # fl = ""
- # # Remote Server Stuff
- # if win.analytics["from-remote-server"]:
- # def after(win, var):
- # UI_elements.reload_images(win)
- # studio_dialogs.http_client_dialog(win, "http-client", after, http_client.get_files, "/dev/"+win.cur+"/"+fl)
-
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+150+(40*num),
- 350,
- 40,
- 40,
- 10,
- do,
- cur,
- tip=talk.text(folds[cur]))
-
- # Little Remote Server thing
- if win.analytics["from-remote-server"]:
- if "remote-folder-data" not in win.current:
- win.current["remote-folder-data"] = {}
- if win.cur not in win.current["remote-folder-data"]:
- win.current["remote-folder-data"][win.cur] = {"missing":{},
- "changed":{}}
-
- def do():
- def after(win, var):
- UI_elements.reload_images(win)
- win.current["remote-folder-data"]["prompt"] = win.cur
- studio_dialogs.http_client_update_prompt(win, "http-client-prompt", after)
-
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+60,
- 350,
- 40,
- 40,
- 10,
- do,
- "download",
- tip=talk.text("RemoteAssetUpdates"))
-
- if win.current["remote-folder-data"][win.cur]["missing"] or win.current["remote-folder-data"][win.cur]["changed"]:
- count = str(len(win.current["remote-folder-data"][win.cur]["missing"])+len(win.current["remote-folder-data"][win.cur]["changed"]))
- UI_color.set(layer, win, "progress_active")
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+60+25,
- 350,
- len(count)*12+6,
- 25,
- 5)
- layer.fill()
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(win.current["w"]/4+60+28,370)
- layer.show_text(count)
-
- # Preview
-
- # Making the layer
- nodesurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 300, 300)
- node = cairo.Context(nodesurface)
- node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(node, win,
- 0,
- 0,
- 300,
- 300,
- 10,
- fill=False)
-
- node.clip()
-
- if os.path.exists(win.project+"/dev"+win.cur+"/renders/Preview.png"):
- UI_elements.image(node, win,
- win.project+"/dev"+win.cur+"/renders/Preview.png",
- 0, 0, 300, 300, cell="big_asset_previews")
- elif os.path.exists(win.project+"/dev"+win.cur+"/renders/Preview.jpg"):
- UI_elements.image(node, win,
- win.project+"/dev"+win.cur+"/renders/Preview.jpg",
- 0, 0, 300, 300, cell="big_asset_previews")
- else:
- UI_color.set(node, win, "dark_overdrop")
- node.rectangle(0,0,300, 300)
- node.fill()
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/"+acur+".png",
- 130, 130, 40, 40)
-
- def do():
- def after(win, var):
-
- win.current["asset_file_selected"] = ""
- win.images = {}
-
- if var:
- for t in fileformats.images:
- if var.endswith(t):
- oscalls.copy_file(
- win,
- var,
- "/dev"+win.cur+"/renders/",
- "Preview.png")
- break
-
- studio_dialogs.file_select(win, name+"_preview", after, force=True,
- IMAGE=True, BLEND=False, VIDEO=True, FILE=False, CHR=True, VEH=True,
- LOC=True, OBJ=True, RND=False, FOLDER=False, SEARCH=win.cur+" renders")
- UI_elements.roundrect(node, win,
- 2,
- 2,
- 296,
- 296,
- 10,
- button=do,
- fill=False,
- offset=[
- win.current["w"]/4+20,
- 20
- ]
- )
- node.stroke()
-
- # Outputting the layer
- layer.set_source_surface(nodesurface,
- win.current["w"]/4+20,
- 20)
- layer.paint()
-
- # Name of the asset
- UI_elements.image(layer, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/"+acur+".png",
- win.current["w"]/4+360, 210, 40, 40)
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(30)
- layer.move_to(win.current["w"]/4+410,240)
- layer.show_text(name)
-
- # Fraction
-
- fraction = story.get_asset_data(win, win.cur)["fraction"]
-
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+350,
- 270,
- (win.current["w"]/2-370),
- 0,
- 10)
-
- UI_color.set(layer, win, "progress_active")
- UI_elements.roundrect(layer, win,
- win.current["w"]/4+350,
- 270,
- (win.current["w"]/2-370)*fraction,
- 0,
- 10)
-
- # Before search. On the other side when you have done the asset there will
- # be a little configure icon. This is configuration for linking. Creating
- # the /ast/ blend.file and autolink.data file. So the linker could link
- # the files into the animation scene.
- #
- # See:
- # studio/studio_shot_linkLayer.py
- # studio/bpy_do_linking.py
- # studio/studio_asset_configureLayer.py
-
- def do():
-
- def after(win, var):
- print(var)
-
- studio_dialogs.asset_configure(win, "configuring_asset", after, win.cur)
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/4*3-60,
- 210,
- 40,
- 40,
- 10,
- button=do,
- icon="link_configure")
-
-
- # Search
-
- UI_elements.image(layer, win, "settings/themes/"\
- +win.settings["Theme"]+"/icons/search.png",
- win.current["w"]-280-win.current["w"]/4,
- 350,
- 40,
- 40)
-
- UI_elements.text(layer, win, "in_asset",
- win.current["w"]-240-win.current["w"]/4,
- 350,
- 220,
- 40)
-
- # FILES
-
- # In case the user made the folder manually.
- try:
- os.mkdir(win.project+"/dev/"+win.cur)
- except:
- pass
- try:
- os.mkdir(win.project+"/dev/"+win.cur+"/renders")
- os.mkdir(win.project+"/dev/"+win.cur+"/reference")
- os.mkdir(win.project+"/dev/"+win.cur+"/tex")
- except:
- pass
-
- # Now let's prepare the frame
-
- width = win.current["w"]/2- 40
- height = win.current["h"] - 500
-
- # Making the layer
- nodesurface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
- node = cairo.Context(nodesurface)
- node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
- UI_elements.roundrect(node, win,
- 0,
- 0,
- width,
- height,
- 10,
- fill=False)
-
- node.clip()
-
-
- # Now let's prepare the scrooler
-
- tileX = 20
- current_Y = 10
-
- if "assets" not in win.scroll:
- win.scroll["assets"] = 0
-
- ###########################
-
- # Let's get the list of the files first.
-
- files = []
- newcreate = win.text["in_asset"]["text"].replace("/","_").replace(" ", "_")\
- .replace('"',"_").replace("(","_").replace(")","_").replace("'","_")\
- .replace("[","_").replace("]","_").replace("{","_").replace("}","_")
-
- foundblend = True
- found_in = False
-
- if win.current["asset_cur_folder"] == "blender":
-
- foundblend = False
-
- # Let's see if an asset blend file exists.
- if os.path.exists(win.project+"/ast"+win.cur+".blend") and not newcreate:
- files.append(["/ast"+win.cur+".blend", "node_asset"])
- foundblend = True
- for f in sorted(os.listdir(win.project+"/dev"+win.cur)):
- if not os.path.isdir(win.project+"/dev"+win.cur+"/"+f):
-
- # This is for only the blend files. So let's filter the out of all
- # the noise. For all files there is a folder icon.
- if newcreate == f:
- found_in = True
-
- if newcreate and newcreate.lower() not in f.lower():
- continue
-
- if f.endswith(".blend"):
- files.append(["/dev"+win.cur+"/"+f, "node_blendfile"])
- foundblend = True
-
- else:
-
- # This all the rest of the files.
-
- if win.current["asset_cur_folder"] == "idea":
- fl = "reference"
- elif win.current["asset_cur_folder"] == "texture":
- fl = "tex"
- elif win.current["asset_cur_folder"] == "render":
- fl = "renders"
-
- for f in sorted(os.listdir(win.project+"/dev"+win.cur+"/"+fl)):
- if not os.path.isdir(win.project+"/dev"+win.cur+"/"+fl+"/"+f):
-
- if newcreate == f:
- found_in = True
-
- if newcreate and newcreate.lower() not in f.lower():
- continue
-
- # Now it has to be image or video files. For the rest you have
- # the folder icon.
-
- for t in fileformats.images:
- if f.endswith(t):
- files.append(["/dev"+win.cur+"/"+fl+"/"+f, "node_imagefile"])
-
- for t in fileformats.videos:
- if f.endswith(t):
- files.append(["/dev"+win.cur+"/"+fl+"/"+f, "node_videofile"])
-
-
- # Let's make sure that we have at least some blendfile there.
- if not foundblend and not newcreate:
- oscalls.copy_file(
- win,
- os.getcwd()+"/new_file/"+acur+".blend",
- "/dev"+win.cur+"/",
- name+".blend")
- # This is executed on the first frame when you click onto an asset.
-
- if win.current["in-asset-remote-server"]:
-
- # Let's also check for updates on the file
-
-
- # Remote Server Stuff
- if win.analytics["from-remote-server"]:
- # Checking date [ FOLDER NAME ] [ FILES TO CHECK FOR ]
- check_folders = {"/dev"+win.cur : "*",
- "/ast/"+acur : name+"*",
- "/dev"+win.cur+"/renders" : "*",
- "/dev"+win.cur+"/reference" : "*",
- "/dev"+win.cur+"/tex" : "*",
- }
-
- check_updates = threading.Thread(target=http_client.get_folder_info,
- args=(win, check_folders, win.cur, ))
- check_updates.setDaemon(True)
- check_updates.start()
-
-
- win.current["in-asset-remote-server"] = False
-
-
- if "asset_file_selected" not in win.current:
- win.current["asset_file_selected"] = ""
-
- for filename, thecoloris in files:
-
-
- if int(current_Y + win.scroll["assets"]) in range(0-200, height):
-
- # Making the layer
- node2surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 170, 200)
- node2 = cairo.Context(node2surface)
- node2.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(node2, win,
- 0,
- 0,
- 170,
- 200,
- 10,
- fill=False)
-
- node2.clip()
-
- # Background
- UI_color.set(node2, win, "dark_overdrop")
- node2.rectangle(0,0,170, 200)
- node2.fill()
-
- # Banner
- UI_color.set(node2, win, thecoloris)
- node2.rectangle(0,0,170, 20)
- node2.fill()
-
- # Outputting the layer
- node.set_source_surface(node2surface,
- tileX-10,
- current_Y + win.scroll["assets"] )
- node.paint()
-
- UI_elements.image(node, win, win.project+filename,
- tileX,
- current_Y + win.scroll["assets"] + 30,
- 150,
- 150)
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(12)
- node.move_to(tileX,
- current_Y + win.scroll["assets"]+15)
- node.show_text(filename[filename.rfind("/")+1:][:22])
-
- # If selected
- node.set_line_width(4)
- if win.current["asset_file_selected"] == win.project+filename:
- UI_color.set(node, win, "progress_background")
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- fill=False)
- node.stroke()
-
- # Button to activate it
- def do():
- if win.current["asset_file_selected"] != win.project+filename:
- win.current["asset_file_selected"] = win.project+filename
- else:
- oscalls.file_open(win, win.project+filename)
-
-
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- button=do,
- tip=filename,
- fill=False,
- clip=[
- win.current["w"]/4+20,
- 400,
- width,
- height,
- ],
- offset=[
- win.current["w"]/4+20,
- 400])
-
- node.stroke()
- node.set_line_width(2)
-
- tileX += 200
-
- if tileX > width-180:
- tileX = 20
- current_Y += 230
-
- ###########################
-
- # Now i'd like to make things addable. For now if it's a blends selected
- # there will an option to add new one and an option to copy. While other
- # files will have an option of only copy. (At least for now. Untill I
- # figure out what new images will it give.)
-
- if not found_in and newcreate:
-
- if win.current["asset_cur_folder"] == "blender"\
- and not newcreate.endswith(".blend"):
- newcreate = newcreate+".blend"
-
- def do():
- def after(win, var):
-
- newcreate = win.text["in_asset"]["text"].replace("/","_").replace(" ", "_")\
- .replace('"',"_").replace("(","_").replace(")","_").replace("'","_")\
- .replace("[","_").replace("]","_").replace("{","_").replace("}","_")
-
- win.text["in_asset"]["text"] = ""
- win.current["asset_file_selected"] = ""
- win.images = {}
-
- if var:
- if win.current["asset_cur_folder"] == "blender"\
- and var.endswith(".blend"):
-
- if not newcreate.endswith(".blend"):
- newcreate = newcreate+".blend"
-
- oscalls.copy_file(
- win,
- var,
- "/dev"+win.cur+"/",
- newcreate)
-
- else:
-
- # In case the copying file is not a blend file. Let's
- # make sure that it's infect an image.
-
- for t in fileformats.images:
- if var.endswith(t):
-
- if not newcreate.endswith(t):
- newcreate = newcreate + "." + t
-
- if win.current["asset_cur_folder"] == "idea":
- fl = "reference"
- elif win.current["asset_cur_folder"] == "texture":
- fl = "tex"
- elif win.current["asset_cur_folder"] == "render":
- fl = "renders"
-
- oscalls.copy_file(
- win,
- var,
- "/dev"+win.cur+"/"+fl+"/",
- newcreate)
-
- break
-
- if win.current["asset_cur_folder"] == "blender":
- studio_dialogs.file_select(win, name+"_blends", after, force=True,
- IMAGE=False, BLEND=True, VIDEO=False, FILE=False, CHR=True, VEH=True,
- LOC=True, OBJ=True, RND=False, FOLDER=False)
-
- elif win.current["asset_cur_folder"] == "idea":
- studio_dialogs.file_select(win, name+"_reference", after, force=True,
- IMAGE=True, BLEND=False, VIDEO=True, FILE=False, CHR=True, VEH=True,
- LOC=True, OBJ=True, RND=False, FOLDER=False, SEARCH="reference")
-
- elif win.current["asset_cur_folder"] == "texture":
- studio_dialogs.file_select(win, name+"_reference", after, force=True,
- IMAGE=True, BLEND=False, VIDEO=True, FILE=False, CHR=True, VEH=True,
- LOC=True, OBJ=True, RND=False, FOLDER=False, SEARCH="tex")
-
- elif win.current["asset_cur_folder"] == "render":
- studio_dialogs.file_select(win, name+"_reference", after, force=True,
- IMAGE=True, BLEND=False, VIDEO=True, FILE=False, CHR=True, VEH=True,
- LOC=True, OBJ=True, RND=False, FOLDER=False, SEARCH="renders")
-
-
-
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- button=do,
- tip=talk.text("copy_file_as")+" "+newcreate,
- clip=[
- win.current["w"]/4+20,
- 400,
- width,
- height,
- ],
- offset=[
- win.current["w"]/4+20,
- 400])
-
- UI_color.set(node, win, "progress_background")
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- fill=False)
- node.stroke()
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/copy_file.png",
- tileX+55,
- current_Y + win.scroll["assets"] + 70,
- 40, 40)
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(12)
- node.move_to(tileX+75-len(newcreate)*4,
- current_Y + win.scroll["assets"]+150)
- node.show_text(newcreate)
-
-
- tileX += 200
-
- if tileX > width-180:
- tileX = 20
- current_Y += 230
-
- if not found_in and newcreate and win.current["asset_cur_folder"] == "blender":
-
- if not newcreate.endswith(".blend"):
- newcreate = newcreate+".blend"
-
- def do():
-
- oscalls.copy_file(
- win,
- os.getcwd()+"/new_file/"+acur+".blend",
- "/dev"+win.cur+"/",
- newcreate)
-
- win.text["in_asset"]["text"] = ""
- win.current["asset_file_selected"] = ""
- win.images = {}
-
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- button=do,
- tip=talk.text("create_new_blend_file")+" "+newcreate,
- clip=[
- win.current["w"]/4+20,
- 400,
- width,
- height,
- ],
- offset=[
- win.current["w"]/4+20,
- 400])
-
- UI_color.set(node, win, "progress_background")
- UI_elements.roundrect(node, win,
- tileX-10,
- current_Y + win.scroll["assets"],
- 170,
- 200,
- 10,
- fill=False)
- node.stroke()
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/new_file.png",
- tileX+55,
- current_Y + win.scroll["assets"] + 70,
- 40, 40)
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(12)
- node.move_to(tileX+75-len(newcreate)*4,
- current_Y + win.scroll["assets"]+150)
- node.show_text(newcreate)
-
-
- current_Y += 230
-
- UI_elements.scroll_area(layer, win, "assets",
- win.current["w"]/4+20,
- 400,
- width,
- height,
- current_Y,
- bar=True,
- mmb=True,
- url="assets")
-
- # Outputting the layer
- layer.set_source_surface(nodesurface,
- win.current["w"]/4+20,
- 400)
- layer.paint()
-
-
- ############## CHECKLIST ################
-
- if os.path.exists(win.project+"/dev/"+win.cur+"/asset.progress"):
- checklist.draw(layer, win, win.project+"/dev/"+win.cur+"/asset.progress", back=win.url)
- else:
-
- # If asset.progress does not exist in the folder it will try to create.
- # one. The only problem with now is language support. I have some ideas
- # I will need to work on it. But later.
-
- oscalls.copy_file(
- win,
- os.getcwd()+"/new_file/"+acur+".progress",
- "/dev"+win.cur+"/",
- "asset.progress")
-
- ############## LEFT PANEL ################
-
- # Here on the left panel I want to have 3 things. Which is already more then
- # the legacy organizer. But who are we deceiving? This is way cooler then
- # the legacy organizer.
-
- leftpanellist = ["scene", "schedule", "history"] # Using the names of the icons.
-
- # We need to choose the correct category based smartly on the project's
- # current progress. Or at least on the current progress of this asset.
-
- if "asset_left_panel" not in win.current:
- if fraction == 1.0: # If the asset is done
- win.current["asset_left_panel"] = "scene" # Then list scenes
- else: # Other
- win.current["asset_left_panel"] = "schedule" # List schedules
-
-
- # A little banner.
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- 10,
- 10,
- win.current["w"]/4-20,
- 50,
- 10)
-
- for num, thing in enumerate(leftpanellist):
- if win.current["asset_left_panel"] == thing:
-
- UI_color.set(layer, win, "progress_time")
- UI_elements.roundrect(layer, win,
- 20+(40*num),
- 15,
- 40,
- 40,
- 10)
-
- def do():
- win.current["asset_left_panel"] = thing
-
- UI_elements.roundrect(layer, win,
- 20+(40*num),
- 15,
- 40,
- 40,
- 10,
- do,
- thing)
-
- ### SCHEDULES ###
-
- if win.current["asset_left_panel"] == "schedule":
- schedule.draw(layer, win)
-
- ### HISTORY ###
-
- if win.current["asset_left_panel"] == "history":
- history.draw(layer, win)
-
-
-
-
- ### SCENES ###
-
- # Documentation entry
- def do():
- def after(win, var):
- pass
-
- studio_dialogs.help(win, "help", after, SEARCH=talk.text("documentation_assets"))
-
- UI_elements.roundrect(layer, win,
- win.current["w"]-40-win.current["w"]/4-50,
- win.current["h"]-80,
- 40,
- 40,
- 10,
- do,
- "question")
-
- # CANCEl
-
- def do():
- win.url = "story_editor"
- win.assets = {}
- win.current["asset_file_selected"] = ""
-
- UI_elements.roundrect(layer, win,
- win.current["w"]-40-win.current["w"]/4,
- win.current["h"]-80,
- 40,
- 40,
- 10,
- button=do,
- icon="cancel",
- tip=talk.text("cancel"))
-
- # Short cut ESC
- if 65307 in win.current["keys"] and not win.textactive:
- do()
-
- if win.current["asset_left_panel"] == "scene":
-
- # Here I want to parse the story data in pusuit of all the scenes that
- # have the asset. I think I'm going to make it per shot based. Like
- # you have the scenes. And you can open them to enter shots. Maybe with
- # a tiny exserp from the story.
-
- if "asset_scenes" not in win.scroll:
- win.scroll["asset_scenes"] = 0
-
- if "asset_scene_selected" not in win.current:
- win.current["asset_scene_selected"] = False
-
- x = 10
- y = 70
- width = win.current["w"] / 4 - 20
- height = win.current["h"] - 80
-
-
- UI_elements.roundrect(layer, win,
- x,
- y,
- width,
- height,
- 10,
- fill=False)
- layer.clip()
-
- current_Y_scenes = 0
-
- scenes = win.story["scenes"]
-
- for scene in scenes:
- fraction = scenes[scene]["fraction"]
- shots = scenes[scene]["shots"]
-
- foundinscene = []
-
- for num, block in enumerate(shots):
-
- si = 1
- if block[0] == "shot_block":
- si = 2
-
- found = []
-
- for n, stuff in enumerate(block[si]):
-
- # DIRECT LINK
- #print(block, si)
- if stuff[0] == "link" and stuff[1] == win.cur:
-
- start = ""
- part = stuff[-1]
- end = ""
-
- if n > 0:
- start = block[si][n-1][-1]
- start = start.replace("\n", " ")
-
- if n < len(block[si])-1:
- end = block[si][n+1][-1]
- end = end.replace("\n", " ")
-
- found = [start, part, end]
- if si == 2:
- foundinscene.append([block[1],found,num,n])
- else:
- foundinscene.append(["",found,num,n])
-
- # FRASE LINK
-
- if stuff[0] == "frase" and stuff[1][0] == "link" and stuff[1][1] == win.cur:
-
- start = ""
- part = stuff[1][-1]
- end = ""
-
-
- if n < len(block[si])-1:
- end = " : "+stuff[-1]
-
-
- found = [start, part, end]
- if si == 2:
- foundinscene.append([block[1],found,num ,n])
- else:
- foundinscene.append(["",found,num ,n])
-
- if foundinscene:
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- x,
- y+win.scroll["asset_scenes"]+current_Y_scenes,
- width,
- 70,
- 10)
-
- # ICON
- UI_elements.image(layer, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/scene.png",
- 20, y+win.scroll["asset_scenes"] + current_Y_scenes+5, 40, 40)
-
- # SELECTION
- def do():
- if win.current["asset_scene_selected"] == scene:
- win.current["asset_scene_selected"] = False
- else:
- win.current["asset_scene_selected"] = scene
-
-
- UI_elements.roundrect(layer, win,
- x,
- y+win.scroll["asset_scenes"]+current_Y_scenes,
- width,
- 70,
- 10,
- button=do,
- fill=False)
- layer.stroke()
-
- # SCENE NAME
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to( x+60, y+win.scroll["asset_scenes"] + current_Y_scenes+30)
- layer.show_text(scene)
-
- # FRACTION
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- x+10,
- y+50+win.scroll["asset_scenes"] + current_Y_scenes,
- width-20,
- 0,
- 5)
-
- UI_color.set(layer, win, "progress_active")
- UI_elements.roundrect(layer, win,
- x+10,
- y+50+win.scroll["asset_scenes"] + current_Y_scenes,
- (width-20)*fraction,
- 0,
- 5)
-
- # IF SELECTED
- if win.current["asset_scene_selected"] == scene:
- UI_color.set(layer, win, "progress_background")
- UI_elements.roundrect(layer, win,
- x,
- y+win.scroll["asset_scenes"]+current_Y_scenes,
- width,
- 70,
- 10,
- fill=False)
- layer.stroke()
-
- # Here if the current scene is selected I want to draw all
- # the parts of the scene. It's already a bit more complex
- # then what was in the Blender-Organizer legacy.
-
- current_Y_scenes = current_Y_scenes + 80
-
- for block in foundinscene:
-
- # If it's a shot let's mark in the different color.
-
- if block[0]:
- if "shot_colors" not in win.story:
- win.story["shot_colors"] = {}
-
- surl = "/"+scene+"/"+block[0]
-
- if surl not in win.story["shot_colors"]:
-
-
- rcolors = [
- "shot_1",
- "shot_2",
- "shot_3",
- "shot_4",
- "shot_5"
- ]
-
- win.story["shot_colors"][surl] = rcolors[len(win.story["shot_colors"]) % len(rcolors)]
-
- col = win.story["shot_colors"][surl]
- UI_color.set(layer, win, col)
- else:
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- x,
- y+win.scroll["asset_scenes"]+current_Y_scenes,
- width,
- 30,
- 10)
-
- # GET TO THE SCENE BUTTON
- def do():
- win.current["script_find"] = [block[2],block[3]]
-
- win.url = "script"
- print(scene)
- win.cur = "/"+scene+"/"+block[0]
- print(win.cur)
-
- UI_elements.roundrect(layer, win,
- x,
- y+win.scroll["asset_scenes"]+current_Y_scenes,
- width,
- 30,
- 10,
- button=do,
- fill=False)
- layer.stroke()
-
- start = block[1][0]
- name = block[1][1]
- end = block[1][2]
-
- sp = x+width/2-len(name)*12/2-len(start)*12
- np = x+width/2-len(name)*12/2
- ep = x+width/2+len(name)*12/2
-
- if sp > x+5 and x+5 + ep + len(end)*12 > width:
- sp = x+5
- np = x+5 + len(start)*12
- ep = x+5 + len(start)*12 + len(name)*12
-
- elif ep + len(end)*12 < width and sp < x+5:
- ep = width - len(end)*12
- np = ep - len(name)*12
- sp = np - len(start)*12
-
- # BEFORE NAME
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to( sp, y+win.scroll["asset_scenes"] + current_Y_scenes+20)
- layer.show_text(start)
-
-
- # NAME AS MENTIONED IN THE SCRIPT
- UI_color.set(layer, win, "node_asset")
- UI_elements.roundrect(layer, win,
- np-6,
- y+win.scroll["asset_scenes"]+current_Y_scenes+2,
- len(name)*12+12,
- 26,
- 10)
-
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(np, y+win.scroll["asset_scenes"] + current_Y_scenes+20)
- layer.show_text(name)
-
- # AFTER NAME
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to( ep, y+win.scroll["asset_scenes"] + current_Y_scenes+20)
- layer.show_text(end)
-
- current_Y_scenes = current_Y_scenes + 40
-
- else:
- current_Y_scenes = current_Y_scenes + 80
-
- # Scroll
- UI_elements.scroll_area(layer, win, "asset_scenes",
- x+0,
- y+50,
- width,
- height-50,
- current_Y_scenes,
- bar=True,
- mmb=True)
-
-
-
-
-
-
-
-
-
- return surface
|