Create RS Standard Material instead of RS Material

The code below creates a RS Material Node.

material: c4d.BaseMaterial = c4d.BaseMaterial(c4d.Mmaterial)
 if not material:
     raise MemoryError(f"{material = }")

 nodeMaterial: c4d.NodeMaterial = material.GetNodeMaterialReference()
 graph: maxon.GraphModelRef = nodeMaterial.AddGraph(maxon.Id("com.redshift3d.redshift4c4d.class.nodespace"))
 if graph.IsNullValue():
     raise RuntimeError("Could not add standard graph to material.")
     #print ("Success AddGraph")

How can add I a RS Standard Material instead of a RS Material?



With the update 2023.1 we have introduced the function CreateDefaultGraph.

To resume the current situation for redshift:

  • AddGraph will call the function that is registered within the nodespace data for the ID maxon::nodes::NODESPACE::CREATEMATERIALGRAPHFUNC
  • CreateDefaultGraph will create the Standard material
  • CreateEmptyGraph will create an empty graph

Creating an empty graph allow you to populate it the way you want. You can create the nodes and the connection yourself. If you create yourself the end node and the standard node. You might want to define the path of those nodes in the NimbusRef.
To retrieve the NimbusRef you can use the function GetNimbusRef from the BaseList2D object. From there you can use SetPath to define the path for the end node.
The Id maxon.NIMBUS_PATH.STARTNODE is interesting as this define the node that will be displayed in the Attributs Manager when you select the material.

The easiest way to create a standard materiel is to use CreateDefaultGraph.


MAXON SDK Specialist

MAXON Registered Developer

Great, thank you.

Could you elaborate a bit more on NimbusRef?
Why and when to use it.

For an external user, NimbusRef can be seen as a hook to attach any GraphSystem to a BaseList2D. Most of the needed functionalities have been added to the BaseList2D but some remain. Most of the time you do not need it. If you use CreateDefaultGraph you do not need it for example.


MAXON SDK Specialist

MAXON Registered Developer

Ok, thank you.