Share

Message API - Arnold for Cinema4d

The Message API can be used to interact with C4DtoA from your plugin without adding any extra files or libraries to your project. The API operates via MSG_BASECONTAINER type messages which can be sent to Cinema 4D nodes to query data and execute specific actions, or handle in your node's Message() function to provide data to C4DtoA.

The Message API contains the following modules:

  • Material Message API
  • Instancer Message API

Sending Messages

Sending a message to a node requires setting up a BaseContainer with some special data:

  • C4DTOA_MSG_TYPE (1000): Message id.
  • C4DTOA_MSG_PARAM1 - C4DTOA_MSG_PARAM5 (2001 - 2005): Message parameters (optional).
  • C4DTOA_MSG_RESP1 - C4DTOA_MSG_RESP4 (2011 - 2014): Return value if available.

Then the message has to be sent as a MSG_BASECONTAINER message.

// send message
BaseContainer msg;
msg.SetInt32(C4DTOA_MSG_TYPE, C4DTOA_MSG_GET_VERSION);
material->Message(MSG_BASECONTAINER, &msg);

// process return value
String version = msg.GetString(C4DTOA_MSG_RESP1)

Available message ids are listed in the C4DtoA/api/message_api/ids.h header file.

Info: Examples can be found in the C4DtoA/api/examples/c4dtoa_message_api_example project.

Was this information helpful?