Published Objects Implementation

About

A published object can be implemented in a source code file within a plugin. This way the implementation can be kept private.

Implementation

The implementation of a published object is defined with the MAXON_DECLARATION_REGISTER attribute. It associates the given published object with the object created within the registration function.

Note
The registration function is called on Cinema 4D startup.
Warning
If a published object is defined multiple times, all definitions will be discarded.
// This example shows the implementation of a published object.
// Within the scope of MAXON_DECLARATION_REGISTER() the
// published object is created and handed over to the program.
{
// create object
// configure object
atom._protonCnt = 6;
atom._neutronCnt = 6;
atom._electronCnt = 6;
// return the object
return atom;
}
[published_objects_declaration]
Definition: example_declarations.h:23
#define atom
Definition: graminit.h:72
#define MAXON_DECLARATION_REGISTER(...)
Definition: module.h:923

The implementation of an interface is registered and shared as a published object using the MAXON_COMPONENT_OBJECT_REGISTER attribute. See Interface Implementation.

Further Reading