Hi everyone,
I am writing a script that scans a Standard Material with existing PBR connections (Base Color, Roughness, etc.) and connects those outputs to a new Store Color To AOV node, based on AOVs already present in the scene.
The goal is to mirror the current PBR setup to AOV outputs without altering the original material.
What I am currently unsure about is how to reliably trace the existing PBR connections and wire them to the appropriate input ports of the Store Color To AOV node.
What would be the recommended approach for this using the 2025 Nodes API?
Below is a minimal example where everything is created from scratch:
import c4d
import maxon
def main() -> None:
graph: maxon.NodesGraphModelRef = maxon.GraphDescription.GetGraph(
name="Simple PBR Material", nodeSpaceId=maxon.NodeSpaceIdentifiers.RedshiftMaterial)
maxon.GraphDescription.ApplyDescription(graph,
[
{
"$type": "Color",
"Basic/Name": "Base Color",
"Inputs/Color": maxon.Vector(1, 1, 1),
"$id": "base_color"
},
{
"$type": "Color",
"Basic/Name": "Metallic",
"Inputs/Color": maxon.Vector(0.0, 0.0, 0.0),
"$id": "metallic_color"
},
{
"$type": "Color",
"Basic/Name": "Roughness",
"Inputs/Color": maxon.Vector(0.5, 0.5, 0.5),
"$id": "roughness_color"
},
{
"$type": "Color",
"Basic/Name": "Normal",
"Inputs/Color": maxon.Vector(0.5, 0.5, 1),
"$id": "normal_color"
},
{
"$type": "Color",
"Basic/Name": "AO",
"Inputs/Color": maxon.Vector(1, 1, 1),
"$id": "ao_color"
},
{
"$type": "Color",
"Basic/Name": "Emissive",
"Inputs/Color": maxon.Vector(0, 0, 0),
"$id": "emissive_color"
},
{
"$type": "Output",
"Surface": {
"$type": "Store Color To AOV",
"AOV Input 0": "#base_color",
"AOV Name 0": "BaseColor",
"AOV Input 1": "#metallic_color",
"AOV Name 1": "Metallic",
"AOV Input 2": "#roughness_color",
"AOV Name 2": "Roughness",
"AOV Input 3": "#normal_color",
"AOV Name 3": "Normal",
"AOV Input 4": "#ao_color",
"AOV Name 4": "AO",
"AOV Input 5": "#emissive_color",
"AOV Name 5": "Emissive",
"Beauty Input": {
"$type": "Standard Material",
"Base/Color": "#base_color",
"Base/Metalness": "#metallic_color",
"Reflection/Roughness": "#roughness_color",
"Geometry/Bump Map": "#normal_color",
"Geometry/Overall Tint": "#ao_color",
"Emission/Color": "#emissive_color",
}
}
}
]
)
if __name__ == '__main__':
main()
On the left is an existing material, and on the right is the result I’m trying to achieve:

Cheers,
Anthony