I am trying to access Shader AOV Data in Blender un prefer to the batch remove it, but haven’t yet moved forward with it. Any ideas are totally appreciated
import bpy
# 1
MAT_NAME = "Material_Name"
# 2
AOV_NAME = "AOV_Name"
# 4
NODE_NAME = "AOV Output"
for a in bpy.data.materials:
if a.name == MAT_NAME:
for n in a.node_tree.nodes:
print(n.name)
# 2
if n.name == AOV_NAME:
# 3
print(n.color)
# 1 + 4
print(bpy.data.materials[str(MAT_NAME)].node_tree.nodes[str(NODE_NAME)].inputs[1].default_value)
Thanks for the answer, but I am asking about stack:
You can get the currently active AOV with bpy.types.ViewLayer.active_aov, all AOVs with bpy.types.ViewLayer.aovs, and access AOV attributes/methods using bpy.types.AOV.
import bpy
for a in bpy.context.view_layer.aovs:
print("All View Layer AOVs: " + a.name)