fix output settings - default to exr

0.3.6

change: output settings switch from PNG to EXR
fix: set render scene output (preview) to jpeg fast to write
fix: correct copy output format ops
main
Pullusb 2021-09-23 15:13:30 +02:00
parent 37809e15e6
commit 47774a46e3
4 changed files with 44 additions and 14 deletions

View File

@ -2,6 +2,8 @@
<!-- TODO <!-- TODO
- need to let use choose output settings
if objects has multiple user without being linked in render scene : if objects has multiple user without being linked in render scene :
duplicate the object insteat of linking duplicate the object insteat of linking
OR always duplicate (safe but heavy scenes...) OR always duplicate (safe but heavy scenes...)
@ -12,6 +14,12 @@ Activate / deactivate layer opaticty according to prefix
Activate / deactivate all masks using MA layers Activate / deactivate all masks using MA layers
--> -->
0.3.6
change: output settings switch from PNG to EXR
fix: set render scene output (preview) to jpeg fast to write
fix: correct copy output format ops
0.3.5: 0.3.5:
feat: set full opacity -> skip chosen prefix (MA by default) feat: set full opacity -> skip chosen prefix (MA by default)

View File

@ -85,20 +85,29 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator):
return {"CANCELLED"} return {"CANCELLED"}
ref = nodes.active ref = nodes.active
color_mode = ref.format.color_mode
file_format = ref.format.file_format # file_format = ref.format.file_format
color_depth = ref.format.color_depth # color_mode = ref.format.color_mode
compression = ref.format.compression # color_depth = ref.format.color_depth
# compression = ref.format.compression
ct = 0 ct = 0
for n in nodes: for n in nodes:
if n.type != 'OUTPUT_FILE' or n == ref or not n.select: if n.type != 'OUTPUT_FILE' or n == ref or not n.select:
continue continue
n.format.color_mode = color_mode for attr in dir(ref.format):
n.format.file_format = file_format if attr.startswith('__') or attr in {'rna_type','bl_rna', 'view_settings'}: # views_format
n.format.color_depth = color_depth continue
n.format.compression = compression try:
setattr(n.format, attr, getattr(ref.format, attr))
except Exception as e:
print(f"can't set attribute : {attr}")
# n.format.file_format = file_format
# n.format.color_mode = color_mode
# n.format.color_depth = color_depth
# n.format.compression = compression
ct += 1 ct += 1
@ -107,6 +116,7 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
def out_norm(x): def out_norm(x):
a = x.group(1) if x.group(1) else '' a = x.group(1) if x.group(1) else ''
b = x.group(2) if x.group(2) else '' b = x.group(2) if x.group(2) else ''
@ -115,6 +125,7 @@ def out_norm(x):
e = x.group(5) if x.group(5) else '' e = x.group(5) if x.group(5) else ''
return f'{a}{b}{fn.normalize(c)}{d}{e}' return f'{a}{b}{fn.normalize(c)}{d}{e}'
## does not match the right thing yet ## does not match the right thing yet
class GPEXP_OT_normalize_outnames(bpy.types.Operator): class GPEXP_OT_normalize_outnames(bpy.types.Operator):
bl_idname = "gp.normalize_outnames" bl_idname = "gp.normalize_outnames"

View File

@ -2,7 +2,7 @@ bl_info = {
"name": "GP Render", "name": "GP Render",
"description": "Organise export of gp layers through compositor output", "description": "Organise export of gp layers through compositor output",
"author": "Samuel Bernou", "author": "Samuel Bernou",
"version": (0, 3, 5), "version": (0, 3, 6),
"blender": (2, 93, 0), "blender": (2, 93, 0),
"location": "View3D", "location": "View3D",
"warning": "", "warning": "",

21
fn.py
View File

@ -94,10 +94,16 @@ def copy_settings(obj_a, obj_b):
def set_file_output_format(fo): def set_file_output_format(fo):
fo.format.file_format = 'OPEN_EXR'
fo.format.color_mode = 'RGBA' fo.format.color_mode = 'RGBA'
fo.format.file_format = 'PNG' fo.format.color_depth = '16'
fo.format.color_depth = '8' fo.format.exr_codec = 'ZIP'
fo.format.compression = 15 # fo.format.exr_codec = 'RLE'
# fo.format.file_format = 'PNG'
# fo.format.color_mode = 'RGBA'
# fo.format.color_depth = '8'
# fo.format.compression = 15
def set_settings(scene=None): def set_settings(scene=None):
if not scene: if not scene:
@ -108,6 +114,13 @@ def set_settings(scene=None):
scene.render.film_transparent = True scene.render.film_transparent = True
scene.view_settings.view_transform = 'Standard' scene.view_settings.view_transform = 'Standard'
# output (fast write settings since this is just to delete afterwards...)
scene.render.filepath = '//render/preview/preview_'
scene.render.image_settings.file_format = 'JPEG'
scene.render.image_settings.color_mode = 'BW'
scene.render.image_settings.quality = 0
def get_render_scene(): def get_render_scene():
'''Get / Create a scene named Render''' '''Get / Create a scene named Render'''
@ -126,8 +139,6 @@ def get_render_scene():
if ob.type in ('CAMERA', 'LIGHT'): if ob.type in ('CAMERA', 'LIGHT'):
render_scn.collection.objects.link(ob) render_scn.collection.objects.link(ob)
render_scn.render.filepath = '//render/preview/preview_'
# set adapted render settings (no AA) # set adapted render settings (no AA)
set_settings(render_scn) set_settings(render_scn)
render_scn.use_nodes = True render_scn.use_nodes = True