NodeSpaceInterface Manual

Table of Contents

About

A node space represents a container for a node system for a specific purpose. For example, a NodeMaterial can contain multiple node systems; one for each node-based render engine.

For custom node spaces, see NodeSpaceInterface Implementation.

Access

Node spaces are stored in the maxon::nodes::MaterialNodeSpaces registry. The active node space ID is obtained with GetActiveNodeSpaceId(). The default node space is:

  • maxon::nodes::MaterialNodeSpaces::Standard: The standard node space.
// This example checks if the active node space is the standard node space.
// get standard node space ID
const maxon::Id standardNodeSpace = maxon::nodes::MaterialNodeSpaces::Standard.GetId();
// get active node space ID
const maxon::Id activeNodeSpace = GetActiveNodeSpaceId();
// compare
if (standardNodeSpace == activeNodeSpace)
{
ApplicationOutput("Active Node Space is standard Node Space");
}
maxon::Id GetActiveNodeSpaceId()
Definition: apibaseid.h:253
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210

A node space stores various settings. The most important are:

  • maxon::nodes::NODESPACE::SPACENAME: The name of the node space.
  • maxon::nodes::NODESPACE::RENDERERS: The IDs of the associated render engines (VideoPostData plugin IDs).

For more settings, see MAXON_ATTRIBUTE from the maxon::nodes::NODESPACE.

Note
The Cinema 4D standard renderer has the ID 0.
// This example gets the active node space and prints all data to the console.
// access node space
const maxon::Id activeNodeSpace = GetActiveNodeSpaceId();
maxon::nodes::NodeSpaceRef nodeSpace = maxon::nodes::MaterialNodeSpaces::Get(activeNodeSpace);
// get all data.
maxon::DataDictionary spaceData = nodeSpace.GetData();
for (const auto& data : spaceData)
{
const maxon::Data key = data.first.GetCopy() iferr_return;
const maxon::Data value = data.second.GetCopy() iferr_return;
const maxon::DataType type = value.GetType();
DiagnosticOutput("Key: @, Value: @ (@)", key, value, type);
}
// get node space name
const maxon::String name = spaceData.Get(maxon::nodes::NODESPACE::SPACENAME) iferr_return;
DiagnosticOutput("Node Space Name: @", name);
PyObject * value
Definition: abstract.h:715
PyObject * key
Definition: abstract.h:289
const char const char * name
Definition: abstract.h:195
Definition: datatypebase.h:1199
Definition: datatypebase.h:772
Definition: string.h:1235
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
const Class< R > & Get(const Id &cls)
Definition: objectbase.h:2073
PyObject ** type
Definition: pycore_pyerrors.h:34
#define iferr_return
Definition: resultbase.h:1519
// This example gets the list of all supported renderers for each node space.
// loop node spaces
for (const auto& it : maxon::nodes::MaterialNodeSpaces::GetEntries())
{
const maxon::nodes::NodeSpaceRef nodeSpace = it;
// get node space data
const maxon::DataDictionary spaceData = nodeSpace.GetData();
// get node space ID
const maxon::Id spaceID = spaceData.GetOrDefault(maxon::nodes::NODESPACE::SPACEID);
DiagnosticOutput("Node Space ID: @", spaceID);
// get node space renderers
const maxon::Array<maxon::Int> renderer = spaceData.GetOrDefault(maxon::nodes::NODESPACE::RENDERERS);
for (const maxon::Int& id : renderer)
{
DiagnosticOutput("Renderer: @", id);
}
}
Definition: datadictionary.h:11
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:188