C4DtoA is shipped with an API for 3rd party developers to write modules (basically custom translators).

The API is a static library located in the $C4D_INSTALL/plugins/C4DtoA/api folder. To add it to your project you have to add the following settings:

In the code just simply include the c4dtoa_api header.

#include "c4dtoa_api.h"

 

If you want to use any C4DtoA node or parameter ids:

  1. Add the following paths to your header search path:
  2. Include c4dtoa_symbols.h or any description or dialog resource header file (e.g. ainode_options.h).

The C4DtoA module does not work properly if it's located in a subfolder named c4dtoa (e.g. /Applications/MAXON/CINEMA 4D R18/plugins/myplugin/c4dtoa/mymodule.dylib).

UI framework

C4DtoA has its own UI generator framework which utilizes Arnold's node structure and the  Arnold Metadata API. This means widgets of Arnold node parameters are generated automatically by the type and metadata of the parameters and parameter values are automatically exported.

Parameter ids

Each parameter has a unique id which is generated from the node entry name and parameter name. To generate an id use the paramid_generator tool of the API. For example, run the following command to get the id of the Kd_color parameter of the standard node:

$C4D_INSTALL/plugins/C4DtoA/api/bin/paramid_generator standard.Kd_color

Resource file

AIPARAM C4DAIP_STANDARD_KD_COLOR {}

Parameters which are not listed in the resource file will be added to a tab called "Unsorted" until you did not hide them directly in the metadata file.

NOTE: 3rd party custom widgets cannot be added via the API at the moment.

Labels

Labels are generated from the name of the parameter by default. Sometimes we want custom labels. For example, we want to display Diffuse color instead of Kd color. In this case, we have to define the label in the .str file just like by a normal C4D parameter.

C4DAIP_STANDARD_KD_COLOR    "Diffuse color";

Metadata file (.mtd)

Some special flags which used by the framework can be defined in the metadata file (.mtd).

Node flags:

Parameter flags:

An example definition:

[node standard]
 c4d.classification      STRING  "surface"
 c4d.menu                STRING  "shader/surface"
 c4d.command_id          INT     1031853

 [attr Kd]
     c4d.gui_type        INT     6

 [attr direct_diffuse]
     min                 FLOAT   0.0
     softmax             FLOAT   1.0 
     c4d.step            FLOAT   0.01