Now you can remotely download shots!!! ( It is almost there )

This commit is contained in:
Victorious Children Studios 2023-12-18 21:55:11 +02:00
parent 656a27c994
commit db26ed0f98
5 changed files with 189 additions and 58 deletions

View file

@ -117,7 +117,10 @@ def download_missing_changed(win, cur):
fdata = win.current["remote-folder-data"][cur][t][f] fdata = win.current["remote-folder-data"][cur][t][f]
if fdata.get("to_download", True): if fdata.get("to_download", True):
print("Downloading", f) print("Downloading", f)
down(win, website, f, fdata.get("filesize", 10000)) try:
down(win, website, f, fdata.get("filesize", 10000))
except Exception as e:
print(e)
del win.current["remote-folder-data"][cur][t][f] del win.current["remote-folder-data"][cur][t][f]
except: except:
pass pass
@ -196,15 +199,18 @@ def get_folder_info(win, folders, cur):
nc = not_checked() nc = not_checked()
while nc: while nc:
dp = go(win, website, "/blend"+nc) try:
dp = go(win, website, "/blend"+nc)
for f in dp.get("files", {}): for f in dp.get("files", {}):
try: try:
sort_file(f, sort_file(f,
dp.get("files", {}), dp.get("files", {}),
f[f.rfind("/")+1:]) f[f.rfind("/")+1:])
except Exception as e: except Exception as e:
print(e) print(e)
except Exception as e:
print(e)
win.current["remote-folder-data"][cur]["blend_checked"].append(nc) win.current["remote-folder-data"][cur]["blend_checked"].append(nc)
@ -666,21 +672,23 @@ def prompt_layer(win, call):
current_Y += 50 current_Y += 50
if win.current["remote-folder-data"][cur]["missing_active"]: if win.current["remote-folder-data"][cur]["missing_active"]:
for f in win.current["remote-folder-data"][cur]["missing"]: try:
for f in win.current["remote-folder-data"][cur]["missing"]:
fdata = win.current["remote-folder-data"][cur]["missing"][f] fdata = win.current["remote-folder-data"][cur]["missing"][f]
if fdata.get("finished"): if fdata.get("finished"):
continue continue
UI_color.set(layer, win, "text_normal") UI_color.set(layer, win, "text_normal")
layer.set_font_size(20) layer.set_font_size(20)
layer.move_to(win.current["w"]/2-270, layer.move_to(win.current["w"]/2-270,
current_Y + win.scroll["http-prompt"] + 135) current_Y + win.scroll["http-prompt"] + 135)
layer.show_text(f) layer.show_text(f)
current_Y += 50
current_Y += 50
except:
pass
# Updated files # Updated files
@ -716,37 +724,40 @@ def prompt_layer(win, call):
current_Y += 50 current_Y += 50
if win.current["remote-folder-data"][cur]["changed_active"]: if win.current["remote-folder-data"][cur]["changed_active"]:
for f in win.current["remote-folder-data"][cur]["changed"]: try:
for f in win.current["remote-folder-data"][cur]["changed"]:
fdata = win.current["remote-folder-data"][cur]["changed"][f] fdata = win.current["remote-folder-data"][cur]["changed"][f]
if fdata.get("finished"): if fdata.get("finished"):
continue continue
icon = "unchecked" icon = "unchecked"
if fdata["to_download"]: if fdata["to_download"]:
icon = "checked" icon = "checked"
def do(): def do():
fdata["to_download"] = not fdata["to_download"] fdata["to_download"] = not fdata["to_download"]
UI_elements.roundrect(layer, win, UI_elements.roundrect(layer, win,
win.current["w"]/2-315, win.current["w"]/2-315,
110 + current_Y + win.scroll["http-prompt"], 110 + current_Y + win.scroll["http-prompt"],
660, 660,
40, 40,
10, 10,
button=do, button=do,
icon=icon) icon=icon)
UI_color.set(layer, win, "text_normal") UI_color.set(layer, win, "text_normal")
layer.set_font_size(20) layer.set_font_size(20)
layer.move_to(win.current["w"]/2-270, layer.move_to(win.current["w"]/2-270,
current_Y + win.scroll["http-prompt"] + 135) current_Y + win.scroll["http-prompt"] + 135)
layer.show_text(f) layer.show_text(f)
current_Y += 50 current_Y += 50
except:
pass
UI_elements.scroll_area(layer, win, "http-prompt", UI_elements.scroll_area(layer, win, "http-prompt",
int(win.current["w"]/2-350), int(win.current["w"]/2-350),

View file

@ -288,4 +288,6 @@ remote-server-url = [The hostname of the remote server.]
MissingFiles = [Missing Files] MissingFiles = [Missing Files]
ChangedFiles = [Changed Files] ChangedFiles = [Changed Files]
RemoteAssetUpdates = [Remote Asset Updates] RemoteAssetUpdates = [Remote Asset Updates]
RemoteShotUpdates = [Remote Shot Updates]
DownloadRemoteServer = [Download Files] DownloadRemoteServer = [Download Files]
blender-bash = [Command To Start Blender]

View file

@ -215,4 +215,4 @@ def get_current_blender(win):
############################################################################ ############################################################################
return "blender" return win.settings.get("blender-bash", "blender")

View file

@ -3,6 +3,7 @@
import os import os
import datetime import datetime
import threading
import re import re
import json import json
@ -34,6 +35,30 @@ from studio import studio_dialogs
from studio import schedule from studio import schedule
from studio import history from studio import history
from network import http_client
def select_shot(win):
# For the http-server stuff
# Remote Server Stuff
if win.analytics["from-remote-server"]:
# Checking date [ FOLDER NAME ] [ FILES TO CHECK FOR ]
check_folders = {"/rnd"+win.cur : "*",
"/rnd"+win.cur+"/storyboard" : "*",
"/rnd"+win.cur+"/opengl" : "*",
"/rnd"+win.cur+"/test_rnd" : "*",
"/rnd"+win.cur+"/rendered" : "*",
"/rnd"+win.cur+"/extra" : "*"
}
check_updates = threading.Thread(target=http_client.get_folder_info,
args=(win, check_folders, win.cur, ))
check_updates.setDaemon(True)
check_updates.start()
def layer(win): def layer(win):
@ -1690,6 +1715,7 @@ def layer(win):
# Selecting the shot # Selecting the shot
if win.current["script_shot_higlight"] and win.previous["LMB"] and not win.current["LMB"]: if win.current["script_shot_higlight"] and win.previous["LMB"] and not win.current["LMB"]:
win.cur = "/"+scene+"/"+win.current["script_shot_higlight"] win.cur = "/"+scene+"/"+win.current["script_shot_higlight"]
select_shot(win)
win.current["shot_left_side_scroll_please_work_omg_wtf"] = True win.current["shot_left_side_scroll_please_work_omg_wtf"] = True
@ -2489,6 +2515,55 @@ def layer(win):
current_Y_shots = current_Y_shots + 50 current_Y_shots = current_Y_shots + 50
ifremote = 0
if win.analytics["from-remote-server"]:
ifremote = 50
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,
10,
y+win.scroll["script_shots"]+current_Y_shots-10,
40,
40,
10,
button=do,
icon="multiuser",
tip=talk.text("RemoteShotUpdates"))
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,
10+25,
y+win.scroll["script_shots"]+current_Y_shots-10,
len(count)*12+6,
25,
5)
layer.fill()
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(10+28,
y+win.scroll["script_shots"]+current_Y_shots-10+20)
layer.show_text(count)
# The user might want to add the subfolders if they do not # The user might want to add the subfolders if they do not
# exist already. # exist already.
@ -2512,9 +2587,9 @@ def layer(win):
except: except:
pass pass
UI_elements.roundrect(layer, win, UI_elements.roundrect(layer, win,
10, ifremote+10,
y+win.scroll["script_shots"]+current_Y_shots-10, y+win.scroll["script_shots"]+current_Y_shots-10,
width-30, width-30-ifremote,
40, 40,
10, 10,
button=do, button=do,
@ -2522,9 +2597,10 @@ def layer(win):
tip=talk.text("GenerateSubfoldersTip")) tip=talk.text("GenerateSubfoldersTip"))
UI_color.set(layer, win, "text_normal") UI_color.set(layer, win, "text_normal")
layer.move_to(60, y+win.scroll["script_shots"]+current_Y_shots+15) layer.move_to(ifremote+60, y+win.scroll["script_shots"]+current_Y_shots+15)
layer.show_text(talk.text("GenerateSubfolders")) layer.show_text(talk.text("GenerateSubfolders"))
if at_least_one_missing or win.analytics["from-remote-server"]:
current_Y_shots = current_Y_shots + 50 current_Y_shots = current_Y_shots + 50
@ -3146,7 +3222,7 @@ def layer(win):
def do(): def do():
win.cur = surl win.cur = surl
select_shot(win)
win.current["scroll_shot_to_in_script"] = True win.current["scroll_shot_to_in_script"] = True
win.current["shot_left_side_scroll_please_work_omg_wtf"] = True win.current["shot_left_side_scroll_please_work_omg_wtf"] = True

