SculptBrushToolData Class Reference

#include <lib_sculptbrush.h>

Inheritance diagram for SculptBrushToolData:

Detailed Description

A data class for creating sculpt brush plugins.
Use RegisterToolPlugin() with PLUGINFLAG_TOOL_SCULPTBRUSH to register a sculpt brush plugin.

class MySculptBrush : public SculptBrushToolData
{
public:
MySculptBrush(SculptBrushParams *pParams) : SculptBrushToolData(pParams) { }
virtual Int32 GetToolPluginId() const; // Return the unique ID for the plugin as obtained from www.plugincafe.com
virtual const String GetResourceSymbol() const; // Return the name of for resource file for for brush.
static Bool MovePointFunc(BrushDabData *dab); // This is the static implementation for the MovePointFunc
};
Bool RegisterMyBrush()
{
return RegisterToolPlugin(MY_BRUSH_ID,"BrushName", PLUGINFLAG_HIDEPLUGINMENU|PLUGINFLAG_TOOL_SCULPTBRUSH|PLUGINFLAG_TOOL_NO_OBJECTOUTLINE, nullptr, "MyBrushHelpText", NewObjClear(MySculptBrush, pParams));
}
The brush data for an individual dab. This is passed into the method defined by the user in SculptBru...
Definition: lib_sculptbrush.h:350
virtual Int32 GetToolPluginId() const =0
virtual const String GetResourceSymbol() const =0
Definition: lib_sculptbrush.h:931
static SculptBrushParams * Alloc()
Definition: lib_sculptbrush.h:1215
Definition: c4d_string.h:41
friend Bool RegisterToolPlugin(Int32 id, const maxon::String &str, Int32 info, BaseBitmap *icon, const maxon::String &help, ToolData *dat)
maxon::Bool Bool
Definition: ge_sys_math.h:51
maxon::Int32 Int32
Definition: ge_sys_math.h:56
#define PLUGINFLAG_TOOL_SCULPTBRUSH
Tool is a sculpt brush.
Definition: c4d_tooldata.h:201
#define PLUGINFLAG_TOOL_NO_OBJECTOUTLINE
Object outlines on selection not supported.
Definition: c4d_tooldata.h:202
#define PLUGINFLAG_HIDEPLUGINMENU
Hide the plugin's menu entry.
Definition: c4d_baseplugin.h:31

Public Member Functions

 SculptBrushToolData (SculptBrushParams *pParams)
 
 ~SculptBrushToolData ()
 
- Public Member Functions inherited from DescriptionToolData
virtual const String GetResourceSymbol () const =0
 
virtual Int32 GetToolPluginId () const =0
 
Bool InteractiveModeling_Restart (BaseDocument *doc)
 
- Public Member Functions inherited from ToolData
virtual SubDialogAllocSubDialog (BaseContainer *bc)
 
virtual Bool DoCommand (ModelingCommandData &mdat)
 
- Public Member Functions inherited from BaseData
virtual ~BaseData ()
 
void Destructor ()
 

Public Attributes

SculptBrushParamsm_pParams
 
CustomSculptBrushBasem_pBrushBase
 

ToolData/DescriptionToolData Overrides

virtual Bool InitTool (BaseDocument *doc, BaseContainer &data, BaseThread *bt)
 
virtual void FreeTool (BaseDocument *doc, BaseContainer &data)
 
