#include <node_spaces.h>
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
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< GenericData > | AddDataChangedObserver (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") | |
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] | data | The current data container. |
|
private |
MAXON_METHOD Result<void> Init | ( | DataDictionary | data | ) |
Initializes the components and assigns meaningful data that can be queried via GetData().
MAXON_METHOD DataDictionary GetData | ( | ) | const |
Fetches the data container and expects appropriate values for maxon::nodes::NODESPACE attributes.
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] | observer | The delegate to be called on data change. |
[in] | notifyDuringRegistration | If true, the current data state is immediately dispatched to the delegate, before returning from AddDataChangedObserver. |
|
protected |
Updates the space's data and notifiers all registered DataChangedObserver's.
[in] | data | The new data container. |