NodeSpaceInterface Class Reference

#include <node_spaces.h>

Inheritance diagram for NodeSpaceInterface:

Detailed Description

NodeSpaceInterface defines a hook into the node-based material system. Each node material provides a container which can be populated under a specific maxon::nodes::NODESPACE::SPACEID. Entries in this container store node graphs and provide connections to visible functionality of Cinema4d.

Components implementing this interface are expected to make such connections known by providing appropriate attributes in the GetData() DataDictionary, such as

  • a translated name
  • a set of renderers that support the node graph stored under the space id
  • a provider for preview thumbnails
  • a provider for viewport representation
  • a node system along with instaniable nodes ...

Node graphs are stored in c4d files under the space id. If this space is unknown when loading the scene, e.g. because the plugin is missing, scenes can be resaved without data loss.

It is recommended to initialize the space once and keep the data unchanged over the long lifetime.

Public Types

using DataChangedObserver = Delegate< void(const DataDictionary &data)>

Public Member Functions

MAXON_METHOD Result< void > Init (DataDictionary data)
MAXON_METHOD DataDictionary GetData () const
MAXON_METHOD Result< GenericDataAddDataChangedObserver (DataChangedObserver &&observer, Bool notifyDuringRegistration)

Protected Member Functions

MAXON_METHOD void SetData (const DataDictionary &data)

Private Member Functions

 MAXON_INTERFACE (NodeSpaceInterface, MAXON_REFERENCE_NORMAL, "net.maxon.nodes.interface.nodespace")

Member Typedef Documentation

◆ DataChangedObserver

using DataChangedObserver = Delegate<void(const DataDictionary& data)>

This callback is executed if the space's data has changed, e.g. the name. A copy-on-write state of the current data is provided.

[in]dataThe current data container.

Member Function Documentation


MAXON_INTERFACE ( NodeSpaceInterface  ,

◆ Init()

MAXON_METHOD Result<void> Init ( DataDictionary  data)

Initializes the components and assigns meaningful data that can be queried via GetData().

◆ GetData()

MAXON_METHOD DataDictionary GetData ( ) const

Fetches the data container and expects appropriate values for maxon::nodes::NODESPACE attributes.

◆ AddDataChangedObserver()

MAXON_METHOD Result<GenericData> AddDataChangedObserver ( DataChangedObserver &&  observer,
Bool  notifyDuringRegistration 

This is currently unused: No functionality monitors changes to an already registered space.

Adds an observer to changes for the space's data container.

[in]observerThe delegate to be called on data change.
[in]notifyDuringRegistrationIf true, the current data state is immediately dispatched to the delegate, before returning from AddDataChangedObserver.
The ticket to the observing delegate. Releasing it will auto-unsubscribe.

◆ SetData()

MAXON_METHOD void SetData ( const DataDictionary &  data)

Updates the space's data and notifiers all registered DataChangedObserver's.

[in]dataThe new data container.