#include <lib_sculptbrush.h>
A data class for creating sculpt brush plugins.
Use RegisterToolPlugin() with PLUGINFLAG_TOOL_SCULPTBRUSH to register a sculpt brush plugin.
Public Member Functions | |
SculptBrushToolData (SculptBrushParams *pParams) | |
~SculptBrushToolData () | |
Public Member Functions inherited from DescriptionToolData | |
virtual const String | GetResourceSymbol ()=0 |
virtual Int32 | GetToolPluginId ()=0 |
Bool | InteractiveModeling_Restart (BaseDocument *doc) |
Public Member Functions inherited from ToolData | |
virtual SubDialog * | AllocSubDialog (BaseContainer *bc) |
virtual Bool | DoCommand (ModelingCommandData &mdat) |
Public Member Functions inherited from BaseData | |
BaseData () | |
virtual | ~BaseData () |
void | Destructor () |
Public Attributes | |
SculptBrushParams * | m_pParams |
CustomSculptBrushBase * | m_pBrushBase |
Non-Virtual Methods | |
void | EnableSpecialDrawGizmo () |
void | DisableSpecialDrawGizmo () |
void | SetMouseDrag (Bool value) |
Bool | IsMouseDrag () |
void | CacheObjects (BaseDocument *doc) |
Int32 | GetSelectionCacheCount () |
BaseList2D * | GetSelectionCacheObject (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 BaseBitmap * | GetStamp () |
const BaseBitmap * | GetStencil () |
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 |
|
explicit |
Constructor.
~SculptBrushToolData | ( | ) |
Destructor.
|
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.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::FreeTool(doc, data)
at the end.
Reimplemented from DescriptionToolData.
|
virtual |
If this method is overridden then make sure to call directly SculptBrushToolData::InitDefaultSettings(doc, data)
at the start.
Reimplemented from DescriptionToolData.
|
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.
|
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.
|
virtual |
If this method is overridden then make sure to call directly SculptBrushToolData::GetDDescription(doc, data, description, flags)
at the start.
Reimplemented from DescriptionToolData.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::Message(doc, data, type, t_data)
at the end.
Reimplemented from DescriptionToolData.
|
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.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::GetCursorInfo(doc, data, x, y, bc)
at the end.
Reimplemented from ToolData.
|
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.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::KeyboardInput(doc, data, bd, win, msg)
at the end.
Reimplemented from ToolData.
|
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.
|
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.
|
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.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::InitDisplayControl(doc, data, bd, active)
at the end.
Reimplemented from ToolData.
|
virtual |
If this method is overridden then make sure to call SculptBrushToolData::FreeDisplayControl()
at the end.
Reimplemented from ToolData.
|
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.
|
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.
Calling order for brush stroke virtual methods:
MovePointFunc
gets called to process the dab.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.
[in] | strokeCount | Number of instances of the brush that will be drawn. |
[in] | data | The BaseContainer data for the brush. |
|
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.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
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.
|
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.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
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.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
virtual |
Called after the MovePointFunc
method is called.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
virtual |
Called after all the dabs have been drawn for a single instance of the brush.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
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.
|
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.
[in] | strokeInstanceID | The ID of the brush instance being drawn. |
|
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.
|
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.
[in] | strokeInstanceID | The ID of the brush instance. |
[in] | brushData | The BaseContainer data for the brush. |
[in] | md | The SculptMouseData for the current position of the mouse on the surface of the object. |
|
virtual |
Called after a preset has been loaded to allow the brush to disable or change any of the loaded settings if required.
[in] | data | The container with the settings for the loaded brush. |
|
virtual |
Called after a brush is reset by the user (and set back to its defaults) to overwrite any of the standard brush settings.
[in] | doc | The BaseDocument. |
[in] | data | The BaseContainer that contains all the settings for the loaded brush. |
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.
[in] | id | The id of the UI element from the .res file. |
|
virtual |
Private.
[in] | doc | The current document. |
[in] | data | The BaseContainer for the brush data. |
[in] | bd | The BaseDraw the tool is being used in. |
[in] | win | The Window the tool is being used in. |
[in] | msg | The mouse/tablet message data. |
|
virtual |
Private. Called to do something special when the first mouse click is not on the model.
[in] | doc | The current document. |
[in] | data | The BaseContainer for the brush data. |
[in] | bd | The BaseDraw the tool is being used in. |
[in] | win | The Window the tool is being used in. |
[in] | msg | The mouse/tablet message data. |
|
virtual |
Private.
[in] | doc | The current document. |
[in] | data | The BaseContainer for the brush data. |
[in] | bd | The BaseDraw the tool is being used in. |
[in] | bh | The BaseDrawHelp. |
[in] | bt | The thread this method is being called from. |
[in] | flags | The flags for this call. |
|
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.
[in] | pSculpt | The SculptObject. |
[in] | pLayer | The layer to flood. |
[in] | brushData | The brushes BaseContainer data. |
[in] | function | The ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD. |
[in] | preview | true 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] | customStrength | If 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] | pVertexNormals | If not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option. |
|
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.
[in] | pSculpt | The SculptObject. |
[in] | pLayer | The layer to flood. |
[in] | brushData | The brushes BaseContainer data. |
[in] | function | The ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD. |
[in] | pChannel | The BaseChannel to use when flooding. |
[in] | preview | true 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] | customStrength | If 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] | pVertexNormals | If not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option. |
|
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.
[in] | pSculpt | The SculptObject. |
[in] | pLayer | The layer to flood. |
[in] | brushData | The brushes BaseContainer data. |
[in] | function | The ID of the function to apply. The default Flood button has the ID MDATA_SCULPTBRUSH_SETTINGS_FLOOD. |
[in] | pBitmap | The BaseBitmap to use when flooding. |
[in] | preview | true 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] | customStrength | If 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] | pVertexNormals | If not nullptr then this contains the vertex normals on the current object. These can be used for interactive flooding along with the preview option. |
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.
[in] | mode | The ID for the Draw Mode. For example MDATA_SCULPTBRUSH_SETTINGS_DRAWMODE_LINE. |
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.
Message()
when a button is pushed in the interface. [in] | doc | The current document. |
[in] | bd | The viewport that should be used. Usually doc->GetActiveBaseDraw() . |
[in] | brushData | The tools data container. |
[in] | button | The ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayer(). |
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.
Message()
when a button is pushed in the interface. [in] | doc | The current document. |
[in] | bd | The viewport that should be used. Usually doc->GetActiveBaseDraw() . |
[in] | brushData | The tools data container. |
[in] | pChannel | The BaseChannel to use when flooding. |
[in] | button | The ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayerWithChannel(). |
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.
Message()
when a button is pushed in the interface. [in] | doc | The current document. |
[in] | bd | The viewport that should be used. Usually doc->GetActiveBaseDraw() . |
[in] | brushData | The tools data container. |
[in] | pBitmap | The BaseBitmap to use when flooding. |
[in] | button | The ID of the button in the UI to use as the function parameter in the subsequent call to FloodSelectedLayerWithBitmap(). |
|
virtual |
Private. Called by Python Brushes.
|
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.
[in] | strokeInstanceID | The ID of the brush instance. |
[in,out] | pCustom | The custom data to set the pStamp bitmap pointer. |
|
virtual |
Private. After preset data has been loaded this method is called to adjust adjust any settings that are specific for the brush.
[in] | data | The container for the sculpt brush tool. |
|
virtual |
Private. After preset data has been loaded this method is called to refresh the stencil for the brush.
[in] | data | The container for the sculpt brush tool. |
void EnableSpecialDrawGizmo | ( | ) |
Enables a flag so that the brush preview gets drawn.
void DisableSpecialDrawGizmo | ( | ) |
Clears the flag so that the drawing of the brush preview is not forced.
void SetMouseDrag | ( | Bool | value | ) |
Tells the brush when the mouse button is down.
[in] | value | Set to true if the mouse is being polled. Set to false when finished. |
Bool IsMouseDrag | ( | ) |
Checks if a mouse button is held down and being dragged.
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.
[in] | doc | The document to check. |
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.
BaseList2D* GetSelectionCacheObject | ( | Int32 | index | ) |
Gets a cached SculptObject.
[in] | index | The index of the cached object. |
GetType()==SCULPT_OBJECT_ID
then it is a SculptObject. Gets the strength of the brush.
This is useful when used in the Flood method to get the strength that the flood should apply.
[in] | original | If 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. |
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.
[in] | doc | The document to check for SculptObject to update. |
Bool HasModifier | ( | ) |
Checks if the brush has the SculptBrushParams::EnableModifier flag set to true.
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.
Private. Writes the brush preset data.
[in] | hf | The HyperFile to write to. |
Private. Reads the brush preset data.
[in] | hf | The HyperFile to write to. |
[in] | level | The version of the plugin that the brush data was written with. |
Private. Writes the brush stamp preset data.
[in] | hf | The HyperFile to write to. |
Private. Reads the brush stamp preset data.
[in] | hf | The HyperFile to write to. |
[in] | level | The version of the plugin that the stamp data was written with. |
const BaseBitmap* GetStamp | ( | ) |
Gets the BaseBitmap that is being used for the stamp of the sculpt brush.
const BaseBitmap* GetStencil | ( | ) |
Gets the BaseBitmap that is being used for the stencil of the sculpt brush.
SculptBrushParams* m_pParams |
CustomSculptBrushBase* m_pBrushBase |