-
首页
-
C4D R23.110 C++ SDK
#include <c4d_tooldata.h>
详细描述
A data class for creating tool plugins.
使用
RegisterToolPlugin()
to register a tool plugin.
-
注意
-
To make modeling tools that support the Transform/Apply buttons use
DescriptionToolData
instead.
Friends
|
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
(
BaseDocument
*doc,
BaseContainer
&data,
描述
*description,
DESCFLAGS_DESC
&flags)
|
virtual
Bool
|
GetDParameter
(
BaseDocument
*doc,
BaseContainer
&data, const
DescID
&id,
GeData
&t_data,
DESCFLAGS_GET
&flags)
|
virtual
Bool
|
SetDParameter
(
BaseDocument
*doc,
BaseContainer
&data, const
DescID
&id, const
GeData
&t_data,
DESCFLAGS_SET
&flags)
|
virtual
Bool
|
GetDEnabling
(
BaseDocument
*doc,
BaseContainer
&data, const
DescID
&id, const
GeData
&t_data,
DESCFLAGS_ENABLE
flags, const
BaseContainer
*itemdesc)
|
virtual
Bool
|
TranslateDescID
(
BaseDocument
*doc,
BaseContainer
&data, const
DescID
&id,
DescID
&res_id,
C4DAtom
*&res_at)
|
成员函数文档编制
◆
AllocDialog()
◆
FreeDialog()
virtual void FreeDialog
|
(
|
CDialog *
|
cd
|
)
|
|
|
private
virtual
|
◆
InitTool()
Called each time the tool is selected.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
BrushToolData
,
SculptBrushToolData
,和
DescriptionToolData
.
◆
FreeTool()
Called each time the user chooses another tool.
-
参数
-
[in]
|
doc
|
The active document.
Cinema 4D
owns the pointed document.
|
[in]
|
data
|
The tool settings container.
|
Reimplemented in
BrushToolData
,
SculptBrushToolData
,和
DescriptionToolData
.
◆
MouseInput()
Called when the user clicks with the mouse in any of the editors views.
使用
GetToolScale
to make adjustments relative to the view size.
-
注意
-
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.
-
参数
-
[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
.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
BrushToolData
,和
SculptBrushToolData
.
◆
KeyboardInput()
Called when the user types something in any of the editors views.
-
注意
-
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.
-
警告
-
Always returning
true
here will block all keyboard use.
-
参数
-
[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
.
|
-
返回
-
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.
-
参数
-
[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
|
-
返回
-
The tool draw result:
TOOLDRAW
Reimplemented in
SculptBrushToolData
.
◆
DisplayControl()
Called to set information about how the active object should be displayed.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
SculptBrushToolData
.
◆
InitDisplayControl()
Called to initialize resources for the display control used in
DisplayControl
.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
SculptBrushToolData
.
◆
FreeDisplayControl()
virtual void FreeDisplayControl
|
(
|
void
|
|
)
|
|
|
virtual
|
Called to free resources allocated in
InitDisplayControl
.
Reimplemented in
SculptBrushToolData
.
◆
AllocSubDialog()
Called to get the sub-dialog for the Active Tool window.
Return here an instance of the tool's sub-dialog.
-
参数
-
[in]
|
bc
|
Currently not used.
|
-
返回
-
The allocated sub-dialog.
Cinema 4D
owns the pointed sub-dialog.
◆
DoCommand()
Called by
SendModelingCommand
to perform the command in
mdat
.
-
参数
-
[in]
|
mdat
|
The data for the modeling command to perform.
|
-
返回
-
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:
bc.
SetString
(
RESULT_BUBBLEHELP
,
"My Tools Help"
);
bc.
SetInt32
(
RESULT_CURSOR
,
MOUSE_POINT_HAND
);
-
注意
-
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.
-
参数
-
[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
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
BrushToolData
,和
SculptBrushToolData
.
◆
GetResourceSymbol()
virtual const
String
GetResourceSymbol
|
(
|
|
)
|
|
|
virtual
|
Called to get the description resource symbol for the tool.
-
返回
-
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
描述
Resource for more information.
Reimplemented in
DescriptionToolData
.
◆
GetState()
Called to check if the tool should be enabled or not.
-
参数
-
[in]
|
doc
|
The active document.
Cinema 4D
owns the pointed document.
|
-
返回
-
A combination of the 2 command flags:
CMD_ENABLED
CMD_VALUE
.
Reimplemented in
SculptBrushToolData
.
◆
InitDefaultSettings()
Called to initialize the default tool settings in
data
.
-
参数
-
[in]
|
pDoc
|
The active document.
Cinema 4D
owns the pointed document.
|
[in]
|
data
|
The tool settings container.
|
Reimplemented in
DescriptionToolData
,
BrushToolData
,和
SculptBrushToolData
.
◆
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);
-
参数
-
[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
|
-
返回
-
true
if successful, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
BrushToolData
,
SculptBrushToolData
,和
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);
-
参数
-
[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
|
-
返回
-
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);
-
参数
-
[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
|
-
返回
-
true
if successful, otherwise
false
. It is recommended to include a call to the parent function as last return.
Reimplemented in
BrushToolData
,和
SculptBrushToolData
.
◆
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);
-
参数
-
[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
描述
.
|
-
返回
-
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
BrushToolData
,
SculptBrushToolData
,和
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.
-
参数
-
[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.
|
-
返回
-
true
if successful, otherwise
false
.
Reimplemented in
SculptBrushToolData
,和
DescriptionToolData
.
◆
Message()
Called when a tool receives messages.
For example description messages such as
MSG_DESCRIPTION_COMMAND
are sent here.
-
另请参阅
-
C4DAtom::Message
-
注意
-
Some notification messages are automatically passed along to branches:
MSG_POINTS_CHANGED
,
MSG_POLYGONS_CHANGED
and
MSG_SEGMENTS_CHANGED
. This is for convenience and historical reasons.
-
参数
-
[in]
|
doc
|
The active document.
Cinema 4D
owns the pointed document.
|
[in]
|
data
|
The tool settings container.
|
[in]
|
type
|
The message type:
MSG
|
[in,out]
|
t_data
|
The message data. The sender owns the pointed data.
|
-
返回
-
true
or
false
depending on the message
type
.
Reimplemented in
BrushToolData
,
SculptBrushToolData
,和
DescriptionToolData
.
Friends And Related Function Documentation
◆
RegisterToolPlugin
Registers a tool plugin.
-
参数
-
[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
32x
32
,
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()
函数。
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.
|
-
返回
-
true
if the tool plugin was registered, otherwise
false
.
◆
RegisterPyToolPlugin
void SetInt32(Int32 id, Int32 l)
定义:
c4d_basecontainer.h:505
void SetString(Int32 id, const maxon::String &s)
定义:
c4d_basecontainer.h:569
@ RESULT_CURSOR
Int32 Mouse cursor: MOUSE
定义:
gui.h:542
static const Int32 MOUSE_POINT_HAND
Point hand cursor.
定义:
ge_prepass.h:2495
@ RESULT_BUBBLEHELP
String Bubble help text.
定义:
gui.h:543