Covers how to access, add, or remove information from a graph. There are currently two ways to use and store node systems. The first is via scene nodes, where only one node system per document does exist. The second is via material nodes, where multiple node systems can exist per material and available node space.
The node system and the Maxon API heavily uses IDs to identify uniquely an object (datatype, parameter etc). This ID must be known to find a node or a port within the node system. The true node ID must be unique within the entire graph system, while the IDs of ports must be unique only within the true node itself. The node can be composed of several attributes. Those attributes can be exported by the Resource Editor as symbols and, instead of using the value, the symbols will be used. Those symbols are organized by namespaces. In the node editor, there is a command to display, in the info palette, the ID and/or the asset ID of the selected element. If the option does not exist in the View menu, just start Cinema 4D using this parameter g_showNodeIds=true
.
For example, in the scene editor:
The value should be net.maxon.node.trigonometry. This ID can be searched in the framework directory to find the associated symbol. The symbol is declared in nodes_math.h below the namespace TRIGONOMETRY. All the hierarchy must be named to retrieve the correct ID. In the case of the node trigonometry, it will be maxon::NODE::TRIGONOMETRY. To retrieve the ID of the node itself from the symbol, the function GetId() must be used like so: maxon::NODE::TRIGONOMETRY::GetId()
. Inside the namespace of a node, there are also the symbols for the ports that are a child of the node. The input port symbol will be maxon::NODE::TRIGONOMETRY::IN. Note that, to retrieve the IDs value, the function GetId() is not needed in the case of a port but mandatory for the node. Our symbols are exported to header files. Those header files can be found in Maxon frameworks. For example, the directory nodes/frameworks/definition contains a lot of symbols.
A node material can contain multiple node systems; one system for each node space. With the function NodeMaterial::HasSpace one can know if the node space with the given identifier was instantiated for the material.
A node system can be added with the following function: NodeMaterial::AddGraph. This will create the node system if it does not exist already. To add the graph, one has to provide a known NodeSpace identifier or retrieve the identifier of the current NodeSpace identifier with GetActiveNodeSpaceId().
NodeMaterial::GetGraph can be used to retrieve the node graph from the material for the given node space identifier.
NodeMaterial::RemoveGraph can be used to remove a node graph for the provided node space identifier if there is a graph.
There is only one scene node per document. It can be retrieved from the document itself.