c4d.plugins.ToolData
¶
A data class for creating tool plugins. Use
RegisterToolPlugin()
to register the tool plugin.
See also
Py-LiquidPainter plugin example.
c4d.plugins.
ToolData
¶
ToolData.GetDDescription()
ToolData.GetDParameter()
ToolData.SetDParameter()
ToolData.GetDEnabling()
ToolData.TranslateDescID()
c4d.plugins.BaseData
ToolData.
InitTool
(
self
,
doc
,
data
,
bt
)
¶
Override - Called each time the tool is selected.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if there was no error, otherwise False . |
ToolData.
FreeTool
(
self
,
doc
,
data
)
¶
Override - Called each time the user chooses another tool.
Parameters: |
|
---|
ToolData.
InitDefaultSettings
(
self
,
doc
,
data
)
¶
Called to let you initialize the default tool settings in data .
Parameters: |
|
---|
ToolData.
MouseInput
(
self
,
doc
,
data
,
bd
,
win
,
msg
)
¶
Override - Called when the user clicks with the mouse in any of the editors views.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
False if a problem occured during this function. |
ToolData.
KeyboardInput
(
self
,
doc
,
data
,
bd
,
win
,
msg
)
¶
Override - Called when the user types something in any of the editors views.
Note
Make sure that you only use this function when the user is somehow working with your plugin, so that other plugins can also use this hook when it is their turn.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
False if a problem occured during this function. |
ToolData.
GetState
(
self
,
doc
)
¶
Called to check if the tool should be enabled, checked or not.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document the tool is being used in. | ||||
---|---|---|---|---|---|
Return type: | int | ||||
Returns: |
The return flags:
|
ToolData.
GetCursorInfo
(
self
,
doc
,
data
,
bd
,
x
,
y
,
bc
)
¶
Called when the cursor is over editor window to get the state of the mouse pointer. You can set the bubble help and cursor using for example:
bc.SetString(c4d.RESULT_BUBBLEHELP, "My Tools Help") bc.SetLong(c4d.RESULT_CURSOR, c4d.MOUSE_POINT_HAND)
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
False if a problem occured during this function. |
ToolData.
Draw
(
self
,
doc
,
data
,
bd
,
bh
,
bt
,
flags
)
¶
Called when the editor view is updated so you can display graphics for your tool in the view.
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Return type: |
int |
||||||||
Returns: |
The values for this are:
|
ToolData.
AllocSubDialog
(
self
,
bc
)
¶
Called to get a GUI for the Active Tool window. Return an instance of your tool’s dialog.
Parameters: | bc ( c4d.BaseContainer ) – Currently not used. |
---|---|
Return type: | c4d.gui.SubDialog |
Returns: | The allocated sub dialog. |
ToolData.
Message
(
self
,
doc
,
data
,
type
,
t_data
)
¶
Lets you get messages for the tool. For example description messages such as MSG_DESCRIPTION_COMMAND are sent here.
Parameters: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns: |
Depends on the message type. |
ToolData.
GetDDescription
(
self
,
doc
,
data
,
description
,
flags
)
¶
New in version R18.011.
Called to add parameters to the description for the tool. Modify the passed description as needed and return the appropriate flags.
Note
If only a description resource is used it is not needed to overload
GetDDescription()
.
See also
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool or tuple(bool, int) |
||||||||||||||
Returns: |
One of these options: bool: True if successful, otherwise False . Useful in error state to only return False . tuple(bool, int): The status ( True if successful, otherwise False ) and description flags ( DESCFLAGS_DESC ). |
ToolData.
GetDParameter
(
self
,
doc
,
data
,
id
,
flags
)
¶
New in version R18.011.
Called to override the reading of description parameters. Necessary for parameters that are not simply stored in the tool’s container e.g. class members. Return the parameter data and the appropriate flags if the right id is provided.Note
If only a description resource is used it is not needed to overload
GetDParameter()
.
See also
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool or tuple(bool, any, int) |
||||||||||||||
Returns: |
One of these options: bool: True if successful, otherwise False . Useful in error state to only return False . tuple(bool, any, int): The status ( True if successful, otherwise False ), parameter data and description flags ( DESCFLAGS_DESC ). |
ToolData.
SetDParameter
(
self
,
doc
,
data
,
id
,
t_data
,
flags
)
¶
New in version R18.011.
Called to override the writing of parameters. Read the passed t_data if the right id is provided, store the data and return the appropriate flags.
Note
If only a description resource is used it is not needed to overload
SetDParameter()
.
See also
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool or tuple(bool, int) |
||||||||||||||
Returns: |
One of these options: bool: True if successful, otherwise False . Useful in error state to only return False . tuple(bool, int): The status ( True if successful, otherwise False ) and description flags ( DESCFLAGS_DESC ). |
ToolData.
GetDEnabling
(
self
,
doc
,
data
,
id
,
t_data
,
flags
,
itemdesc
)
¶
New in version R18.011.
Called to let decide which parameters should be enabled or disabled (ghosted). This can be used both for parameters that are stored in the tool’s container and for custom parameters.
Just read the passed t_data if the right id was provided, and return True to enable the parameter or False to disable it depending on the value.
And if the passed id element is not processed, include a call to the base class method as last return:
return ToolData.GetDEnabling(self, doc, data, id, t_data, flags, itemdesc)
See also
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the parameter should be enabled, otherwise False . Note It is recommended to include a call to the base class method as last return. |
ToolData.
TranslateDescID
(
self
,
doc
,
data
,
id
)
¶
New in version R18.011.
Called by the Attribute Manager for every tool and every description ID. Gives the opportunity to route a description ID in the description of a tool to another one.See also
Parameters: |
|
---|---|
Return type: | |
Returns: |
One of these options: bool: True if successful, otherwise False . Useful in error state to only return False . tuple(bool,
DescID
,
C4DAtom
): The status (
True
if successful, otherwise
False
), target description ID and tool.
|