Render Previewer! And More than one star!
This commit is contained in:
parent
ced0d5ac4a
commit
71eafc1648
2 changed files with 140 additions and 15 deletions
|
@ -1130,10 +1130,13 @@ def layer(win):
|
|||
|
||||
try:
|
||||
if win.analytics["needed"] <= fracs.get("project", 0) - Pfracs.get("project", 0) and theday <= today:
|
||||
stars = (fracs.get("project", 0) - Pfracs.get("project", 0)) / win.analytics["needed"]
|
||||
|
||||
for star in range(int(round(stars))):
|
||||
UI_elements.image(node, win, "settings/themes/"\
|
||||
+win.settings["Theme"]+"/icons/star.png",
|
||||
6+current_X+win.scroll["days"],
|
||||
height-(50*nicon)-150,
|
||||
height-(50*(nicon+star-1))-150,
|
||||
40,
|
||||
40)
|
||||
except:
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import os
|
||||
import datetime
|
||||
import json
|
||||
import time
|
||||
from subprocess import *
|
||||
|
||||
# GTK module ( Graphical interface
|
||||
|
@ -34,6 +35,30 @@ from studio import story
|
|||
# Network / Rendering
|
||||
from network import network_renders
|
||||
|
||||
def getnumstr(num):
|
||||
|
||||
# This function turns numbers like 1 or 20 into numbers like 0001 or 0020
|
||||
|
||||
s = ""
|
||||
for i in range(4-len(str(num))):
|
||||
s = s + "0"
|
||||
|
||||
return s+str(num)
|
||||
|
||||
def getfileoutput(num, FORMAT):
|
||||
|
||||
# Function gives an output of a file. From the current frame that's rendering.
|
||||
# instead of having frame 1 and format EXR it will give you 0001.exr
|
||||
|
||||
s = getnumstr(num)
|
||||
|
||||
if FORMAT == "JPEG":
|
||||
s = s + ".jpg"
|
||||
else:
|
||||
s = s + "." + FORMAT.lower()
|
||||
|
||||
return s
|
||||
|
||||
def save_settings(win, filename):
|
||||
|
||||
############################################################################
|
||||
|
@ -95,10 +120,94 @@ def layer(win, call):
|
|||
layer.fill()
|
||||
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# THE RENDER PREVIEW THINGY
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
# Here I want to do a preview that's going to be rendered on the right side
|
||||
|
||||
the_render = win.renders[list(win.renders.keys())[0]]
|
||||
amount_of_frames = the_render["end_frame"] - the_render["start_frame"]
|
||||
|
||||
|
||||
passed = time.time() - win.render_runtime.get("started_rendering", 0)
|
||||
passed = passed*1000000
|
||||
longest = passed
|
||||
|
||||
|
||||
|
||||
save_folder = the_render["save_folder"]
|
||||
for i in the_render["analytics"][save_folder].values():
|
||||
if i > longest:
|
||||
longest = i
|
||||
rn_files = []
|
||||
for n, frame in enumerate(range(the_render["start_frame"], the_render["end_frame"])):
|
||||
|
||||
frame_w = (win.current["w"]-630)/amount_of_frames
|
||||
frame_h = (win.current["h"]-200)/3
|
||||
|
||||
try:
|
||||
frac = the_render["analytics"][save_folder][str(frame)] / longest
|
||||
|
||||
frame_h = frame_h * frac
|
||||
except Exception as e:
|
||||
frame_h = 0
|
||||
|
||||
|
||||
if win.render_runtime.get("current_frame", 0) == frame:
|
||||
frame_h = (win.current["h"]-200)/3 * (passed / longest)
|
||||
|
||||
frame_h = max(frame_h, frame_w)
|
||||
|
||||
UI_color.set(layer, win, "node_background")
|
||||
if win.render_runtime.get("current_frame", 0) == frame:
|
||||
UI_color.set(layer, win, "progress_active")
|
||||
UI_elements.roundrect(layer, win,
|
||||
580+(n*frame_w),
|
||||
100+(win.current["h"]-200-frame_h),
|
||||
frame_w-2,
|
||||
frame_h,
|
||||
int((frame_w-2)/2))
|
||||
|
||||
rn_files.append(getfileoutput(frame, the_render["image_format"]))
|
||||
|
||||
render = list(win.renders.keys())[0]
|
||||
folder = render[:render.rfind("/")]
|
||||
for f in reversed(rn_files):
|
||||
rn_image = win.project+folder+"/"+save_folder+"/"+f
|
||||
if os.path.exists(rn_image):
|
||||
UI_elements.image(layer, win, rn_image,
|
||||
580,
|
||||
100,
|
||||
win.current["w"] - 630,
|
||||
int((win.current["h"]-200)/3*1.9),
|
||||
cell="render_preview")
|
||||
|
||||
break
|
||||
|
||||
|
||||
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(20)
|
||||
layer.move_to(50,
|
||||
win.current["h"]-30)
|
||||
layer.show_text(win.render_runtime.get("current_progress", ""))
|
||||
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# THE RENDER MENU
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
UI_color.set(layer, win, "node_background")
|
||||
UI_elements.roundrect(layer, win,
|
||||
win.current["w"]/2-250,
|
||||
310-250,
|
||||
100,
|
||||
500,
|
||||
win.current["h"]-200,
|
||||
|
@ -112,7 +221,7 @@ def layer(win, call):
|
|||
studio_dialogs.help(win, "help", after, SEARCH=talk.text("documentation_render"))
|
||||
|
||||
UI_elements.roundrect(layer, win,
|
||||
win.current["w"]/2-250,
|
||||
310-250,
|
||||
win.current["h"]-140,
|
||||
40,
|
||||
40,
|
||||
|
@ -126,7 +235,6 @@ def layer(win, call):
|
|||
if win.renders[render]["rendering"]:
|
||||
is_rendering = True
|
||||
|
||||
|
||||
if not is_rendering:
|
||||
# Render button
|
||||
def do():
|
||||
|
@ -148,7 +256,7 @@ def layer(win, call):
|
|||
|
||||
|
||||
UI_elements.roundrect(layer, win,
|
||||
win.current["w"]/2-20,
|
||||
310-20,
|
||||
win.current["h"]-140,
|
||||
40,
|
||||
40,
|
||||
|
@ -164,7 +272,7 @@ def layer(win, call):
|
|||
|
||||
|
||||
UI_elements.roundrect(layer, win,
|
||||
win.current["w"]/2-20,
|
||||
310-20,
|
||||
win.current["h"]-140,
|
||||
40,
|
||||
40,
|
||||
|
@ -172,13 +280,27 @@ def layer(win, call):
|
|||
button=do,
|
||||
icon="stop")
|
||||
|
||||
def do():
|
||||
|
||||
os.system("gnome-terminal -- python3 "+os.getcwd()+"/network/render_viewer.py "+win.project)
|
||||
|
||||
|
||||
UI_elements.roundrect(layer, win,
|
||||
310/2-20-40,
|
||||
win.current["h"]-140,
|
||||
40,
|
||||
40,
|
||||
10,
|
||||
button=do,
|
||||
icon="analytics")
|
||||
|
||||
# Exit button
|
||||
def do():
|
||||
win.current["calls"][call]["var"] = False
|
||||
|
||||
|
||||
UI_elements.roundrect(layer, win,
|
||||
win.current["w"]/2+210,
|
||||
100+420,
|
||||
win.current["h"]-140,
|
||||
40,
|
||||
40,
|
||||
|
@ -189,7 +311,7 @@ def layer(win, call):
|
|||
url="render")
|
||||
|
||||
|
||||
x = win.current["w"]/2-250 + 10
|
||||
x = 70
|
||||
y = 100 + 10
|
||||
width = 500 - 20
|
||||
height = win.current["h"]-200 - 20
|
||||
|
@ -596,7 +718,7 @@ def layer(win, call):
|
|||
if not win.current["selecting_render_file_format"]:
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(20)
|
||||
layer.move_to(win.current['w']/2-len(formats[currentformat][1])*6,
|
||||
layer.move_to(310-len(formats[currentformat][1])*6,
|
||||
y+current_Y + win.scroll["render"]+30)
|
||||
layer.show_text(formats[currentformat][1])
|
||||
|
||||
|
@ -662,7 +784,7 @@ def layer(win, call):
|
|||
|
||||
UI_color.set(layer, win, "text_normal")
|
||||
layer.set_font_size(20)
|
||||
layer.move_to(win.current['w']/2-len(formats[f][1])*6,
|
||||
layer.move_to(310-len(formats[f][1])*6,
|
||||
y+current_Y + win.scroll["render"]+30)
|
||||
layer.show_text(formats[f][1])
|
||||
|
||||
|
|
Loading…
Reference in a new issue