More File Formats

More file formats for rendering
And a general info about them.
This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2021-03-03 15:20:19 +00:00
parent 431e985825
commit db7662503d

View file

@ -476,77 +476,10 @@ def layer(win, call):
current_Y = current_Y + 50
# I will give 4 formats to save the renders too. The user will have
# to select 1 of those 4.
# PNG: The good old PNG. Which is an open format and is widly used
# in GNU / Linux operating system. Also it has lossless compre-
# ssion and an alha channel to store transparent parts.
# JPEG: A standard JPEG image type. Widly used to store photos. It
# content aware compression. Which is lossy, but more effective
# then PNG. Tho JPEG lacks alpha channel.
# EXR: In comparison to PNG or JPEG EXR format stores way broader
# range of values for each channel. Not simply from black to
# white. But also values that can be less then black and more
# then white. Giving you a High Dynamic Range look. And a
# possibility to store data such as Z depth.
# HDR: Similar to EXR. But more industry standard. And has bit more
# effective compression.
# I will not add any video files since the algoryhm will require
# actuall frames to be stored as separate files. This will insure
# that ALL frames were rendered. And in case of crash the algorythm
# will pick up from a previous frame in a folder. With video is not
# only impossible. But in case of a crash with video all the previous
# frames will be lost.
formats = ["JPEG", "PNG", "EXR", "HDR"]
for num, f in enumerate(formats):
if f == win.renders[render]["image_format"]:
UI_color.set(layer, win, "progress_time")
UI_elements.roundrect(layer, win,
x+20+(80*num),
y+current_Y + win.scroll["render"],
70,
40,
10)
def do():
win.renders[render]["image_format"] = f
save_settings(win, render)
UI_elements.roundrect(layer, win,
x+20+(80*num),
y+current_Y + win.scroll["render"],
70,
40,
10,
button=do)
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(x+30+(80*num),
y+current_Y + win.scroll["render"]+30)
layer.show_text(f)
current_Y = current_Y + 50
# Now let's put the settings them selves.
# First thing is we need start and end frames. And we also need it
# somehow readable for the user. I think a schedule logo would
# go fine here.
UI_elements.image(layer, win,
"settings/themes/"+win.settings["Theme"]+"/icons/schedule.png",
x+5, y+current_Y+win.scroll["render"], 40, 40)
# And the stuff it self
# somehow readable for the user.
# I will probably need this.
def is_number(string):
@ -559,11 +492,12 @@ def layer(win, call):
# START FRAME
UI_elements.text(layer, win, render+"start_frame",
x+60,
x+10,
y+current_Y+win.scroll["render"],
200,
100,
40,
set_text=str(win.renders[render]["start_frame"]))
set_text=str(win.renders[render]["start_frame"]),
tip=talk.text("rendering_start_frame"))
if win.text[render+"start_frame"]["text"] != str(win.renders[render]["start_frame"])\
and is_number(win.text[render+"start_frame"]["text"]):
@ -573,7 +507,7 @@ def layer(win, call):
UI_elements.roundrect(layer, win,
x+215,
x+70,
y+current_Y+win.scroll["render"],
40,
40,
@ -582,13 +516,87 @@ def layer(win, call):
icon="ok",
tip=talk.text("checked"))
# FILE FORMATS
# I will not add any video files since the algoryhm will require
# actuall frames to be stored as separate files. This will insure
# that ALL frames were rendered. And in case of crash the algorythm
# will pick up from a previous frame in a folder. With video is not
# only impossible. But in case of a crash with video all the previous
# frames will be lost.
# What I want to do is to ejucate the user on the Open Formats.
# You know using OGG video instead of MP4 and stuff like that.
# For images there are the same types of Open Formats. The point
# is that these formats could be made and played using entirelly
# free software.
# I will let selection of formats that are not in the list but I
# will mark them as non-recommended. I will do it like so.
# [ <start frame> ] [ PNG ] [ <png frame>
# V PNG ?
# V JPEG ?
# V EXR ?
# X HDR ?
# And so on and forth. You can see that HDR is marked with an X
# it will be a button linking to the :
linfo = "http://www.linfo.org/free_file_format.html"
# so the user could read a full document describing desisions
# about the formats.
formats = {
"PNG" : [True, "Image PNG", "https://en.wikipedia.org/wiki/Portable_Network_Graphics"],
"JPEG": [True, "Image JPEG", "https://en.wikipedia.org/wiki/JPEG"],
"EXR" : [True, "Open EXR", "https://en.wikipedia.org/wiki/OpenEXR"],
"HDR" : [False,"Radiance HDR", "https://en.wikipedia.org/wiki/RGBE_image_format"],
"BMP" : [False,"Microsoft BMP", "https://en.wikipedia.org/wiki/BMP_file_format"],
"TGA" : [False,"Truevision TGA", "https://en.wikipedia.org/wiki/Truevision_TGA"],
"TIFF": [False,"Tiff", "https://en.wikipedia.org/wiki/Tagged_Image_File_Format"]
}
if "selecting_render_file_format" not in win.current:
win.current["selecting_render_file_format"] = False
def do():
win.current["selecting_render_file_format"] = not win.current["selecting_render_file_format"]
UI_elements.roundrect(layer, win,
x+120,
y+current_Y + win.scroll["render"],
235,
40,
10,
button=do,
tip=talk.text("rendering_file_format"))
currentformat = win.renders[render]["image_format"]
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,
y+current_Y + win.scroll["render"]+30)
layer.show_text(formats[currentformat][1])
# END FRAME
UI_elements.text(layer, win, render+"end_frame",
x+60+210,
x+365,
y+current_Y+win.scroll["render"],
200,
100,
40,
set_text=str(win.renders[render]["end_frame"]))
set_text=str(win.renders[render]["end_frame"]),
tip=talk.text("rendering_end_frame"))
if win.text[render+"end_frame"]["text"] != str(win.renders[render]["end_frame"])\
and is_number(win.text[render+"end_frame"]["text"]):
@ -608,8 +616,82 @@ def layer(win, call):
current_Y = current_Y + 50
if win.current["selecting_render_file_format"]:
for num, f in enumerate(formats):
if f == win.renders[render]["image_format"]:
UI_color.set(layer, win, "progress_time")
UI_elements.roundrect(layer, win,
x+120,
y+current_Y + win.scroll["render"],
235,
40,
10)
def do():
win.renders[render]["image_format"] = f
save_settings(win, render)
win.current["selecting_render_file_format"] = False
UI_elements.roundrect(layer, win,
x+120,
y+current_Y + win.scroll["render"],
235,
40,
10,
button=do)
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(win.current['w']/2-len(formats[f][1])*6,
y+current_Y + win.scroll["render"]+30)
layer.show_text(formats[f][1])
# RECCOMENDATION
if formats[f][0]:
rec = talk.text("recommended_yes")
ic = "ok"
else:
rec = talk.text("recommended_not")
ic = "cancel"
def do():
os.system("xdg-open "+linfo)
UI_elements.roundrect(layer, win,
x+10,
y+current_Y + win.scroll["render"],
40,
40,
10,
button=do,
icon=ic,
tip=rec)
# WIKIPEDIA ABOUT THE FORMAT
def do():
os.system("xdg-open "+formats[f][-1])
UI_elements.roundrect(layer, win,
x+430,
y+current_Y + win.scroll["render"],
40,
40,
10,
button=do,
icon="question",
tip="Wikipedia")
current_Y = current_Y + 50
else:
# And here comes the UI of when it's during RENDERING