#include <c4d_tooldata.h>
A data class for creating tool plugins.
Use RegisterToolPlugin() to register a tool plugin.
- Note
- To make modeling tools that support the Transform/Apply buttons use DescriptionToolData instead.
|
Bool | RegisterToolPlugin (Int32 id, const maxon::String &str, Int32 info, BaseBitmap *icon, const maxon::String &help, ToolData *dat) |
|
Bool | RegisterPyToolPlugin (Int32 id, const maxon::String &str, Int32 info, BaseBitmap *icon, const maxon::String &help, ToolData *dat, GeResource *res) |
|
|
virtual Bool | GetDDescription (const BaseDocument *doc, const BaseContainer &data, Description *description, DESCFLAGS_DESC &flags) const |
|
virtual Bool | GetDParameter (const BaseDocument *doc, const BaseContainer &data, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const |
|
virtual Bool | SetDParameter (BaseDocument *doc, BaseContainer &data, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags) |
|
virtual Bool | GetDEnabling (const BaseDocument *doc, const BaseContainer &data, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc) const |
|
virtual Bool | TranslateDescID (BaseDocument *doc, BaseContainer &data, const DescID &id, DescID &res_id, C4DAtom *&res_at) |
|
◆ AllocDialog()
◆ FreeDialog()
virtual void FreeDialog |
( |
CDialog * |
cd | ) |
|
|
privatevirtual |
◆ InitTool()
Called each time the tool is selected.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bt | The calling thread. Can be nullptr. Cinema 4D owns the pointed thread. |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData, BrushToolData, and DescriptionToolData.
◆ FreeTool()
◆ MouseInput()
Called when the user clicks with the mouse in any of the editors views.
Use GetToolScale to make adjustments relative to the view size.
- Note
- If a tool allows the user to move, rotate or scale the currently selected object, then it should call GeSyncMessage(EVMSG_ASYNCEDITORMOVE) so that managers can update their position fields during the drag.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bd | The active editor view. Cinema 4D owns the pointed base draw. |
[in] | win | The window for the active editor view. Cinema 4D owns the pointed editor window. |
[in] | msg | The mouse message container. See Input Events. |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData, and BrushToolData.
◆ KeyboardInput()
Called when the user types something in any of the editors views.
- Note
- Make sure this function is used only when the user is somehow working with the tool plugin, so that other plugins can also use this hook when it is their turn.
- Warning
- Always returning true here will block all keyboard use.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bd | The active editor view. Cinema 4D owns the pointed base draw. |
[in] | win | The window for the active editor view. Cinema 4D owns the pointed editor window. |
[in] | msg | The keyboard message container. See Input Events. |
- Returns
- true if the keyboard event was used, false if it should be passed along.
Reimplemented in SculptBrushToolData.
◆ Draw()
Called when the editor view is updated to display graphics for the tool in the view.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bd | The editor's view. The caller owns the pointed view. |
[in] | bh | The helper for the editor's view. The caller owns the pointed base draw helper. |
[in] | bt | The calling thread. Can be nullptr. Cinema 4D owns the pointed thread. |
[in] | flags | The tool draw flags: TOOLDRAWFLAGS |
- Returns
- The tool draw result: TOOLDRAW
Reimplemented in SculptBrushToolData.
◆ DisplayControl()
Called to set information about how the active object should be displayed.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | op | The active object. Cinema 4D owns the pointed object. |
[in] | chainstart | The start of the object chain. Cinema 4D owns the pointed object. |
[in] | bd | The active editor view. Cinema 4D owns the pointed base draw. |
[in] | bh | The helper for the editor's view. The caller owns the pointed view helper. |
[in] | cds | The display control settings. |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData.
◆ InitDisplayControl()
Called to initialize resources for the display control used in DisplayControl.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bd | The active editor view. Cinema 4D owns the pointed base draw. |
[in] | active | The active objects array. Cinema 4D owns the pointed array. |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData.
◆ FreeDisplayControl()
virtual void FreeDisplayControl |
( |
| ) |
|
|
virtual |
◆ AllocSubDialog()
Called to get the sub-dialog for the Active Tool window.
Return here an instance of the tool's sub-dialog.
- Parameters
-
[in] | bc | Currently not used. |
- Returns
- The allocated sub-dialog. Cinema 4D owns the pointed sub-dialog.
◆ DoCommand()
Called by SendModelingCommand to perform the command in mdat.
- Parameters
-
[in] | mdat | The data for the modeling command to perform. |
- Returns
- true if successful, otherwise false.
◆ GetCursorInfo()
Called when the cursor is over the editor views to get the state of the mouse pointer.
Set the bubble help and cursor, for example:
@ RESULT_BUBBLEHELP
String Bubble help text.
Definition: gui.h:564
@ RESULT_CURSOR
Int32 Mouse cursor: MOUSE
Definition: gui.h:563
static const Int32 MOUSE_POINT_HAND
Point hand cursor.
Definition: ge_prepass.h:2711
- Note
- Make sure this function is used only when the user is somehow working with the scene hook plugin, so that other plugins can also use this hook when it is their turn.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | bd | The active editor view. Cinema 4D owns the pointed base draw. |
[in] | x | The X coordinate of the mouse cursor relative to the top-left of the active editor view. |
[in] | y | The Y coordinate of the mouse cursor relative to the top-left of the active editor view. |
[in] | bc | The container to store the cursor information in: BFM_GETCURSORINFO_RESULT |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData, and BrushToolData.
◆ GetResourceSymbol()
virtual const String GetResourceSymbol |
( |
| ) |
const |
|
virtual |
Called to get the description resource symbol for the tool.
- Returns
- The name of the description resource file to use for the plugin without .res extension, for example "Toolname".
The name has to be unique, i.e. "Tdisplay" cannot be used for two different descriptions. See Description Resource for more information.
Reimplemented in DescriptionToolData.
◆ GetState()
Called to check if the tool should be enabled or not.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
- Returns
- A combination of the 3 command flags: CMD_ENABLED CMD_VALUE CMD_HIDDEN.
Reimplemented in SculptBrushToolData.
◆ InitDefaultSettings()
◆ GetDDescription()
Called to add parameters to the description for the tool.
Modify the passed description as needed, set the appropriate flags and then make sure to include a call to the parent at the end:
return SUPER::GetDescription(data, description,
flags, parentdescription);
PyCompilerFlags * flags
Definition: ast.h:14
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in,out] | description | The node's description to add the parameters to. Cinema 4D owns the pointed description. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_DESC |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented in SculptBrushToolData, BrushToolData, and DescriptionToolData.
◆ GetDParameter()
Called to override the reading of description parameters.
Necessary for parameters that are not simply stored in the tool's container.
Modify the passed t_data if the right id is provided, and set the appropriate flags. Then make sure to include a call to the parent at the end:
return SUPER::GetDParameter(data,
id, t_data,
flags);
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | id | The ID of the parameter. |
[out] | t_data | The parameter data to return. Cinema 4D owns the pointed data. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_DESC |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented in SculptBrushToolData.
◆ SetDParameter()
Called to override the writing of parameters.
Read the passed t_data if the right id was provided, store the data, and set the appropriate flags. Then make sure to include a call to the parent at the end:
return SUPER::SetDParameter(data,
id, t_data,
flags);
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | id | The ID of the parameter. |
[in] | t_data | The parameter data to set. Cinema 4D owns the pointed data. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_DESC |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented in SculptBrushToolData, and BrushToolData.
◆ GetDEnabling()
Called to decide which description parameters should be enabled or disabled.
Can be used both for parameters that are stored in the tool's description and for dynamic parameters.
Read the passed t_data if the right id was provided, and return true to enable the parameter or false to disable it. Then make sure to include a call to the parent at the end:
return SUPER::GetDEnabling(data,
id, t_data,
flags, itemdesc);
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | id | The ID of the parameter. |
[in] | t_data | The parameter data. Cinema 4D owns the pointed data. |
[in] | flags | Not used. |
[in] | itemdesc | The parameter's description, encoded to a container as described in Description. |
- Returns
- true if the parameter should be enabled, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented in SculptBrushToolData, BrushToolData, and DescriptionToolData.
◆ TranslateDescID()
Called by the Attribute Manager for every object and every description ID.
Gives the opportunity to route a description ID in the description of a tool to another one.
- Parameters
-
[in] | doc | The active document. Cinema 4D owns the pointed document. |
[in] | data | The tool settings container. |
[in] | id | The source description ID. |
[out] | res_id | Assign the target description ID. |
[out] | res_at | Assign the target object. |
- Returns
- true if successful, otherwise false.
Reimplemented in SculptBrushToolData, and DescriptionToolData.
◆ Message()
◆ RegisterToolPlugin
Registers a tool plugin.
- Parameters
-
[in] | id | A unique plugin ID. Must be obtained from http://www.plugincafe.com |
[in] | str | The name of the plugin.
To affect the order that plugins are displayed in menus add "#$n" as a prefix to this name, where n is a number.
Lower numbers are displayed before higher numbers. If name is "--" it will show up as a menu separator. |
[in] | info | The tool plugin info flags: PLUGINFLAG_TOOL PLUGINFLAG |
[in] | icon | The icon for the tool. The bitmap is copied.
The icon should be of size 32x32, but will be scaled if needed.
It must also be 24 bits and should if possible include an alpha to support pattern backgrounds. |
[in] | help | The tool tips and status bar help text for the tool.
When using strings it is advised to use the resources string (.str) files and the GeLoadString() function.
This keeps the plugin easy to localize for any language to support and makes full use of the language features of Cinema 4D. |
[in] | dat | The tool data instance for the plugin. Cinema 4D takes over the ownership of the pointed tool data. |
- Returns
- true if the tool plugin was registered, otherwise false.
◆ RegisterPyToolPlugin