BrushBase Class Reference

#include <lib_ca.h>

Detailed Description

Helper class for the BrushToolData hook.

Private Member Functions

 BrushBase ()
 
 ~BrushBase ()
 

Private Attributes

_BrushToolBase * m_pBase
 

Alloc/Free

static BrushBaseAlloc ()
 
static void Free (BrushBase *&p)
 

Base Implementations

Bool InitTool (BaseDocument *doc, BaseContainer &data, BaseThread *bt, BrushToolData *tool)
 
void FreeTool (BaseDocument *doc, BaseContainer &data)
 
void InitDefaultSettings (BaseDocument *doc, BaseContainer &data)
 
Bool GetDEnabling (BaseDocument *doc, BaseContainer &data, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool SetDParameter (BaseDocument *doc, BaseContainer &data, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
 
Bool GetDDescription (BaseDocument *doc, BaseContainer &data, Description *description, DESCFLAGS_DESC &flags)
 
Bool Message (BaseDocument *doc, BaseContainer &data, Int32 type, void *t_data)
 
Bool GetCursorInfo (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Float x, Float y, BaseContainer &bc)
 
Bool MouseInput (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg)
 

Helpers

BrushVertexDataGetSelected (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Int32 &vcnt, Int32 x, Int32 y, Float rad, BaseObject *op)
 
Float GetCursor (Int32 &x, Int32 &y)
 
void GetObjectInfo (BrushObjectData *data, BrushObjectInfo &info)
 
Bool GetObjectInfo (BaseObject *op, BrushObjectInfo &info)
 
Bool ValidateObjects (BaseDocument *doc, BaseContainer &data)
 
BrushPixelDataGetObjectAt (Int32 x, Int32 y)
 
Float GetFalloff (Float dst, Int32 flags) const
 
Float GetStrength () const
 
Float GetStrengthMultiplier () const
 
Bool GetObjects (BaseDocument *doc, AtomArray *objects)
 
Bool UpdateCache (BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Bool force)
 
FloatCalcSurfaceDistances (PolygonObject *pObject, BaseSelect *selected, Neighbor *pNeighbor=nullptr, Vector *pNormals=nullptr, Vector *pGlobalPoints=nullptr, Float *pDistance=nullptr)
 
FloatCalcSurfaceDistancesFromPoint (PolygonObject *pObject, Int32 pindex, Neighbor *pNeighbor=nullptr, Vector *pNormals=nullptr, Vector *pGlobalPoints=nullptr, Float *pDistance=nullptr)
 

Constructor & Destructor Documentation

◆ BrushBase()

BrushBase ( )
private

◆ ~BrushBase()

~BrushBase ( )
private

Member Function Documentation

◆ Alloc()

static BrushBase* Alloc ( )
static

Allocates a brush base. Destroy the allocated brush base with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated brush base, or nullptr if the allocation failed.

◆ Free()

static void Free ( BrushBase *&  p)
static

Destructs brush base instances allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]pThe brush base to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ InitTool()

Bool InitTool ( BaseDocument doc,
BaseContainer data,
BaseThread bt,
BrushToolData tool 
)

Base implementation for BrushToolData.

◆ FreeTool()

void FreeTool ( BaseDocument doc,
BaseContainer data 
)

Base implementation for BrushToolData.

◆ InitDefaultSettings()

void InitDefaultSettings ( BaseDocument doc,
BaseContainer data 
)

Base implementation for BrushToolData.

◆ GetDEnabling()

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

Base implementation for BrushToolData.

◆ SetDParameter()

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

Base implementation for BrushToolData.

◆ GetDDescription()

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

Base implementation for BrushToolData.

◆ Message()

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

Base implementation for BrushToolData.

◆ GetCursorInfo()

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

Base implementation for BrushToolData.

◆ MouseInput()

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

Base implementation for BrushToolData.

◆ GetSelected()

BrushVertexData* GetSelected ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
Int32 vcnt,
Int32  x,
Int32  y,
Float  rad,
BaseObject op 
)

Performs a selection at (x,y) with radius rad.

Warning
Call ValidateObjects() before this function.
Parameters
[in]docThe document.
[in]dataThe data container.
[in]bdThe base draw view.
[out]vcntAssigned the selected vertex count.
[in]xThe X coordinate.
[in]yThe Y coordinate.
[in]radThe radius.
[in]opThe object.
Returns
The selected vertices.

◆ GetCursor()

