This documentation is for the free plugin Py4D in CINEMA 4D R11.5 and not for the C4DSDK of Python in CINEMA 4D R12. For R12, please visit PluginCafe.com
To get an overview of the class members, check out the diagram.
//Plugin Data
//Registered plugins
//Register Methods
Note
To make this work, __res__ must be defined in your global scope.
Load a string and replace the first ‘#’ with the placeholder string.
In CINEMA 4D there is a convention that in strings ‘#’ is a placeholder for dynamic parts (this allows you to translate a whole sentence as sentence structure and word placement may be reverted in other language)
For example: If the string is named: “loading of file ‘#’ failed” then you can pass the actual filename (as string) as p1 and you’ll get the desired result.
| Parameters: |
|
|---|---|
| Return type: | str |
| Returns: | The completed string. |
Gets the tool data container for the tool with ID pluginid.
| Parameters: |
|
|---|---|
| Return type: | BaseContainer |
| Returns: | Tool data container. |
Retrieves a container stored with SetWorldPluginData() from the CINEMA 4D preferences. This can be used by any plugin to store preferences.
| Parameter: | id (int) – The plugin ID that the container should be associated with. |
|---|---|
| Return type: | BaseContainer |
| Returns: | The retrieved container |
Stores a container in the CINEMA 4D preferences. Can be used by any plugin to store preferences.
| Parameters: |
|
|---|---|
| Return type: | bool |
| Returns: | True if the container was stored, otherwise False. |
Returns the first plugin of Cinema 4D.
| Return type: | BasePlugin |
|---|---|
| Returns: | The first plugin. |
Returns the BasePlugin find by id.
| Parameters: |
|
|---|---|
| Return type: | BasePlugin |
| Returns: | The plugin. |
Browses recursively through the plugin list looking for plugin of the specified type. For example, to find all bitmap savers you can write:
dest = plugins.FilterPluginList(plugins.C4DPL_BITMAPSAVER, True)
| Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | list of BasePlugin |
||||||||||||||||||||||||||||||||||||||||||
| Returns: | The list. |
Registers a ToolData plugin:
PLUGIN_ID = 1234567890
desc = plugins.GeLoadString(MY_TOOL_DESC)
plugins.RegisterToolPlugin(PLUGIN_ID, "MyTool", 0, None, desc, MyTool())
| Parameters: |
|
||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | bool |
||||||||||||||||
| Returns: | True if the registration was succesful. |
Registers a CommandData plugin:
PLUGIN_ID = 1234567890
desc = plugins.GeLoadString(MY_TOOL_DESC)
plugins.RegisterCommandPlugin(PLUGIN_ID, "MyCommand", 0, None, desc, MyCommand())
| Parameters: |
|
||
|---|---|---|---|
| Return type: | bool |
||
| Returns: | True if the registration was succesful. |
Registers a MessageData plugin:
PLUGIN_ID = 987665431
plugins.RegisterMessagePlugin(PLUGIN_ID, "MyMessagePlugin", 0, MyMessagePlugin())
| Parameters: |
|
||
|---|---|---|---|
| Return type: | bool |
||
| Returns: | True if the registration was succesful. |
Registers a BitmapSaverData plugin:
PLUGIN_ID = 1234567890
desc = plugins.GeLoadString(MY_SAVER_DESC)
RegisterBitmapSaverPlugin(PLUGIN_ID, "MySaver", plugins.PLUGINFLAG_BITMAPSAVER_SUPPORT_8BIT|plugins.PLUGINFLAG_BITMAPSAVER_FORCESUFFIX, MySaver(), ".my")
| Parameters: |
|
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | bool |
||||||||||||||||||
| Returns: | True if the registration was succesful. |
Registers a BitmapLoaderData plugin.
| Parameters: |
|
||
|---|---|---|---|
| Return type: | bool |
||
| Returns: | True if the registration was succesful. |
Note
To make this work, __res__ must be defined in your global scope.
Registers a TagData plugin:
dir, file = os.path.split(__file__)
bmp = c4d.BaseBitmap()
bmp.InitWith(os.path.join(dir, "res", "image_name.tif"))
plugins.RegisterTagPlugin(id=PLUGIN_ID, name="MyTag", obj=MyTag,
description="your_identifier", icon=bmp,
info=plugins.TAG_MULTIPLE|plugins.TAG_EXPRESSION|plugins.TAG_VISIBLE)
| Parameters: |
|
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | bool |
||||||||||
| Returns: | True if the registration was succesful. |
Note
To make this work, __res__ must be defined in your global scope.
Registers an ObjectData plugin.
| Parameters: |
|
||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Return type: | bool |
||||||||||||||||||||||
| Returns: | True if the registration was succesful. |
Note
To make this work, __res__ must be defined in your global scope.
Registers a SceneLoaderData plugin.
| Parameters: |
|
||||
|---|---|---|---|---|---|
| Return type: | bool |
||||
| Returns: | True if the registration was succesful. |
Note
To make this work, __res__ must be defined in your global scope.
Registers a SceneSaverData plugin.
| Parameters: |
|
||
|---|---|---|---|
| Return type: | bool |
||
| Returns: | True if the registration was succesful. |