Creating node material presets for custom node space
- 
Hi, is it possible to define custom node material presets for a custom node space?

It seems that the node material presets are empty for the "Example" node space, and I couldn't find anything related to adding such presets in the SDK (or the examples).
If there is a way - is it also possible to instantiate such a preset with a command plugin? - 
Hi,
I've asked the dev about how to do that and to clarify some points about that. I'll be right back once I got more information.
Cheers,
Manuel - 
Hi,
I've got some informations. It's not possible to insert your own material presets in that menu.
Cheers,
Manuel. - 
OK, thanks for the answer.
About my second question - what is the proper way of creating a node material instance and modifying its graph to a "preset". I want to define several such presets as commands.
There is no example for this and there seems to be no direct function for getting a mutable graph instance. From browsing the interface ofNodeMaterialit seems the steps for achieving this are:- Create a 
NodeMaterialinstance. - Add the desired node space to the material.
 - Get the immutable version of the graph for the node space with 
NodeMaterial::GetGraph(..). - Get the mutable node system from the immutable graph with 
NodesGraphModelInterface::GetMutableNodeSystem(..) - Do modifications.
 
Is my assumption correct and is this the expected way of achieving this?
 - Create a 
 - 
Hi,
you can create those preset with a commandData sure.
When you add the graph to your node material it will call the function you defined in
maxon::nodes::NODESPACE::CREATEMATERIALGRAPHFUNCSee Proving Default Graph Setup for more information. So be sure to remove the nodes added by this function if they are not needed.You must create a NodeMaterial, insert it in the document, add the graph for the right nodespace and retrieve the graph itself (by first retrieving the nimbusref). We got an example on this page: Reading and Modifying Node
This page also contains an introduction to Transaction. maxon::GraphModelInterface::BeginTransaction must be used if you want to modify the graph. You can than Commit your changes, which will ensure the graph is in a correct state. You can have a look a nodespace_impl.cpp, you will find the function CreateMaterialGraphDefaultSetup. remarque: this function doesn't need transactions to modify the graph.
In this handbook, we are using transaction to modify some port's value inside a graph. With both examples, you will understand how to add nodes, connect them, and sets values.Cheers,
Manuel.