virtual void InitDefaultSettings (BaseDocument *doc, BaseContainer &data)
 
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 SetDParameter (BaseDocument *doc, BaseContainer &data, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
 
virtual Bool GetDDescription (const BaseDocument *doc, const BaseContainer &data, Description *description, DESCFLAGS_DESC &flags) const
 
virtual Bool Message (BaseDocument *doc, BaseContainer &data, Int32 type, void *t_data)
 
virtual Bool TranslateDescID (BaseDocument *doc, BaseContainer &data, const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
virtual Bool GetCursorInfo (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Float x, Float y, BaseContainer &bc)
 
virtual Bool MouseInput (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
virtual Bool KeyboardInput (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
virtual TOOLDRAW Draw (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt, TOOLDRAWFLAGS flags)
 
virtual Bool GetDParameter (const BaseDocument *doc, const BaseContainer &data, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const
 
virtual Bool DisplayControl (BaseDocument *doc, BaseObject *op, BaseObject *chainstart, BaseDraw *bd, BaseDrawHelp *bh, ControlDisplayStruct &cds) const
 
virtual Bool InitDisplayControl (BaseDocument *doc, const BaseContainer &data, BaseDraw *bd, const AtomArray *active)
 
virtual void FreeDisplayControl ()
 
virtual Int32 GetState (BaseDocument *doc)
 

Brushes Methods to Override

virtual void StartStroke (Int32 strokeCount, const BaseContainer &data)
 
virtual void StartStrokeInstance (Int32 strokeInstanceID)
 
virtual void StartSymmetry ()
 
virtual void StartStrokeInstanceDabs (Int32 strokeInstanceID)
 
virtual void StartDab (Int32 strokeInstanceID)
 
virtual void EndDab (Int32 strokeInstanceID)
 
virtual void EndStrokeInstanceDabs (Int32 strokeInstanceID)
 
virtual void EndSymmetry ()
 
virtual void EndStrokeInstance (Int32 strokeInstanceID)
 
virtual void EndStroke ()
 
virtual void MouseData (Int32 strokeInstanceID, const BaseContainer &brushData, const SculptMouseData &md)
 
virtual void OverwriteLoadedPresetSettings (BaseContainer &data)
 
virtual void PostInitDefaultSettings (BaseDocument *doc, BaseContainer &data)
 
virtual Bool GetEnabling (Int32 id) const
 
virtual Bool HandleFillTool (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
virtual Bool HandleNonModelPickMode (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 
virtual Bool DrawNonModelPickMode (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt, TOOLDRAWFLAGS flags)
 
virtual void FloodSelectedLayer (SculptObject *pSculpt, SculptLayer *pLayer, const BaseContainer &brushData, Int32 function, Bool preview, Float *customStrength=nullptr, const Vector32 *pVertexNormals=nullptr)
 
virtual void FloodSelectedLayerWithChannel (SculptObject *pSculpt, SculptLayer *pLayer, const BaseContainer &brushData, Int32 function, BaseChannel *pChannel, Bool preview, Float *customStrength=nullptr, const Vector32 *pVertexNormals=nullptr)
 
virtual void FloodSelectedLayerWithBitmap (SculptObject *pSculpt, SculptLayer *pLayer, const BaseContainer &brushData, Int32 function, BaseBitmap *pBitmap, Bool preview, Float *customStrength=nullptr, const Vector32 *pVertexNormals=nullptr)
 
virtual Bool HasDrawMode (Int32 mode)
 
Bool Flood (BaseDocument *doc, BaseDraw *bd, const BaseContainer &brushData, Int32 button=MDATA_SCULPTBRUSH_SETTINGS_FLOOD)
 
Bool FloodWithChannel (BaseDocument *doc, BaseDraw *bd, const BaseContainer &brushData, BaseChannel *pChannel, Int32 button=MDATA_SCULPTBRUSH_SETTINGS_FLOOD)
 
Bool FloodWithBitmap (BaseDocument *doc, BaseDraw *bd, const BaseContainer &brushData, BaseBitmap *pBitmap, Int32 button=MDATA_SCULPTBRUSH_SETTINGS_FLOOD)
 
virtual Bool ApplyPythonDab (BrushDabData *dab)
 
virtual Bool GetCustomData (Int32 strokeInstanceID, SculptCustomData *pCustom)
 
virtual void UpdateSettingsAfterPresetLoad (BaseContainer *data)
 
virtual void UpdateStencilAfterPresetLoad (BaseContainer *data)
 

Non-Virtual Methods

void EnableSpecialDrawGizmo ()
 
void DisableSpecialDrawGizmo ()
 
void SetMouseDrag (Bool value)
 
Bool IsMouseDrag ()
 
void CacheObjects (BaseDocument *doc)
 
Int32 GetSelectionCacheCount ()
 
BaseList2DGetSelectionCacheObject (Int32 index)
 
Float GetBrushStrength (Bool original)
 
void InitZoomScale (BaseDocument *doc)
 
Bool HasModifier ()
 
Bool HasRespectSelections ()
 
Bool WritePresetData (HyperFile *hf)
 
Bool ReadPresetData (HyperFile *hf, Int32 level)
 
Bool WriteStampPresetData (HyperFile *hf)
 
Bool ReadStampPresetData (HyperFile *hf, Int32 level)
 
Bool WriteSplinePresetData (HyperFile *hf)
 
Bool ReadSplinePresetData (HyperFile *hf, Int32 level)
 
const BaseBitmapGetStamp ()
 
const BaseBitmapGetStencil ()
 

Additional Inherited Members

- Static Public Attributes inherited from DescriptionToolData
static constexpr Int32 MSG_TOOL_SYSTEM_HOOK_INIT
 
static constexpr Int32 MSG_TOOL_SYSTEM_HOOK_FREE
 
- Protected Attributes inherited from DescriptionToolData
Bool modeChanged
 
Bool firstaction
 
Int32 last_dirty
 

Constructor & Destructor Documentation

◆ SculptBrushToolData()

SculptBrushToolData ( SculptBrushParams pParams)
explicit

Constructor.

◆ ~SculptBrushToolData()

Destructor.

Member Function Documentation

◆ InitTool()

virtual Bool InitTool ( BaseDocument doc,
BaseContainer data,
BaseThread bt 
)
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::InitTool(doc, data, bt) at the start and check that it returns true.

Reimplemented from DescriptionToolData.

◆ FreeTool()

virtual void FreeTool ( BaseDocument doc,
BaseContainer data 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::FreeTool(doc, data) at the end.

Reimplemented from DescriptionToolData.

◆ InitDefaultSettings()

virtual void InitDefaultSettings ( BaseDocument doc,
BaseContainer data 
)
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::InitDefaultSettings(doc, data) at the start.

Reimplemented from DescriptionToolData.

◆ GetDEnabling()

virtual Bool GetDEnabling ( const BaseDocument doc,
const BaseContainer data,
const DescID id,
const GeData t_data,
DESCFLAGS_ENABLE  flags,
const BaseContainer itemdesc 
) const
virtual

If this method is overridden then make sure to call SculptBrushToolData::GetDEnabling(doc, data, id, t_data, flags, itemdesc) at the end.

Reimplemented from DescriptionToolData.

◆ SetDParameter()

virtual Bool SetDParameter ( BaseDocument doc,
BaseContainer data,
const DescID id,
const GeData t_data,
DESCFLAGS_SET flags 
)
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::SetDParameter(doc, data, id, t_data, flags) at the start.

Reimplemented from ToolData.

◆ GetDDescription()

virtual Bool GetDDescription ( const BaseDocument doc,
const BaseContainer data,
Description description,
DESCFLAGS_DESC flags 
) const
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::GetDDescription(doc, data, description, flags) at the start.

Reimplemented from DescriptionToolData.

◆ Message()

virtual Bool Message ( BaseDocument doc,
BaseContainer data,
Int32  type,
void *  t_data 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::Message(doc, data, type, t_data) at the end.

Reimplemented from DescriptionToolData.

◆ TranslateDescID()

virtual Bool TranslateDescID ( BaseDocument doc,
BaseContainer data,
const DescID id,
DescID res_id,
C4DAtom *&  res_at 
)
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::TranslateDescID(doc, data, type, t_data) at the start and return if it is true.

Reimplemented from DescriptionToolData.

◆ GetCursorInfo()

virtual Bool GetCursorInfo ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
Float  x,
Float  y,
BaseContainer bc 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::GetCursorInfo(doc, data, x, y, bc) at the end.

Reimplemented from ToolData.

◆ MouseInput()

virtual Bool MouseInput ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

If this method is overridden then make sure to call directly SculptBrushToolData::MouseInput(doc, data, bd, win, msg) at the end.

Reimplemented from ToolData.

◆ KeyboardInput()

virtual Bool KeyboardInput ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::KeyboardInput(doc, data, bd, win, msg) at the end.

Reimplemented from ToolData.

◆ Draw()

virtual TOOLDRAW Draw ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
BaseDrawHelp bh,
BaseThread bt,
TOOLDRAWFLAGS  flags 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::Draw(doc, data, bd, bh, bt, flags) at the end.

Reimplemented from ToolData.

◆ GetDParameter()

virtual Bool GetDParameter ( const BaseDocument doc,
const BaseContainer data,
const DescID id,
GeData t_data,
DESCFLAGS_GET flags 
) const
virtual

If this method is overridden then make sure to call SculptBrushToolData::GetDParameter(doc, data, id, t_data, flags) at the end.

Reimplemented from ToolData.

◆ DisplayControl()

virtual Bool DisplayControl ( BaseDocument doc,
BaseObject op,
BaseObject chainstart,
BaseDraw bd,
BaseDrawHelp bh,
ControlDisplayStruct cds 
) const
virtual

If this method is overridden then make sure to call SculptBrushToolData::DisplayControl(doc, op, chainstart, bd, bh, cds) at the end.

Reimplemented from ToolData.

◆ InitDisplayControl()

virtual Bool InitDisplayControl ( BaseDocument doc,
const BaseContainer data,
BaseDraw bd,
const AtomArray active 
)
virtual

If this method is overridden then make sure to call SculptBrushToolData::InitDisplayControl(doc, data, bd, active) at the end.

Reimplemented from ToolData.

◆ FreeDisplayControl()

virtual void FreeDisplayControl ( )
virtual

If this method is overridden then make sure to call SculptBrushToolData::FreeDisplayControl() at the end.

Reimplemented from ToolData.

◆ GetState()

virtual Int32 GetState ( BaseDocument doc)
virtual

Indicates if the brush is active or not (grayed out in the interface).
If this method is overridden then make sure to call SculptBrushToolData::GetState(doc) at the end.

Reimplemented from ToolData.

◆ StartStroke()

virtual void StartStroke ( Int32  strokeCount,
const BaseContainer data 
)
virtual

Called once at the start of the stroke.
It passes the total number of instances of the brush that is to be drawn. The number of instances will change depending on the symmetry mirroring and radial settings.

Use this method to setup any data on the brush that might be accessed from within the MovePointFunc method via the dab->GetBrush() method.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.

Calling order for brush stroke virtual methods:

  • StartStroke(): Called once at the start of the stroke
    • StartStrokeInstance(): Called for each instance of a stroke. Use this to initialize any data needed 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
            • The static method MovePointFunc 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()

When multithreading is enabled for the brush then this method can be used to allocate data for each stroke instance.
Each instance or dab can then safely read from this data during a brush stroke. This will only be done once at mouse down.

Parameters
[in]strokeCountNumber of instances of the brush that will be drawn.
[in]dataThe BaseContainer data for the brush.

◆ StartStrokeInstance()

virtual void StartStrokeInstance ( Int32  strokeInstanceID)
virtual

Called after StartStroke(). This is called once for each brush instance at the start of a stroke. The number of instances changes depending on the symmetry mirroring and radial settings.
Use this method to allocate any data accessed during a brush stroke, that may be specific for each individual instance.
Setup also any data on the brush that might be accessed from within the MovePointFunc method via the dab->GetBrush() method.
When multithreading is enabled for the brush then this method can be used to initialize data for each stroke instance. This will only be done once at mouse down.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ StartSymmetry()

virtual void StartSymmetry ( )
virtual

Called directly before each individual brush instance is about to be handled.
Between StartSymmetry() and EndSymmetry() all the dabs for each instance are drawn from one mouse location on the surface of the model to another.
This method will be called every time the user moves the mouse over the object on the screen to indicate that a new batch of dabs is going to be drawn.

Use this method to setup any data on the brush that might be accessed from within the MovePointFunc method via the dab->GetBrush() method.
When multithreading is enabled for the brush then this method can be used to reset any data required for each instance.
Between StartSymmetry() and EndSymmetry() the dabs could now be drawn out or order by different threads so no data should be allocated or changed between these 2 calls.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.

◆ StartStrokeInstanceDabs()

virtual void StartStrokeInstanceDabs ( Int32  strokeInstanceID)
virtual

Called before all the dabs for a single instance are about to be drawn.
After this call all the dabs for just one instance of the brush on the surface will interpolate between the 2 mouse locations on the object then draw all the dabs for that instance.

Use this method to setup any data on the brush that might be accessed from within the MovePointFunc method via the dab->GetBrush() method.
When multithreading is enabled no data should be changed on the brush.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ StartDab()

virtual void StartDab ( Int32  strokeInstanceID)
virtual

Called before the MovePointFunc method is called which will then process the dab.

Use this method to setup any data on the brush that might be accessed from within the MovePointFunc method via the dab->GetBrush() method.
When multithreading is enabled no data should be changed on the brush.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ EndDab()

virtual void EndDab ( Int32  strokeInstanceID)
virtual

Called after the MovePointFunc method is called.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ EndStrokeInstanceDabs()

virtual void EndStrokeInstanceDabs ( Int32  strokeInstanceID)
virtual

Called after all the dabs have been drawn for a single instance of the brush.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ EndSymmetry()

virtual void EndSymmetry ( )
virtual

Called after all the dabs for all the instances have been drawn for a single mouse movement on screen.
If multithreading is enabled then reset any data for each instance from this method and be ready for the next set of dabs.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.

◆ EndStrokeInstance()

virtual void EndStrokeInstance ( Int32  strokeInstanceID)
virtual

Called on mouse up after a brush stroke. This method is called once for each instance.

Use this method to delete any temporary data that was allocated in the StartStrokeInstance() method.
If multithreading is enabled then reset any data allocated for each brush instance from within this method.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.
Parameters
[in]strokeInstanceIDThe ID of the brush instance being drawn.

◆ EndStroke()

virtual void EndStroke ( )
virtual

Called on mouse up after EndStrokeInstance() has been called for each instance.
If multithreading was enabled then free any data allocated for each brush instance.

Note
This method will only be called if SculptBrushParams::EnableBrushAccess(true) has been set.

◆ MouseData()

virtual void MouseData ( Int32  strokeInstanceID,
const BaseContainer brushData,
const SculptMouseData md 
)
virtual

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
This method will only be called if SculptBrushParams::EnableMouseData(true) has been set.
Since
R17.032
Parameters
[in]strokeInstanceIDThe ID of the brush instance.
[in]brushDataThe BaseContainer data for the brush.
[in]mdThe SculptMouseData for the current position of the mouse on the surface of the object.

◆ OverwriteLoadedPresetSettings()

virtual void OverwriteLoadedPresetSettings ( BaseContainer data)
virtual

Called after a preset has been loaded to allow the brush to disable or change any of the loaded settings if required.

Parameters
[in]dataThe container with the settings for the loaded brush.

◆ PostInitDefaultSettings()

virtual void PostInitDefaultSettings ( BaseDocument doc,
BaseContainer data 
)
virtual

Called after a brush is reset by the user (and set back to its defaults) to overwrite any of the standard brush settings.

Parameters
[in]docThe BaseDocument.
[in]dataThe BaseContainer that contains all the settings for the loaded brush.

◆ GetEnabling()

virtual Bool GetEnabling ( Int32  id) const
virtual

Called by the sculpting system to check if a feature is enabled or not. It is similar to GetDEnabling().
If this method is overridden then make sure to also check the return value of the base method by calling SculptBrushToolData::GetEnabling(id) at the end.

Parameters
[in]idThe id of the UI element from the .res file.

◆ HandleFillTool()

virtual Bool HandleFillTool ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

Private.

Parameters
[in]docThe current document.
[in]dataThe BaseContainer for the brush data.
[in]bdThe BaseDraw the tool is being used in.
[in]winThe Window the tool is being used in.
[in]msgThe mouse/tablet message data.
Returns
true if successful, otherwise false.

◆ HandleNonModelPickMode()

virtual Bool HandleNonModelPickMode ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
EditorWindow win,
const BaseContainer msg 
)
virtual

Private. Called to do something special when the first mouse click is not on the model.

Parameters
[in]docThe current document.
[in]dataThe BaseContainer for the brush data.
[in]bdThe BaseDraw the tool is being used in.
[in]winThe Window the tool is being used in.
[in]msgThe mouse/tablet message data.
Returns
true if if handled, otherwise false.
In the case to only handle the mouse click and not the mouse drag, return false.

◆ DrawNonModelPickMode()

virtual Bool DrawNonModelPickMode ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
BaseDrawHelp bh,
BaseThread bt,
TOOLDRAWFLAGS  flags 
)
virtual

Private.

Parameters
[in]docThe current document.
[in]dataThe BaseContainer for the brush data.
[in]bdThe BaseDraw the tool is being used in.
[in]bhThe BaseDrawHelp.
[in]btThe thread this method is being called from.
[in]flagsThe flags for this call.
Returns
true if successful, otherwise false.

◆ FloodSelectedLayer()

virtual void FloodSelectedLayer ( SculptObject pSculpt,
SculptLayer pLayer,
const BaseContainer brushData,
Int32  function,
Bool  preview,
Float customStrength = nullptr,
const Vector32 pVertexNormals = nullptr 
)
virtual

Called to allow flooding of the entire layer with a specific operation.

This method gets called by the default Flood button, which has the function id MDATA_SCULPTBRUSH_SETTINGS_FLOOD::
This is also called when the Interactive Flood slider is used. Add this slider to the brush by adding the same UI as the Inflate brush has (toolsculptbrushinflate.res).

Setting SculptBrushParams::SetFloodType() defines what data is affected by the flood. This can be either SCULPTBRUSHDATATYPE::POINT or SCULPTBRUSHDATATYPE::MASK. Setting SculptBrushParams::EnableFlood() to true indicates that this method is available to be used, the Flood button will then be active in the UI.

Parameters
[in]pSculptThe SculptObject.
[in]pLayerThe layer to flood.
[in]brushDataThe brushes BaseContainer data.
[in]functionThe ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD.
[in]previewtrue when the flooding is part of an interactive process, e.g. when the user is moving a slider such as the Interactive Inflate option.
[in]customStrengthIf not nullptr then this contains a special strength value that should be used instead of the one from the brushData. This strength is used for interactive flooding along with the preview option.
[in]pVertexNormalsIf not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option.

◆ FloodSelectedLayerWithChannel()

virtual void FloodSelectedLayerWithChannel ( SculptObject pSculpt,
SculptLayer pLayer,
const BaseContainer brushData,
Int32  function,
BaseChannel pChannel,
Bool  preview,
Float customStrength = nullptr,
const Vector32 pVertexNormals = nullptr 
)
virtual

Called to allow flooding of the entire layer, using a material channel, with a specific operation.

This method is called if the method FloodWithChannel() is invoked by the brush.
This is also called when the Interactive Flood slider is used. Add this slider to the brush by adding the same UI as the Inflate brush has (toolsculptbrushinflate.res).

Setting SculptBrushParams::SetFloodType() will define what data is being affected by the flood. This can be either SCULPTBRUSHDATATYPE::POINT or SCULPTBRUSHDATATYPE::MASK. Setting SculptBrushParams::EnableFlood() to true indicates that this method is available to be used, the Flood button will then be active in the UI.

Parameters
[in]pSculptThe SculptObject.
[in]pLayerThe layer to flood.
[in]brushDataThe brushes BaseContainer data.
[in]functionThe ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD.
[in]pChannelThe BaseChannel to use when flooding.
[in]previewtrue when the Flooding is part of an interactive process, e.g. when the user is moving a slider such as the Interactive Inflate option.
[in]customStrengthIf not nullptr then this contains a special strength value that should be used instead of the one from the brushData. This strength is used for interactive flooding along with the preview option.
[in]pVertexNormalsIf not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option.

◆ FloodSelectedLayerWithBitmap()

virtual void FloodSelectedLayerWithBitmap ( SculptObject pSculpt,
SculptLayer pLayer,
const BaseContainer brushData,
Int32  function,
BaseBitmap pBitmap,
Bool  preview,
Float customStrength = nullptr,
const Vector32 pVertexNormals = nullptr 
)
virtual

Called to allow flooding of the entire layer, using a bitmap, with a specific operation.

This method is called if the method FloodWithBitmap() is called by the brush.
This is also called when the Interactive Flood slider is used. Add this slider to the brush by adding the same UI as the Inflate brush has (toolsculptbrushinflate.res).
Setting SculptBrushParams::SetFloodType() will define what data is being affected by the flood. This can be either SCULPTBRUSHDATATYPE::POINT or SCULPTBRUSHDATATYPE::MASK.

Setting SculptBrushParams::EnableFlood() to true indicates that this method is available to be used, the Flood button will then be active in the UI.

Parameters
[in]pSculptThe SculptObject.
[in]pLayerThe layer to flood.
[in]brushDataThe brushes BaseContainer data.
[in]functionThe ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD.
[in]pBitmapThe BaseBitmap to use when flooding.
[in]previewtrue when the Flooding is part of an interactive process, e.g. when the user is moving a slider such as the Interactive Inflate option.
[in]customStrengthIf not nullptr then this contains a special strength value that should be used instead of the one from the brushData. This strength is used for interactive flooding along with the preview option.
[in]pVertexNormalsIf not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option.

◆ HasDrawMode()

virtual Bool HasDrawMode ( Int32  mode)
virtual

Called to let the system know what draw modes the brush supports.
The system will call this method to check if a draw mode is supported by the brush.
If the brush supports all the draw modes then it can just return true.
Otherwise specify which draw modes should be enabled by checking each of them.

Parameters
[in]modeThe ID for the Draw Mode. For example MDATA_SCULPTBRUSH_SETTINGS_DRAWMODE_LINE.
Returns
true if the Draw Mode is supported, otherwise false.

◆ Flood()

Bool Flood ( BaseDocument doc,
BaseDraw bd,
const BaseContainer brushData,
Int32  button = MDATA_SCULPTBRUSH_SETTINGS_FLOOD 
)

Floods the entire layer by calling virtual method FloodSelectedLayer().
If the brush has different flooding methods (like blur, erase, sharpen etc.) then pass in a different flag for the button id.
FloodSelectedLayer() is then called with this setting passed as the function parameter.

Note
By default the button is set to the MDATA_SCULPTBRUSH_SETTINGS_FLOOD which is the standard Flood button that the brushes have.
If a different button is used then this method should be called from Message() when a button is pushed in the interface.
Parameters
[in]docThe current document.
[in]bdThe viewport that should be used. Usually doc->GetActiveBaseDraw().
[in]brushDataThe tools data container.
[in]buttonThe ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayer().
Returns
true if successful, otherwise false.

◆ FloodWithChannel()

Bool FloodWithChannel ( BaseDocument doc,
BaseDraw bd,
const BaseContainer brushData,
BaseChannel pChannel,
Int32  button = MDATA_SCULPTBRUSH_SETTINGS_FLOOD 
)

Floods the entire layer by calling virtual method FloodSelectedLayerWithChannel().
If the brush has different flooding methods (like blur, erase, sharpen etc.) then pass in a different flag for the button id.
FloodSelectedLayerWithChannel is then called with this setting passed as the function parameter.

Note
By default the button is set to the MDATA_SCULPTBRUSH_SETTINGS_FLOOD which is the standard Flood button that the brushes have.
If a different button is used then this method should be called from Message() when a button is pushed in the interface.
Parameters
[in]docThe current document.
[in]bdThe viewport that should be used. Usually doc->GetActiveBaseDraw().
[in]brushDataThe tools data container.
[in]pChannelThe BaseChannel to use when flooding.
[in]buttonThe ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayerWithChannel().
Returns
true if successful, otherwise false.

◆ FloodWithBitmap()

Bool FloodWithBitmap ( BaseDocument doc,
BaseDraw bd,
const BaseContainer brushData,
BaseBitmap pBitmap,
Int32  button = MDATA_SCULPTBRUSH_SETTINGS_FLOOD 
)

Floods the entire layer by calling virtual method FloodSelectedLayerWithBitmap().
If the brush has different flooding methods (like blur, erase, sharpen etc.) then pass in a different flag for the button id.
FloodSelectedLayerWithBitmap() is then called with this setting passed as the function parameter.

Note
By default the button is set to the MDATA_SCULPTBRUSH_SETTINGS_FLOOD which is the standard Flood button that the brushes have.
If a different button is used then this method should be called from Message() when a button is pushed in the interface.
Parameters
[in]docThe current document.
[in]bdThe viewport that should be used. Usually doc->GetActiveBaseDraw().
[in]brushDataThe tools data container.
[in]pBitmapThe BaseBitmap to use when flooding.
[in]buttonThe ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayerWithBitmap().
Returns
true if successful, otherwise false.

◆ ApplyPythonDab()

virtual Bool ApplyPythonDab ( BrushDabData dab)
virtual

Private. Called by Python Brushes.

◆ GetCustomData()

virtual Bool GetCustomData ( Int32  strokeInstanceID,
SculptCustomData pCustom 
)
virtual

If SculptBrushParams::EnableCustomStamp(true) and SculptBrushParams::EnableBrushAccess(true) are both set then this method is called to allow to change the BaseBitmap used for the next dab.
This method is called before each individual dab is drawn. This allows to randomize the stamp image during a stroke. Simply set the pCustom->pStamp pointer to point to a BaseBitmap that is owned by the brush.

Parameters
[in]strokeInstanceIDThe ID of the brush instance.
[in,out]pCustomThe custom data to set the pStamp bitmap pointer.
Returns
true if something changes since the last time it was called, otherwise false.

◆ UpdateSettingsAfterPresetLoad()

virtual void UpdateSettingsAfterPresetLoad ( BaseContainer data)
virtual

Private. After preset data has been loaded this method is called to adjust adjust any settings that are specific for the brush.

Parameters
[in]dataThe container for the sculpt brush tool.

◆ UpdateStencilAfterPresetLoad()

virtual void UpdateStencilAfterPresetLoad ( BaseContainer data)
virtual

Private. After preset data has been loaded this method is called to refresh the stencil for the brush.

Parameters
[in]dataThe container for the sculpt brush tool.

◆ EnableSpecialDrawGizmo()

void EnableSpecialDrawGizmo ( )

Enables a flag so that the brush preview gets drawn.

◆ DisableSpecialDrawGizmo()

void DisableSpecialDrawGizmo ( )

Clears the flag so that the drawing of the brush preview is not forced.

◆ SetMouseDrag()

void SetMouseDrag ( Bool  value)

Tells the brush when the mouse button is down.

Note
This method should be called from within HandleFillTool() to let the system know that the mouse is being polled for input.
Parameters
[in]valueSet to true if the mouse is being polled. Set to false when finished.

◆ IsMouseDrag()

Bool IsMouseDrag ( )

Checks if a mouse button is held down and being dragged.

Returns
true if a mouse button is down, otherwise false.

◆ CacheObjects()

void CacheObjects ( BaseDocument doc)

Caches sculptable objects in the scene so the tool is ready to use on them.
This includes sculpt objects (those with a SculptTag) as well as the first selected PolygonObject (without a tag). Cache objects that are visible in the currently active viewport.

Parameters
[in]docThe document to check.

◆ GetSelectionCacheCount()

Int32 GetSelectionCacheCount ( )

Gets the number of sculpt objects currently selected. This includes sculpt objects (those with a SculptTag) as well as other internal objects.
Checking if an object is of type SCULPT_OBJECT_ID allows the caller to cast to a SculptObject.

Returns
The number of selected sculpt objects.

◆ GetSelectionCacheObject()

BaseList2D* GetSelectionCacheObject ( Int32  index)

Gets a cached SculptObject.

Parameters
[in]indexThe index of the cached object.
Returns
The cached Object. If its GetType()==SCULPT_OBJECT_ID then it is a SculptObject.

◆ GetBrushStrength()

Float GetBrushStrength ( Bool  original)

Gets the strength of the brush.
This is useful when used in the Flood method to get the strength that the flood should apply.

Parameters
[in]originalIf true returns the value as defined in the UI.
If False returns an interpolated value between the current and the next sample point and then also adjusted according to any effector settings such as pen pressure.
Returns
The strength value.

◆ InitZoomScale()

void InitZoomScale ( BaseDocument doc)

Initializes the scaling settings for each sculpt brush according to the distance the camera is from the SculptObject.
Updates the scaling information for each currently selected SculptObject in the scene.

Warning
Plugin developers should never have to call this method. It is used internally when a sculpt tag is first applied to an object to ensure the selected brush works correctly.
Parameters
[in]docThe document to check for SculptObject to update.

◆ HasModifier()

Bool HasModifier ( )

Checks if the brush has the SculptBrushParams::EnableModifier flag set to true.

Returns
true if the brush can use modifiers, otherwise false.

◆ HasRespectSelections()

Bool HasRespectSelections ( )

Checks if the brush has the SculptBrushParams::EnableRespectSelections flag set to true.
This should be checked in the FloodSelectedLayer() method to see if it should respect the current selection or not.
This can return false if overridden by the internal sculpting system to specifically ignore selections.

Returns
true if the brush should respect the current selection, otherwise false.

◆ WritePresetData()

Bool WritePresetData ( HyperFile hf)

Private. Writes the brush preset data.

Parameters
[in]hfThe HyperFile to write to.
Returns
true if successful, otherwise false.

◆ ReadPresetData()

Bool ReadPresetData ( HyperFile hf,
Int32  level 
)

Private. Reads the brush preset data.

Parameters
[in]hfThe HyperFile to write to.
[in]levelThe version of the plugin that the brush data was written with.
Returns
true if successful, otherwise false.

◆ WriteStampPresetData()

Bool WriteStampPresetData ( HyperFile hf)

Private. Writes the brush stamp preset data.

Parameters
[in]hfThe HyperFile to write to.
Returns
true if successful, otherwise false.

◆ ReadStampPresetData()

Bool ReadStampPresetData ( HyperFile hf,
Int32  level 
)

Private. Reads the brush stamp preset data.

Parameters
[in]hfThe HyperFile to write to.
[in]levelThe version of the plugin that the stamp data was written with.
Returns
true if successful, otherwise false.

◆ WriteSplinePresetData()

Bool WriteSplinePresetData ( HyperFile hf)

Private.

◆ ReadSplinePresetData()

Bool ReadSplinePresetData ( HyperFile hf,
Int32  level 
)

Private.

◆ GetStamp()

const BaseBitmap* GetStamp ( )

Gets the BaseBitmap that is being used for the stamp of the sculpt brush.

Returns
The stamp that the brush is using.

◆ GetStencil()

const BaseBitmap* GetStencil ( )

Gets the BaseBitmap that is being used for the stencil of the sculpt brush.

Returns
The stencil that the brush is using.

Member Data Documentation

◆ m_pParams

SculptBrushParams* m_pParams

◆ m_pBrushBase

CustomSculptBrushBase* m_pBrushBase