View file

@ -679,9 +679,51 @@ def layer(win):
) )
current_Y += 50 current_Y += 100
# WHICH BLENDER TO USE
if "blender-bash" not in win.settings:
win.settings["blender-bash"] = "blender"
UI_elements.image(layer, win, "settings/themes/"\
+win.settings["Theme"]+"/icons/blender.png",
win.current["w"]/2-240,
110 + current_Y + win.scroll["studio_settings"],
40,
40)
UI_elements.text(layer, win, "blender-bash",
win.current["w"]/2-190,
110 + current_Y + win.scroll["studio_settings"],
420,
40,
set_text=win.settings["blender-bash"],
tip=talk.text("blender-bash"))
if win.text["blender-bash"]["text"] != win.settings["blender-bash"]:
def do():
win.settings["blender-bash"] = win.text["blender-bash"]["text"]
settings.write("blender-bash", win.settings["blender-bash"])
UI_elements.roundrect(layer, win,
win.current["w"]/2-240+430,
110 + current_Y + win.scroll["studio_settings"],
40,
40,
10,
button=do,
icon="ok",
tip=talk.text("checked"))
current_Y += 100
current_Y += 50
# REMOTE SERVER # REMOTE SERVER
rserv_ok = "unchecked" rserv_ok = "unchecked"