Update for Blender 5.2

- use new api compositor access
- Fix file output nodes connexion/renumber/rename/slots handlibng
- consider the new output types
- fixes node position with new API
- fix errors with handler

LLM assisted update
This commit is contained in:
Pullusb
2026-09-29 18:57:26 +02:00
parent 02aa67fc26
commit d650ec8c98
12 changed files with 295 additions and 179 deletions
+23 -5
View File
@@ -324,9 +324,16 @@ class RT_OT_create_output_layers(bpy.types.Operator):
self.socket_collection = context.window_manager.rt_socket_collection
self.socket_collection.clear()
tree = fn.get_compositor_tree(context.scene)
if tree is None:
self.report({'ERROR'}, 'Scene has no compositing node group')
return {'CANCELLED'}
if event.ctrl:
# Direct connect, do not use any options
self.base_path = ''
self.final_base_path_template = None
return self.execute(context)
## Store variable usable in templates
@@ -344,7 +351,7 @@ class RT_OT_create_output_layers(bpy.types.Operator):
tech_passes_names = [tp.strip().lower() for tp in tech_passes_names.split(',') if tp.strip()]
selected = [n for n in context.scene.node_tree.nodes if n.select and n.type != 'OUTPUT_FILE']
selected = [n for n in tree.nodes if n.select and n.type != 'OUTPUT_FILE']
if not selected:
self.report({'ERROR'}, 'No render layer nodes selected')
return {'CANCELLED'}
@@ -411,9 +418,21 @@ class RT_OT_create_output_layers(bpy.types.Operator):
if ref.type == 'R_LAYERS':
self.scene_name = ref.scene.name
self.view_layer_name = ref.layer
self.final_base_path_template = ''
## Set here too, since draw only update it when settings are expanded
self.final_base_path_template = self.get_base_path_template(context)
return context.window_manager.invoke_props_dialog(self, width=530)
def get_base_path_template(self, context):
'''Return base path template from scene settings, None if templates are disabled'''
if not self.use_base_path_templates:
return None
final_format = self.file_format
if final_format == 'NONE':
final_format = os.environ.get('FILE_FORMAT', 'OPEN_EXR_MULTILAYER')
if final_format == 'OPEN_EXR_MULTILAYER':
return context.scene.render_toolbox.default_multilayer_base_path
return context.scene.render_toolbox.default_base_path
def draw(self, context):
layout = self.layout
box = layout.box()
@@ -530,7 +549,7 @@ Possible variables:
display_node_name = item.node_name
## A bit dirty: For render layer node, show render layer-node name.
if display_node_name.startswith('Render Layer'):
rln = context.scene.node_tree.nodes.get(item.node_name)
rln = fn.get_compositor_tree(context.scene).nodes.get(item.node_name)
display_node_name = f'{rln.scene.name}/{rln.layer} ({display_node_name})'
col.label(text=display_node_name, icon='NODE_SEL')
@@ -623,8 +642,7 @@ Possible variables:
'color_depth' : '32',
}
scn = context.scene
nodes = scn.node_tree.nodes
nodes = fn.get_compositor_tree(context.scene).nodes
selected = [n for n in nodes if n.select]
outfile = next((n for n in selected if n.type == 'OUTPUT_FILE'), None)
# Exclude output file from