SculptBrushToolData
¶
New in version R16.021.
A data class for creating sculpt brushes.
See also
The
SculptBrushToolData
plugin examples:
Py-SculptGrabBrush
,
Py-SculptPaintBrush
,
Py-SculptPullBrush
and
Py-SculptTwistBrush
c4d.modules.sculpting.
SculptBrushToolData
¶
SculptBrushToolData.KeyboardInput()
SculptBrushToolData.MouseInput()
SculptBrushToolData.GetState()
SculptBrushToolData.GetCursorInfo()
SculptBrushToolData.Draw()
SculptBrushToolData.AllocSubDialog()
SculptBrushToolData.Message()
SculptBrushToolData.GetToolPluginId()
SculptBrushToolData.GetResourceSymbol()
SculptBrushToolData.StartStroke()
SculptBrushToolData.StartStrokeInstance()
SculptBrushToolData.StartSymmetry()
SculptBrushToolData.StartStrokeInstanceDabs()
SculptBrushToolData.StartDab()
SculptBrushToolData.EndDab()
SculptBrushToolData.EndStroke()
SculptBrushToolData.EndStrokeInstance()
SculptBrushToolData.EndSymmetry()
SculptBrushToolData.EndStrokeInstanceDabs()
SculptBrushToolData.MouseData()
SculptBrushToolData.OverwriteLoadedPresetSettings()
SculptBrushToolData.PostInitDefaultSettings()
SculptBrushToolData.GetEnabling()
SculptBrushToolData.HandleFillTool()
SculptBrushToolData.HandleNonModelPickMode()
SculptBrushToolData.DrawNonModelPickMode()
SculptBrushToolData.HasDrawMode()
c4d.plugins.BaseData
SculptBrushToolData.
InitTool
(
self
,
doc
,
data
,
bt
)
¶
Called each time the tool is selected.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if there was no error, otherwise False . |
SculptBrushToolData.
FreeTool
(
self
,
doc
,
data
)
¶
Called each time the user chooses another tool.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if there was no error, otherwise False . |
SculptBrushToolData.
DoCommand
(
self
,
mode
,
arr
,
bc
,
doc
,
flags
)
¶
Called by
SendModelingCommand()
to perform a command.
Parameters: |
|
---|
SculptBrushToolData.
InitDefaultSettings
(
self
,
doc
,
data
)
¶
Called to let initialize the default tool settings in data .
Parameters: |
|
---|
SculptBrushToolData.
KeyboardInput
(
self
,
doc
,
data
,
bd
,
win
,
msg
)
¶
Called when the user types something in any of the editor views.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
False if a problem occured. |
SculptBrushToolData.
MouseInput
(
self
,
doc
,
data
,
bd
,
win
,
msg
)
¶
Called when the user clicks with the mouse in any of the editor views.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
False if a problem occured. |
SculptBrushToolData.
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:
|
SculptBrushToolData.
GetCursorInfo
(
self
,
doc
,
data
,
bd
,
x
,
y
,
bc
)
¶
Called when the cursor is over the editor window to get the state of the mouse pointer.
The bubble help and cursor can be set using:
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. |
SculptBrushToolData.
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:
|
SculptBrushToolData.
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 subdialog. |
SculptBrushToolData.
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. |
SculptBrushToolData.
GetToolPluginId
(
self
)
¶
Return the unique id for the tool plugin as obtained from www.plugincafe.com.
Return type: | int |
---|---|
Returns: | The tool plugin ID. |
SculptBrushToolData.
GetResourceSymbol
(
self
)
¶
Return the name of the resource file for this brush.
Return type: | str |
---|---|
Returns: | The name of the resource file for this brush. |
SculptBrushToolData.
StartStroke
(
self
,
strokeCount
,
data
)
¶
StartStroke()
is called once at the start of the stroke. It passes the total number of instances of the brush that will be drawn.
The number of instances will change depending on the symmetry mirroring and radial settings.
ApplyDab()
override via
BrushDabData.GetBrush()
.
StartStroke()
: Called once at the start of the stroke.
StartStrokeInstance()
: Call for each instance of a stroke that will be used. Use this to initialize any data you might need for the duration of the entire brush stroke.
StartSymmetry()
: Called once before all the instances are about to be drawn for a small mouse movement. This will be called MANY times during a stroke as the mouse moves over the model.
StartStrokeInstanceDabs()
: Called once before a bunch of consecutive dabs will be draw for a single instance (mirrored brush).
StartDab()
: Called for each dab that needs to be drawn between 2 mouse locations on the object for a single brush stroke instance.
ApplyDab()
gets called to process the dab.
EndDab()
EndStrokeInstanceDabs()
EndSymmetry()
: Called once when all symmetrical strokes have finished.
EndStrokeInstance()
: Called for each instance of a stroke that was used.
EndStroke()
Note
StartStroke()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: |
|
---|
SculptBrushToolData.
StartStrokeInstance
(
self
,
strokeInstanceID
)
¶
StartStroke()
. Called once for each brush instance at the start of a stroke.
The number of instances will change depending on the symmetry mirroring and radial settings.
ApplyDab()
override via
BrushDabData.GetBrush()
.
Note
StartStrokeInstance()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
StartSymmetry
(
self
)
¶
EndSymmetry()
all the dabs for each instance will be drawn from one mouse location on the surface of the model to another.
This method will be called every time the user moves its mouse over the object on the screen to indicate that a new batch of dabs is going to be drawn.
ApplyDab()
override via
BrushDabData.GetBrush()
.
Note
StartSymmetry()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
SculptBrushToolData.
StartStrokeInstanceDabs
(
self
,
strokeInstanceID
)
¶
ApplyDab()
override via
BrushDabData.GetBrush()
.
Note
StartStrokeInstanceDabs()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
StartDab
(
self
,
strokeInstanceID
)
¶
ApplyDab()
override is called which will then process the dab.
ApplyDab()
override via
BrushDabData.GetBrush()
.
Note
StartDab()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
EndDab
(
self
,
strokeInstanceID
)
¶
Called after
ApplyDab()
function.
Note
EndDab()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
EndStrokeInstanceDabs
(
self
,
strokeInstanceID
)
¶
Called after all the dabs have been drawn for a single instance of the brush.
Note
EndStrokeInstanceDabs()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
EndSymmetry
(
self
)
¶
Called after all the dabs for all the instances have been drawn for a single mouse movement on screen.
Note
EndSymmetry()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
SculptBrushToolData.
EndStrokeInstance
(
self
,
strokeInstanceID
)
¶
StartStrokeInstance()
override.
Note
EndStrokeInstance()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
Parameters: | strokeInstanceID ( int ) – The ID of the brush instance being drawn. |
---|
SculptBrushToolData.
EndStroke
(
self
)
¶
Called on mouse up after
EndStrokeInstance()
has been called for each instance.
Note
EndStroke()
will only be called if
SculptBrushParams.EnableBrushAccess()
has been set to
True
.
SculptBrushToolData.
MouseData
(
self
,
strokeInstanceID
,
brushData
,
md
)
¶
New in version R17.048.
Constantly receives data about the object underneath the mouse. This method will get called when you move the cursor over an object on screen and happens when the mouse button is up or down.
Note
MouseData()
will only be called if
SculptBrushParams.EnableMouseData()
has been set to
True
.
Parameters: |
|
---|
SculptBrushToolData.
OverwriteLoadedPresetSettings
(
self
,
data
)
¶
After a preset has been loaded this method will get called to allow the brush to disable or change any of the loaded settings if required.
Parameters: | data ( c4d.BaseContainer ) – The settings for the loaded brush. |
---|
SculptBrushToolData.
PostInitDefaultSettings
(
self
,
doc
,
data
)
¶
Parameters: |
|
---|
SculptBrushToolData.
GetEnabling
(
self
,
id
)
¶
Called internally by the sculpting system to check if an UI element is enabled or not.
If this method is overridden then make sure to also check the return value of this method directly by calling SculptBrushToolData.GetEnabling(id) at the end.
Parameters: | id ( int ) – The id of the UI element from the .res file. |
---|---|
Return type: | bool |
Returns: | True if the element should be enabled, otherwise False . |
SculptBrushToolData.
HandleFillTool
(
self
,
doc
,
data
,
bd
,
win
,
msg
)
¶
Private.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
SculptBrushToolData.
HandleNonModelPickMode
(
)
¶
Private. Do something special when the first mouse click is not on the model.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if handled, otherwise False . In the case where you wish to only handle the mouse click and not the mouse drag it can return False . |
SculptBrushToolData.
DrawNonModelPickMode
(
)
¶
Private.
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||
Returns: |
True if successful, otherwise False . |
SculptBrushToolData.
HasDrawMode
(
self
,
mode
)
¶
Parameters: | mode ( int ) – The ID for the DrawMode. For example MDATA_SCULPTBRUSH_SETTINGS_DRAWMODE_LINE . |
---|---|
Return type: | bool |
Returns: | True if the draw mode is supported, otherwise False . |
SculptBrushToolData.
ApplyDab
(
self
,
dab
)
¶
Called to modify the sculpt object. Implement the functionality of your brush here!
Parameters: | dab ( c4d.modules.sculpting.BrushDabData ) – The brush dab data. |
---|