Added support for custom render passes

This commit is contained in:
Simone Barbieri 2023-08-23 09:32:32 +01:00
parent 5f901f2a62
commit fc1a98b471
3 changed files with 43 additions and 2 deletions

View file

@ -168,7 +168,10 @@ class CollectBlenderRender(pyblish.api.InstancePlugin):
["RenderSettings"]
["aov_list"])
scene = bpy.context.scene
custom_passes = (settings["blender"]
["RenderSettings"]
["custom_passes"])
vl = bpy.context.view_layer
vl.use_pass_combined = "combined" in aov_list
@ -185,6 +188,16 @@ class CollectBlenderRender(pyblish.api.InstancePlugin):
vl.use_pass_shadow = "shadow" in aov_list
vl.use_pass_ambient_occlusion = "ao" in aov_list
aovs_names = [aov.name for aov in vl.aovs]
for cp in custom_passes:
cp_name = cp[0]
if cp_name not in aovs_names:
aov = vl.aovs.add()
aov.name = cp_name
else:
aov = vl.aovs[cp_name]
aov.type = cp[1].get("type", "VALUE")
def _create_context(self):
context = bpy.context.copy()

View file

@ -22,7 +22,8 @@
"aov_separator": "underscore",
"image_format": "exr",
"multilayer_exr": true,
"aov_list": []
"aov_list": [],
"custom_passes": []
},
"workfile_builder": {
"create_first_version": false,

View file

@ -121,6 +121,33 @@
{"shadow": "Shadow"},
{"ao": "Ambient Occlusion"}
]
},
{
"type": "label",
"label": "Add custom AOVs. They are added to the view layer and in the Compositing Nodetree,\nbut they need to be added manually to the Shader Nodetree."
},
{
"type": "dict-modifiable",
"store_as_list": true,
"key": "custom_passes",
"label": "Custom Passes",
"use_label_wrap": true,
"object_type": {
"type": "dict",
"children": [
{
"key": "type",
"label": "Type",
"type": "enum",
"multiselection": false,
"defaults": "color",
"enum_items": [
{"COLOR": "Color"},
{"VALUE": "Value"}
]
}
]
}
}
]
},