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();
static MAXON_METHOD const AssetRepositoryRef & GetBuiltinRepository()
Result< Bool > SetValue(const InternedId &attr, ForwardingDataPtr &&value, Bool checkAndInvalidate=true) const
Definition: graph.h:1685
Result< void > Commit(const DataDictionary &userData=GetPtrSizedZeroRef< DataDictionary >(), Bool validate=true)
Definition: apibaseid.h:253
static MAXON_METHOD Result< NodeTemplate > LoadTemplate(const AssetRepositoryRef &repo, const Id &assetId)
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
PyWideStringList * list
Definition: initconfig.h:447
#define iferr_return
Definition: resultbase.h:1465
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();
}
MODIFIED
These flags are reported by GetModificationsSince() to tell which properties of the node have changed...
Definition: graph.h:694
@ NODE_ADDED
The node has been added.
Definition: resultbase.h:766
void * userData
Definition: fileobject.h:20
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
#define iferr_scope_handler
Definition: resultbase.h:1392
Attributes
A graph model can store attributes:
The attribute IDs can be found in graphattribs.h and portattributes.h.
Selection
Selection state can be retrieved with the maxon::GraphModelHelper interface and the next methods:
Miscellaneous
Further functions are:
Further utility functions are found in maxon::GraphLib.