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

View file

@ -288,4 +288,6 @@ remote-server-url = [The hostname of the remote server.]
MissingFiles = [Missing Files]
ChangedFiles = [Changed Files]
RemoteAssetUpdates = [Remote Asset Updates]
DownloadRemoteServer = [Download Files]
RemoteShotUpdates = [Remote Shot Updates]
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 datetime
import threading
import re
import json
@ -34,6 +35,30 @@ from studio import studio_dialogs
from studio import schedule
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):
@ -1690,6 +1715,7 @@ def layer(win):
# Selecting the shot
if win.current["script_shot_higlight"] and win.previous["LMB"] and not win.current["LMB"]:
win.cur = "/"+scene+"/"+win.current["script_shot_higlight"]
select_shot(win)
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
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
# exist already.
@ -2512,9 +2587,9 @@ def layer(win):
except:
pass
UI_elements.roundrect(layer, win,
10,
ifremote+10,
y+win.scroll["script_shots"]+current_Y_shots-10,
width-30,
width-30-ifremote,
40,
10,
button=do,
@ -2522,9 +2597,10 @@ def layer(win):
tip=talk.text("GenerateSubfoldersTip"))
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"))
if at_least_one_missing or win.analytics["from-remote-server"]:
current_Y_shots = current_Y_shots + 50
@ -3146,7 +3222,7 @@ def layer(win):
def do():
win.cur = surl
select_shot(win)
win.current["scroll_shot_to_in_script"] = 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
current_Y += 50
# 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
# REMOTE SERVER
rserv_ok = "unchecked"