maxon::nodes::NODESPACE Namespace Reference

Detailed Description

The following attributes are constructed by Cinema4d and available for query.

The following attributes should be passed to the NodeSpaceInterface::Init() function and be available for query via NodeSpaceInterface::GetData() .


using CreateMaterialGraphFunc = Delegate< Result< void >(const NodesGraphModelRef &graph)>
using ConfigurePreviewImageRequestFunc = Delegate< Result< void >(DataDictionaryObjectRef request)>
using ImageNodePortTuple = HomogenousTupleType< 4, NodePath >
using LayerSetUrlDelegate = Delegate< Result< Url >(const GraphNode &)>
using ImageNodeSetupDelegate = Delegate< Result< void >(const GraphNode &, const Url &)>
using MaterialMessageHandlerFunc = Delegate< Result< Bool >(const NodesGraphModelRef &graph, Int32 messageId, void *messageData, void *nodeMaterial)>


enum  KIND {


 MAXON_ATTRIBUTE (Id, SPACEID, "net.maxon.nodes.nodespace.spaceid")
 MAXON_ATTRIBUTE (String, SPACENAME, "net.maxon.nodes.nodespace.spacename")
 MAXON_ATTRIBUTE (Array< Int >, RENDERERS, "net.maxon.nodes.nodespace.renderers")
 MAXON_ATTRIBUTE (KIND, SPACEKIND, "net.maxon.nodes.nodespace.kind")
 MAXON_ATTRIBUTE (CreateMaterialGraphFunc, CREATEMATERIALGRAPHFUNC, "net.maxon.nodes.nodespace.creatematerialgraphfunc")
 MAXON_ATTRIBUTE (ConfigurePreviewImageRequestFunc, CONFIGUREPREVIEWIMAGEREQUESTFUNC, "net.maxon.nodes.nodespace.configurepreviewimagerequestfunc")
 MAXON_ATTRIBUTE (Array< Id >, MATERIALENDNODEIDS, "net.maxon.nodes.nodespace.materialendnodeids")
 MAXON_ATTRIBUTE (Array< Id >, MATERIALPREVIEWIDS, "net.maxon.nodes.nodespace.materialpreviewids")
 MAXON_ATTRIBUTE (NodeSystemClass, NODESYSTEMCLASS, "net.maxon.nodes.nodespace.nodesystemclass")
 MAXON_ATTRIBUTE (Class< NimbusRef >, NIMBUSCLASS, "net.maxon.nodes.nodespace.nimbusclass")
 MAXON_ATTRIBUTE (Array< Id >, MATERIALEXCHANGEBUNDLEIDS, "net.maxon.nodes.nodespace.materialexchangebundleids")
 MAXON_ATTRIBUTE (Class< MaterialExchangeRef >, MATERIALEXCHANGECLASS, "net.maxon.nodes.nodespace.materialexchangeclass")
 MAXON_ATTRIBUTE (Class< NodeMaterialImportRef >, NODEMATERIALIMPORTCLASS, "net.maxon.nodes.nodespace.nodematerialimportclass")
 MAXON_ATTRIBUTE (Class< NodeMaterialExportRef >, NODEMATERIALEXPORTCLASS, "net.maxon.nodes.nodespace.nodematerialexportclass")
 MAXON_ATTRIBUTE (Id, IMAGENODEASSETID, "net.maxon.nodes.nodespace.imagenodeassetid")
 MAXON_ATTRIBUTE (ImageNodePortTuple, IMAGENODEPORTS, "net.maxon.nodes.nodespace.IMAGENODEPORTS")
 MAXON_ATTRIBUTE (LayerSetUrlDelegate, LAYERSETURL, "net.maxon.nodes.nodespace.layerseturl")
 MAXON_ATTRIBUTE (ImageNodeSetupDelegate, IMAGENODESETUP, "net.maxon.nodes.nodespace.imagenodesetup")
 MAXON_ATTRIBUTE (MaterialMessageHandlerFunc, MATERIALMESSAGEHANDLERFUNC, "net.maxon.nodes.nodespace.materialmessagehandlerfunc")
 MAXON_ATTRIBUTE (NodePath, STARTNODEPATH, "net.maxon.nodes.nodespace.startnodepath")
 MAXON_ATTRIBUTE (NodePath, SOLONODEPATH, "net.maxon.nodes.nodespace.solonodepath")
 MAXON_ATTRIBUTE (Url, DOCUMENTPATH, "net.maxon.nodes.nodespace.documentpath")
 MAXON_ATTRIBUTE (DataDictionary, NodeSpaceContext, "net.maxon.nodes.nodespace.nodespacecontext")

Typedef Documentation

◆ CreateMaterialGraphFunc

using CreateMaterialGraphFunc = Delegate<Result<void>(const NodesGraphModelRef& graph)>

This callback is executed for the active space if a node material is created, and for the user-selected add space command.

The provided function has exclusive write access and can instantiate nodes the following:

maxon::nodes::NodeTemplate endNodeSystem = maxon::nodes::NodesLib::LoadTemplate(maxon::AssetInterface::GetBuiltinRepository(), maxonexample::NODE::ENDNODE::GetId()) iferr_return;
maxon::GraphNode endGraphNode = graph.AddChild(maxon::Id("end node instance"), endNodeSystem) iferr_return;
return maxon::OK;
[in,out]graphThe empty node graph for filling with a default setup.
OK on success.

Future consideration: we may extend the signature of this function by providing read-only access to other node graphs that are already present in the particular material. This may fulfill the use case for migrating a node material from one space to another. The implementer would then be able to implement a (complex and lossy) conversion from another source node graph (from another space) to the target node space.

◆ ConfigurePreviewImageRequestFunc

using ConfigurePreviewImageRequestFunc = Delegate<Result<void>(DataDictionaryObjectRef request)>

This callback is executed for the active space if a preview for the current node material is requested. The origin of the preview may lie in GUI components such as the Attribute Manager, Node Editor, or Material Manager.

It is mandatory to provide a valid maxon::nodes::PREVIEWIMAGEREQUEST::PROVIDER class.

[in,out]requestThe container to be filled that is passed into PreviewImageProviderInterface::Initialize() function later.
OK on success.

◆ ImageNodePortTuple

◆ LayerSetUrlDelegate

◆ ImageNodeSetupDelegate

using ImageNodeSetupDelegate = Delegate<Result<void>(const GraphNode&, const Url&)>

◆ MaterialMessageHandlerFunc

using MaterialMessageHandlerFunc = Delegate<Result<Bool>(const NodesGraphModelRef& graph, Int32 messageId, void* messageData, void* nodeMaterial)>

Is executed on every message that sent to the owning BaseMaterial. This message may be used to react and mutate the graph.

The node material comes with a default message handling behavior that can be disabled when returning true (indicating complete consume of the message). Note that the default behavior handles the undo system and other state changes outside of the node graph.

[in]graphThe node graph associated with the particular space.
[in]messageIdThe id of the message.
[in]messageDataThe (opaque) content of the message.
[in]nodeMaterialThe (opaque) pointer to the BaseMaterial (of type NodeMaterial).
true if message is declared consumed, false if default consume behavior should follow.

Enumeration Type Documentation


enum KIND

An enum to represent the different node space kinds (such as materials or scene nodes).


The node space is used for materials.


The node space is used for scene nodes.

Function Documentation


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Id  ,

Defines the identifier for all space-related data, such as node graph storage within C4D files.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( String  ,

Defines the GUI-visible string for the space-related components, such as node space switch and the Basic tab of node materials.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Array< Int ,

Defines the list of renderers that support the node space. Multiple renderers may be supported. This is the case for the MaterialNodeSpaces::Standard space which is supported by Standard renderer, Physical Renderer and Hardware Renderer.

However it is invalid to have multiple spaces that indicate support for one particular renderer. In such a case, the "Current (Renderer)" binding is ambiguous and made with no well-defined priority.


enum maxon::nodes::NODESPACE::KIND maxon::nodes::NODESPACE::MAXON_ENUM_LIST ( KIND  )



Defines the node space kind of this node space.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( CreateMaterialGraphFunc  ,


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( ConfigurePreviewImageRequestFunc  ,


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Array< Id ,

The set of asset identifiers for end nodes. An end node acts as an entry point to the node graph within the Attribute Manager, if no specific start node has been specified by the user. Multiple identifiers should be defined in ascending priority order. A node instance of the first Id type is preferred for ambiguous cases.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Array< Id ,

The set of Ids that require a 3d preview along with the user choice over the 3d scene. It can be expected that a valid value for maxon::nodes::PREVIEW::SCENETYPE is then provided to PreviewImageProviderInterface::Initialize().


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( NodeSystemClass  ,

The type of node system this space supports. The node system defines which types of nodes are available for the user in the GUI for the particular node space. Node instances are bound to one node system class.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Class< NimbusRef >  ,

The class to use for the NimbusRef of this node space.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Array< Id ,

Defines the collection of compatible material types.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Class< MaterialExchangeRef >  ,

Defines which component implementing the maxon::nodes::MaterialExchangeInterface is queried for the representation of the node material in the viewport and for exchange purposes like material export.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Class< NodeMaterialImportRef >  ,

This callback is executed on import of material data, potentially from a file format such as FBX or by migrating data from one space to another.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Class< NodeMaterialExportRef >  ,

This callback is executed on export of material data, potentially from a file format such as FBX or by migrating data from one space to another. If not provided, the export will fallback to the extraction of the material definition provided for viewport display.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Id  ,

Defines the type of node that acts as an image / texture node. An instance of this type is created if users drag & drop an image onto the ports connectors or the Node Editor canvas.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( ImageNodePortTuple  ,

Makes a set of ports on the image / texture node type known to Cinema4D's business logic. For each port you have to specify the relative node path within its port list, so for the simple case of a non-nested path you have to specify a path of just one identifier.

The four ports must have the following signature:

Index in Tuple | Port Type | Data Type | Description

0 | Output Port | maxon::Color | The result port. 1 | Input Port | maxon::Url | The URL of the input image. 2 | Input Port | maxon::Int | The index of the starting frame. 3 | Input Port | maxon::Int | The index of the ending frame.

The setup could be the following:

imageTuple.first = NodePath::Create(ToSingletonBlock<InternedId>(MYSPACE::NODE::IMAGE::RESULT)) iferr_return;
imageTuple.second = NodePath::Create(ToSingletonBlock<InternedId>(MYSPACE::NODE::IMAGE::URL)) iferr_return;
imageTuple.third = NodePath::Create(ToSingletonBlock<InternedId>(MYSPACE::NODE::IMAGE::SEQUENCE_FRAMESTART)) iferr_return;
imageTuple.fourth = NodePath::Create(ToSingletonBlock<InternedId>(MYSPACE::NODE::IMAGE::SEQUENCE_FRAMEEND)) iferr_return;
spaceData.Set(nodes::NODESPACE::IMAGENODEPORTS, std::move(imageTuple)) iferr_return;


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( LayerSetUrlDelegate  ,

A node space can set this property if it wants to use the built-in layerset UI for more than the image node. The layerset UI calls the delegate to obtain the Url to use for the given layerset port. For example, if the layerset port is in a port bundle which also contains a Url port with id "url", you can use code like this:

nodes::NODESPACE::LayerSetUrlDelegate d = [] (const GraphNode& port) -> Result<Url>
GraphNode urlPort = port.GetParent().FindChild(Id("url")) iferr_return;
if (urlPort.IsValid())
return urlPort.GetDefaultValue(Url());
return {};
spaceData.Set(nodes::NODESPACE::LAYERSETURL, std::move(d)) iferr_return;

If the node space doesn't set this property or if the delegate returns an empty Url, the port determined by IMAGENODEPORTS is used as fallback.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( ImageNodeSetupDelegate  ,

A node space can set this property if it wants to handle the setup of an image node for a given Url. The delegate receives the GraphNode of a newly create image node and the Url to use. Before the delegate is called, the ports determined by IMAGENODEPORTS have been set up (Url, start and end frame).


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( MaterialMessageHandlerFunc  ,


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( NodePath  ,

Defines the path to the currently defined start node, as used in the Attribute Manager.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( NodePath  ,

Defines the path to the currently defined solo node, as used in the Node Editor and Viewport.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( Url  ,

Defines the directory of the owning BaseDocument. This path may help resolving absolute paths to assets defined in a relative fashion, such as images.


maxon::nodes::NODESPACE::MAXON_ATTRIBUTE ( DataDictionary  ,
NodeSpaceContext  ,

Defines a generic data container that exists on root GraphNode of every material node graph. It defines the connection between the node space-agnostic node graph and the space-specific embedding of the node graph into Cinema4d business logic.

Its content is currently restricted to supports maxon::nodes::NODESPACE::SPACEID supports maxon::nodes::NODESPACE::SOLONODEPATH supports maxon::nodes::NODESPACE::DOCUMENTPATH

The data can be extracted as such from a graph:

const maxon::DataDictionary graphContext = graph.GetRoot().GetValue<decltype(maxon::nodes::NODESPACE::NodeSpaceContext)>().GetValueOrNull() iferr_return;
const maxon::Url documentPath = graphContext.Get(maxon::nodes::NODESPACE::DOCUMENTPATH, maxon::Url());
Delegate< Result< Url >(const GraphNode &)> LayerSetUrlDelegate
Definition: node_spaces.h:181
MAXON_ATTRIBUTE_FORCE_INLINE auto end(COLLECTION &&c) -> decltype(c.End())
Definition: foreach.h:359
The maxon namespace contains all declarations of the MAXON API.
Definition: c4d_basedocument.h:15
static const MAXON_METHOD AssetRepositoryRef & GetBuiltinRepository()
#define iferr_return
Definition: resultbase.h:1465
Result< typename std::conditional< STD_IS_REPLACEMENT(void, T), typename IsFidClass< KEY >::type, T >::type > Get(KEY &&key) const
Definition: url.h:903
Definition: url.h:855
The data type is a Result.
Definition: apibase.h:2186
#define iferr_scope
Definition: resultbase.h:1374
static MAXON_METHOD Result< NodeTemplate > LoadTemplate(const AssetRepositoryRef &repo, const Id &assetId)
HomogenousTupleType< 4, NodePath > ImageNodePortTuple
Definition: node_spaces.h:153