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 opsmain
parent
37809e15e6
commit
47774a46e3
|
@ -2,6 +2,8 @@
|
|||
|
||||
|
||||
<!-- TODO
|
||||
- need to let use choose output settings
|
||||
|
||||
if objects has multiple user without being linked in render scene :
|
||||
duplicate the object insteat of linking
|
||||
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
|
||||
-->
|
||||
|
||||
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:
|
||||
|
||||
feat: set full opacity -> skip chosen prefix (MA by default)
|
||||
|
|
|
@ -85,20 +85,29 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator):
|
|||
return {"CANCELLED"}
|
||||
|
||||
ref = nodes.active
|
||||
color_mode = ref.format.color_mode
|
||||
file_format = ref.format.file_format
|
||||
color_depth = ref.format.color_depth
|
||||
compression = ref.format.compression
|
||||
|
||||
# file_format = ref.format.file_format
|
||||
# color_mode = ref.format.color_mode
|
||||
# color_depth = ref.format.color_depth
|
||||
# compression = ref.format.compression
|
||||
|
||||
ct = 0
|
||||
for n in nodes:
|
||||
if n.type != 'OUTPUT_FILE' or n == ref or not n.select:
|
||||
continue
|
||||
|
||||
n.format.color_mode = color_mode
|
||||
n.format.file_format = file_format
|
||||
n.format.color_depth = color_depth
|
||||
n.format.compression = compression
|
||||
for attr in dir(ref.format):
|
||||
if attr.startswith('__') or attr in {'rna_type','bl_rna', 'view_settings'}: # views_format
|
||||
continue
|
||||
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
|
||||
|
||||
|
@ -107,6 +116,7 @@ class GPEXP_OT_set_output_node_format(bpy.types.Operator):
|
|||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
def out_norm(x):
|
||||
a = x.group(1) if x.group(1) 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 ''
|
||||
return f'{a}{b}{fn.normalize(c)}{d}{e}'
|
||||
|
||||
|
||||
## does not match the right thing yet
|
||||
class GPEXP_OT_normalize_outnames(bpy.types.Operator):
|
||||
bl_idname = "gp.normalize_outnames"
|
||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
|||
"name": "GP Render",
|
||||
"description": "Organise export of gp layers through compositor output",
|
||||
"author": "Samuel Bernou",
|
||||
"version": (0, 3, 5),
|
||||
"version": (0, 3, 6),
|
||||
"blender": (2, 93, 0),
|
||||
"location": "View3D",
|
||||
"warning": "",
|
||||
|
|
21
fn.py
21
fn.py
|
@ -94,10 +94,16 @@ def copy_settings(obj_a, obj_b):
|
|||
|
||||
|
||||
def set_file_output_format(fo):
|
||||
fo.format.file_format = 'OPEN_EXR'
|
||||
fo.format.color_mode = 'RGBA'
|
||||
fo.format.file_format = 'PNG'
|
||||
fo.format.color_depth = '8'
|
||||
fo.format.compression = 15
|
||||
fo.format.color_depth = '16'
|
||||
fo.format.exr_codec = 'ZIP'
|
||||
# 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):
|
||||
if not scene:
|
||||
|
@ -108,6 +114,13 @@ def set_settings(scene=None):
|
|||
scene.render.film_transparent = True
|
||||
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():
|
||||
'''Get / Create a scene named Render'''
|
||||
|
@ -125,8 +138,6 @@ def get_render_scene():
|
|||
for ob in bpy.context.scene.objects:
|
||||
if ob.type in ('CAMERA', 'LIGHT'):
|
||||
render_scn.collection.objects.link(ob)
|
||||
|
||||
render_scn.render.filepath = '//render/preview/preview_'
|
||||
|
||||
# set adapted render settings (no AA)
|
||||
set_settings(render_scn)
|
||||
|
|
Loading…
Reference in New Issue