Migrate Fileoutput and viewlayer management ops from gp_render
Better overall UI. Split file output in a separate panel
This commit is contained in:
@@ -6,6 +6,7 @@ import json
|
||||
from .constant import TECH_PASS_KEYWORDS
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# region Manage nodes
|
||||
|
||||
def real_loc(n):
|
||||
@@ -13,6 +14,43 @@ def real_loc(n):
|
||||
return n.location
|
||||
return n.location + real_loc(n.parent)
|
||||
|
||||
def set_scene_output_from_active_fileout_item():
|
||||
scn = bpy.context.scene
|
||||
rd = scn.render
|
||||
ntree = scn.node_tree
|
||||
fo = ntree.nodes.active
|
||||
|
||||
if fo.type != 'OUTPUT_FILE':
|
||||
return
|
||||
sl = fo.file_slots[fo.active_input_index]
|
||||
full_path = os.path.join(fo.base_path, sl.path)
|
||||
|
||||
rd.filepath = full_path
|
||||
|
||||
fmt = fo.format if sl.use_node_format else sl.format
|
||||
## set those attr first to avoid error settings other attributes in next loop
|
||||
rd.image_settings.file_format = fmt.file_format
|
||||
rd.image_settings.color_mode = fmt.color_mode
|
||||
rd.image_settings.color_depth = fmt.color_depth if fmt.color_depth else 8 # Force set since Sometimes it's weirdly set to "" (not in enum choice)
|
||||
|
||||
excluded = ['file_format', 'color_mode', 'color_depth',
|
||||
'view_settings', 'views_format']
|
||||
|
||||
''' ## all attrs
|
||||
# 'cineon_black', 'cineon_gamma', 'cineon_white',
|
||||
# 'color_depth', 'color_mode', 'compression', 'display_settings',
|
||||
# 'exr_codec', 'file_format', 'jpeg2k_codec', 'quality',
|
||||
# 'rna_type', 'stereo_3d_format', 'tiff_codec', 'use_cineon_log',
|
||||
# 'use_jpeg2k_cinema_48', 'use_jpeg2k_cinema_preset', 'use_jpeg2k_ycc',
|
||||
# 'use_preview', 'use_zbuffer']
|
||||
'''
|
||||
|
||||
for attr in dir(fmt):
|
||||
if attr.startswith('__') or attr.startswith('bl_') or attr in excluded:
|
||||
continue
|
||||
if hasattr(scn.render.image_settings, attr) and not scn.render.image_settings.is_property_readonly(attr):
|
||||
setattr(scn.render.image_settings, attr, getattr(fmt, attr))
|
||||
|
||||
def set_file_output_format(fo):
|
||||
"""Default fileout format for output file node
|
||||
Get from OUTPUT_RENDER_FILE_FORMAT environment variable
|
||||
|
||||
Reference in New Issue
Block a user