c4d.plugins
¶
Follow me to the Inheritance diagramm .
This document contains classes to create your own plugins. To get information about the plugin structure, check out Plugin Structure .
GetWorldPluginData()
SetWorldPluginData()
ReadRegInfo()
WriteRegInfo()
ReadPluginInfo()
WritePluginInfo()
RegisterCommandPlugin()
RegisterTagPlugin()
RegisterFalloffPlugin()
RegisterMessagePlugin()
RegisterShaderPlugin()
RegisterObjectPlugin()
RegisterNodePlugin()
RegisterToolPlugin()
RegisterSculptBrushPlugin()
RegisterSceneSaverPlugin()
RegisterSceneLoaderPlugin()
RegisterBitmapSaverPlugin()
RegisterBitmapLoaderPlugin()
RegisterPreferencePlugin()
NEW
RegisterManagerInformation()
RegisterDescription()
c4d.plugins.
GeLoadString
(
id
[
,
p1
[
,
p2
[
,
p3
[
,
p4
]
]
]
]
)
¶
Note
To use this function, __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. |
c4d.plugins.
GetToolData
(
doc
,
plugind
)
¶
Gets the tool data container for the tool with ID pluginid .
Parameters: |
|
---|---|
Return type: | |
Returns: |
Tool data container. |
c4d.plugins.
RegisterPluginHelpCallback
(
pluginid
,
callback
)
¶
New in version R19.
Registers a callback for plugin help support.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
c4d.plugins.
GetWorldPluginData
(
id
)
¶
Retrieves a container stored with
SetWorldPluginData()
from the Cinema 4D preferences. This can be used by any plugin to store preferences.
See also
This script that shows how to effectively access and change the settings of an importer/exporter.
Parameters: | id ( int ) – The plugin ID that the container should be associated with. |
---|---|
Return type: | c4d.BaseContainer |
Returns: | The retrieved container |
c4d.plugins.
SetWorldPluginData
(
id
,
bc
[
,
add=False
]
)
¶
Stores a container in the Cinema 4D preferences. Can be used by any plugin to store preferences.
See also
This script that shows how to effectively access and change the settings of an importer/exporter.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the container was stored, otherwise False . |
c4d.plugins.
ReadRegInfo
(
pluginid
,
size
)
¶
Reads user-specific data (e.g. login data for a user account).
Note
Use this method instead of
WritePluginInfo()
in a license server environment.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The data buffer. |
c4d.plugins.
WriteRegInfo
(
pluginid
,
buffer
)
¶
Writes user-specific data (e.g. login data for a user account).
Note
Use this method instead of
WritePluginInfo()
in a license server environment.
Parameters: |
|
---|
c4d.plugins.
ReadPluginInfo
(
pluginid
,
size
)
¶
Read private serial information for a plugin. Cinema 4D will store this data encrypted.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The data buffer. |
c4d.plugins.
WritePluginInfo
(
pluginid
,
buffer
)
¶
Write private serial information for a plugin. Cinema 4D will store this data encrypted.
Parameters: |
|
---|
c4d.plugins.
GetFirstPlugin
(
)
¶
Returns the first plugin of Cinema 4D.
Return type: | c4d.plugins.BasePlugin |
---|---|
Returns: | The first plugin. |
c4d.plugins.
FindPlugin
(
id
[
,
type=0
]
)
¶
Returns the
BasePlugin
found by id.
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: | |||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
The plugin. |
c4d.plugins.
FilterPluginList
(
type
,
sortbyname
)
¶
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(c4d.PLUGINTYPE_BITMAPSAVER, True)
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
list of
|
||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
The list. |
c4d.plugins.
RemovePlugin
(
plug
)
¶
Private.
c4d.plugins.
RegisterToolPlugin
(
id
,
str
,
info
,
icon
,
help
,
dat
)
¶
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. |
c4d.plugins.
RegisterSculptBrushPlugin
(
id
,
str
,
info
,
icon
,
help
,
sculptparams
,
dat
,
res
)
¶
New in version R16.021.
Registers a
SculptBrushToolData
plugin.
Parameters: |
|
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterCommandPlugin
(
id
,
str
,
info
,
icon
,
help
,
dat
)
¶
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. |
c4d.plugins.
RegisterFalloffPlugin
(
id
,
str
,
info
,
g
,
description
[
,
res
]
)
¶
Registers a
FalloffData
plugin:
Parameters: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterMessagePlugin
(
id
,
str
,
info
,
dat
)
¶
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. |
c4d.plugins.
RegisterBitmapSaverPlugin
(
id
,
str
,
info
,
dat
,
suffix
)
¶
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. |
c4d.plugins.
RegisterBitmapLoaderPlugin
(
id
,
str
,
info
,
dat
)
¶
Registers a
BitmapLoaderData
plugin.
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterTagPlugin
(
id, str, info, g, description, icon[, disklevel=0][, res]
)
¶
Note
To use this function, __res__ must be defined in your global scope.
Registers a
TagData
plugin:
dir, file = os.path.split(__file__) bmp = c4d.bitmaps.BaseBitmap() bmp.InitWith(os.path.join(dir, "res", "image_name.tif")) plugins.RegisterTagPlugin(id=PLUGIN_ID, str="MyTag", g=MyTag, description="your_identifier", icon=bmp, info=c4d.TAG_MULTIPLE|c4d.TAG_EXPRESSION|c4d.TAG_VISIBLE)
Parameters: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterShaderPlugin
(
id, str, info, g, description[, disklevel][, res]
)
¶
Registers a
ShaderData
plugin.
Parameters: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterObjectPlugin
(
id, str, g, description, info, icon[, disklevel][, res][, groupname[, group]]
)
¶
Note
To use this function, __res__ must be defined in your global scope.
Registers an
ObjectData
plugin.
Parameters: |
|
||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterNodePlugin
(
id
,
str
,
info
,
g
,
icon
[
,
disklevel
]
)
¶
Registers a
NodeData
plugin.
Note
Normally you won’t use this function directly, but rather the specific registration functions for each
NodeData
child class.
Parameters: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterPreferencePlugin
(
id
,
g
,
name
,
description
,
parentid
,
sortid
)
¶
New in version R19.
Registers a new preference in the Cinema 4D preferences dialog.
Parameters: |
|
---|
c4d.plugins.
RegisterManagerInformation
(
id
,
str
,
info
)
¶
Registers manager information for use when registering shortcuts with
AddShortcut()
.
Parameters: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterSceneLoaderPlugin
(
id
,
str
,
g
,
info
,
description
[
,
res
]
)
¶
Note
To use this function, __res__ must be defined in your global scope.
Registers a
SceneLoaderData
plugin.
Parameters: |
|
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterSceneSaverPlugin
(
id
,
str
,
g
,
info
,
description
,
suffix
[
,
res
]
)
¶
Note
To use this function, __res__ must be defined in your global scope.
Registers a
SceneSaverData
plugin.
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||
Returns: |
True if the registration was succesful. |
c4d.plugins.
RegisterDescription
(
id
,
str
[
,
res
]
)
¶
New in version R16.021.
Registers a description for a plugin ID.
Note
Not needed for plugin types whose Register() functions have a description parameter.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the registration was succesful. |