Hey @kbar,
Thank you for reaching out to us and thank you @Dunhou for providing an answer in Python.
All C++ entity links in my answer intentionally point to the 2023.1 C++ documentation.
NodeMaterial Methods for Creating Graphs
The easiest way to do what you probably want to do, creating an empty graph, is using the method NodeMaterial::CreateEmptyGraph. I would not recommend using ::AddGraph, as this method has been deprecated; this already applies to 2023.¹ When you want to create the default graph, you now should use ::CreateDefaultGraph instead.
You can also compare the 2023.1 Create a Redshift Material C++ example with its 2023.2 variant, as the example itself makes the shift from ::AddGraph
to ::CreateEmptyGraph
.
Predicting Node IDs in a Default Graph
When you create a non-empty Redshift graph, you must identify nodes in it via their asset ID. A node in a graph is identified by two things, its node ID which is unique to the instance, and the asset ID which is the same for all nodes of the same type.

Fig. I: The two IDs are displayed in the node editor info panel for the selected node. Make sure to have Preferences\Node Editor\Ids
enabled to also see the node ID in addition to the asset ID.
The 2023.1
example mentioned above makes use of asset IDs in this stretch of code to select the RS Material node contained in the (old) default graph:
// Find the RS-Material node which is contained within a standard Redshift material graph. This
// example assumes that there is exactly one RS-Material node in the graph that is already
// connected to the output node (which is true for the RS default material as of S26).
maxon::BaseArray<maxon::GraphNode> results;
maxon::GraphModelHelper::FindNodesByAssetId(
graph, rsmaterialId, false, results) iferr_return;
if (results.GetCount() < 1)
return maxon::UnexpectedError(MAXON_SOURCE_LOCATION, "Could not find RS-Material node."_s);
maxon::GraphNode rsmaterialNode = results[0];
This also highlights the problem with it, as you are unable to distinguish two node instances of the same type in this manner. The default graph in the standard material system has predictable/persistent node IDs.

Fig. II: The two nodes in the Standard Renderer default graph will always have the IDs material
, and bsdf
.

Fig. III: The two nodes in the Redshift Renderer default material on the other hand will not have predictable IDs, as they are newly hashed for each graph.
This forces you then to search the graph over asset IDs just as shown in the 2023.1
example.
Resources
- 2024 Python Node Examples: I just added three scripts which cover the very basics in Python. Their code is fully transferable to 2023.X C++.
- 2023.1 Create a Redshift Material: Highlights the '
::AdGraph
or ::CreateDefaultGraph
and then sorting out what is what'-worflow discussed above.
- 2023.2 Create a Redshift Material: Highlights the '
::CreateEmptyGraph
-workflow of starting with a blank canvas. Especially in the context of Redshift I would recommend using this.
Cheers,
Ferdinand
[1] I am aware that our documentation does not mention the deprecation on entities. In this case, the deprecation still has been covered by our old and manual change notes. The new automated changes notes do not cover this anymore. The underlying problem is here that Doxygen does parse C++ attributes, i.e., this:

Is not automatically converted into a @deprecated
. I would have to mess with the Doxygen parsing to fix this, or pre-parse the frameworks to inject @deprecated
markup. I consider both things too costly as we will move away from Doxygen rather sooner than later anyway.