About
A maxon::GraphModelInterface contains a basic graph model containing a hierarchy of nodes and a collection of connections between these nodes. It is reused as a node material's node system with maxon::nodes::NodesGraphModel (see NodesGraphModelInterface Manual).
Nodes
The maxon::GraphNode nodes stored in the model are accessed with:
const maxon::NodePath rootPath = model.GetRootPath();
See GraphNodes Manual.
Edit
Editing a maxon::GraphModelInterface reference is done through transactions:
Additionally, information relative to a maxon::GraphModelInterface reference can be retrieved with:
- Note
- A graph model may only be modified when there is an active transaction.
A change list stores changes and allows to reproduce these changes on a different graph.
const maxon::nodes::NodesGraphModelRef& nodeGraph = nodeMaterial->
GetGraph(nodeSpaceID)
iferr_return;
if (nodeGraph.IsReadOnly())
const maxon::Id nodeAssetId {
"net.maxonexample.noderenderer.usernode" };
const maxon::ChangeList& list = nodeGraph.GetChangeList();
Related observables are:
- ObservableTransactionStarted: Informs about the start of a transaction.
- ObservableTransactionCommitted: Informs about the commit of a transaction.
- ObservableTransactionRolledBack: Informs about the rollback of a transaction.
g_timeStamp = model.GetModificationStamp();
model.ObservableTransactionCommitted().AddObserver(ObserveCommit)
iferr_return;
static void ObserveCommit(const maxon::GraphModelRef& graph, const maxon::DataDictionary& userData)
{
{
return;
};
graph.GetModificationsSince(g_timeStamp,
{
{
return false;
}
return true;
g_timeStamp = graph.GetModificationStamp();
}
Attributes
A graph model can store attributes:
The attribute IDs can be found in graphattribs.h and portattributes.h.
Selection
A graph store the selected nodes:
Miscellaneous
Further functions are:
Further utility functions are found in maxon::GraphLib.