Float GetCursor ( Int32 x,
Int32 y 
)

Gets the cursor position and radius.

Parameters
[out]xAssigned the cursor X position.
[out]yAssigned the cursor Y position.
Returns
The radius.

◆ GetObjectInfo() [1/2]

void GetObjectInfo ( BrushObjectData *  data,
BrushObjectInfo info 
)

Retrieves object information for data.

Parameters
[in]dataThe brush object data.
[out]infoAssigned the brush object information.

◆ GetObjectInfo() [2/2]

Bool GetObjectInfo ( BaseObject op,
BrushObjectInfo info 
)

Retrieves the cached object data from op.

Parameters
[in]opThe object.
[out]infoAssigned the brush object information.
Returns
true if successful, otherwise false.
false if object op is not found in the cache.

◆ ValidateObjects()

Bool ValidateObjects ( BaseDocument doc,
BaseContainer data 
)

Validate objects.

Parameters
[in]docThe document.
[in]dataThe data container.
Returns
true if successful, otherwise false.

◆ GetObjectAt()

BrushPixelData* GetObjectAt ( Int32  x,
Int32  y 
)

Get the objects at (x,y).

Warning
Call ValidateObjects() before this function.
Parameters
[in]xThe X coordinate.
[in]yThe Y coordinate.
Returns
The brush pixel data.

◆ GetFalloff()

Float GetFalloff ( Float  dst,
Int32  flags 
) const

Gets the falloff factor.

Note
Only valid within MouseInput() functions.
Parameters
[in]dstThe distance.
[in]flagsThe flags: BRUSHBASE_FALLOFF
Returns
The falloff factor.

◆ GetStrength()

Float GetStrength ( ) const

Gets the strength (percentage).

Returns
The strength percentage.

◆ GetStrengthMultiplier()

Float GetStrengthMultiplier ( ) const

Gets the strength multiplier. Should be 1.0 unless pen pressure affects strength.

Returns
The multiplier.

◆ GetObjects()

Bool GetObjects ( BaseDocument doc,
AtomArray objects 
)

Fills in the atom array with the cached (should be active) objects.

Parameters
[in]docThe document.
[out]objectsThe cached objects.
Returns
true if successful, otherwise false.

◆ UpdateCache()

Bool UpdateCache ( BaseDocument doc,
BaseContainer data,
BaseDraw bd,
Bool  force 
)

Update the cache if object pointers have been changed during mouse drag.
It should not be needed to set force if the object has been made dirty (MSG_UPDATE).

Parameters
[in]docThe document.
[in]dataThe data container.
[in]bdThe base draw view.
[in]forceSet to true to force the cache update.
Returns
true if successful, otherwise false.

◆ CalcSurfaceDistances()

Float* CalcSurfaceDistances ( PolygonObject pObject,
BaseSelect selected,
Neighbor pNeighbor = nullptr,
Vector pNormals = nullptr,
Vector pGlobalPoints = nullptr,
Float pDistance = nullptr 
)

Used internally for surface distance calculations. Creates an array with an element for each point in pObject set to the distance to selected.
If pDistance is passed this array is used instead.
Either pass the various pointers (those with the nullptr default parameters) or let them be calculated automatically if nullptr.

Parameters
[in]pObjectThe object to calculate.
[in]selectedThe point selection to calculate.
[in]pNeighborThe neighbor information.
[in]pNormalsThe point normals.
[in]pGlobalPointsThe global points.
[out]pDistanceThe pre-allocated distance array to be filled.
Returns
The distance array.

◆ CalcSurfaceDistancesFromPoint()

Float* CalcSurfaceDistancesFromPoint ( PolygonObject pObject,
Int32  pindex,
Neighbor pNeighbor = nullptr,
Vector pNormals = nullptr,
Vector pGlobalPoints = nullptr,
Float pDistance = nullptr 
)

Used internally for surface distance calculations. Creates an array with an element for each point in pObject set to the distance to selected.
If pDistance is passed this array is used instead.
Either pass the various pointers (those with the nullptr default parameters) or let them be calculated automatically if nullptr.

Parameters
[in]pObjectThe object to calculate.
[in]pindexThe point to calculate.
[in]pNeighborThe neighbor information.
[in]pNormalsThe point normals.
[in]pGlobalPointsThe global points.
[out]pDistanceThe pre-allocated distance array to be filled.
Returns
The distance array.

Member Data Documentation

◆ m_pBase

_BrushToolBase* m_pBase
private