c4d_plugin.h File Reference

Classes

struct  C4DPL_CommandLineArgs
 
struct  C4DPL_EditImage
 
struct  C4DPL_DeviceChange
 
struct  C4DPL_NetRenderResult
 

Macros

#define C4DPL_VERSION
 
#define C4DPL_ERROR
 
#define C4DPL_ERROR_VERSION
 
#define C4DPL_INIT_SYS
 
#define C4DPL_INIT
 
#define C4DPL_END
 
#define C4DPL_INIT_VERSION
 
#define C4DPL_MESSAGE
 
#define C4DMSG_PRIORITY
 
#define C4DPL_BUILDMENU
 
#define C4DPL_INIT_PRIORITY_XTENSIONS
 
#define C4DPL_INIT_PRIORITY_OBJECTS
 
#define C4DPL_INIT_PRIORITY_MODELING
 
#define C4DPL_INIT_PRIORITY_SHADER
 
#define C4DPL_INIT_PRIORITY_ADVANCEDRENDER
 
#define C4DPL_INIT_PRIORITY_MOCCA
 
#define C4DPL_INIT_PRIORITY_NEWMAN
 
#define C4DPL_INIT_PRIORITY_SLA
 
#define C4DPL_INIT_PRIORITY_MODULES
 
#define C4DPL_INIT_PRIORITY_PLUGINS
 
#define C4DPL_STARTACTIVITY
 
#define C4DPL_ENDACTIVITY
 
#define C4DPL_COMMANDLINEARGS
 
#define C4DPL_ENDPLUGINACTIVITY0
 
#define C4DPL_ENDPLUGINACTIVITY1
 
#define C4DPL_ENDPLUGINACTIVITY2
 
#define C4DPL_CHANGEDSECURITYTOKEN
 
#define C4DPL_SHUTDOWNTHREADS
 
#define C4DPL_LAYOUTCHANGED
 
#define C4DPL_RELOADPYTHONPLUGINS
 
#define C4DPL_EDITIMAGE
 
#define C4DPL_ENDPROGRAM
 
#define C4DPL_DEVICECHANGE
 
#define C4DPL_NETWORK_CHANGE
 
#define C4DPL_SYSTEM_SLEEP
 
#define C4DPL_SYSTEM_WAKE
 
#define C4DPL_PROGRAM_STARTED
 
#define C4DPL_REGISTERPYPLUG
 
#define C4DPL_NETRENDERRESULT
 
#define SetPluginPriority(data, i)
 

Functions

Bool PluginStart (void)
 
void PluginEnd (void)
 
Bool PluginMessage (Int32 id, void *data)
 

Macro Definition Documentation

◆ C4DPL_VERSION

#define C4DPL_VERSION

The version of Cinema 4D plugin API.

◆ SetPluginPriority

#define SetPluginPriority (   data,
 
)

Sets the priority for a plugin.

Parameters
[in]dataThe message data of the priority message.
[in]iThe plugin priority. Build the priority from one of the base priorities: C4DPL_INIT_PRIORITY

Function Documentation

◆ PluginStart()

Bool PluginStart ( void  )

Called when a plugin is loaded from Cinema 4D. Think of it as the equivalent to the usual main() function.
Here register all the plugin types and initialize them.
For example, the basics needed are:

{
if (!g_resource.Init())
return false; // Do not start plugin without resource
if (!RegisterMyPlugin())
return false;
return true;
}
Returns
true if the plugin was loaded, otherwise false.

◆ PluginEnd()

void PluginEnd ( void  )

Called when the plugin is unloaded from Cinema 4D.
Here free the plugin registrations and any resources which are not owned or already freed by other plugins (see PluginMessage()). For example:

void PluginEnd(void)
{
FreeMyPlugin();
}

◆ PluginMessage()

Bool PluginMessage ( Int32  id,
void *  data 
)

Called to receive plugin messages.
These can either be from Cinema 4D or from other plugins via GePluginMessage(). Here is an example:

Bool PluginMessage(Int32 id, void *data)
{
switch (id)
{
SetPriority(data, C4DPL_INIT_PRIORITY_PLUGINS+100);
return true;
case MY_MESSAGE:
...
return true;
}
return false;
}
Parameters
[in]idThe message ID. Built-in ones are: C4DPL_MESSAGES
[in]dataThe message data.
Returns
true if the message was consumed, otherwise false.