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 PluginEnd ()
 
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,
  i 
)

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 ( )

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;
}
Bool PluginStart()
GeResource g_resource
Global resources for Cinema 4D.
Bool Init()
maxon::Bool Bool
Definition: ge_sys_math.h:55
Returns
true if the plugin was loaded, otherwise false.

◆ PluginEnd()

void PluginEnd ( )

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()).
To free complex structures from other modules see C4DPL_ENDACTIVITY::
For example:

void PluginEnd()
{
FreeMyPlugin();
}
void PluginEnd()

◆ 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)
{
return true;
case MY_MESSAGE:
...
return true;
}
return false;
}
Bool PluginMessage(Int32 id, void *data)
#define SetPluginPriority(data, i)
Definition: c4d_plugin.h:198
maxon::Int32 Int32
Definition: ge_sys_math.h:60
#define C4DPL_INIT_PRIORITY_PLUGINS
Base priority for plugins.
Definition: c4d_plugin.h:56
#define C4DMSG_PRIORITY
Called to query plugins about their loading time priority. Answer with SetPluginPriority(),...
Definition: c4d_plugin.h:38
Parameters
[in]idThe message ID. Built-in ones are: C4DPL_MESSAGES
[in]dataThe message data.
Returns
true if the message was consumed, otherwise false.