BrushDabData Class Reference

#include <lib_sculptbrush.h>

Detailed Description

The brush data for an individual dab. This is passed into the method defined by the user in SculptBrushParams::SetMovePointFunc.

Public Member Functions

const BaseContainerGetData ()
 
const SculptObjectGetObject ()
 
const BrushPointDataGetPointData ()
 
const BrushPolyDataGetPolyData ()
 
PolygonObjectGetPolygonObject ()
 
PolygonObjectGetBaseObject ()
 
Int32 GetPointCount ()
 
Int32 GetPolyCount ()
 
NeighborGetNeighbor ()
 
SculptLayerGetLayer ()
 
const VectorGetPoints ()
 
const Vector32GetOriginalPoints ()
 
Vector GetNormal ()
 
Vector GetDrawDirectionNormal ()
 
Float GetBrushStrength ()
 
Float GetBrushRadius ()
 
Vector GetMousePos3D ()
 
Vector GetHitPoint ()
 
Vector GetLastHitPoint ()
 
Int32 GetHitPolygon ()
 
Vector GetEyePoint ()
 
Bool IsMirroredDab ()
 
OVERRIDE GetBrushOverride ()
 
BaseDrawGetBaseDraw ()
 
void GetAveragePointAndNormal (Vector &averagePoint, Vector &normal)
 
void ApplySmooth ()
 
const Vector32GetVertexNormals ()
 
const Vector32GetOriginalVertexNormals ()
 
const Vector32GetFaceNormals ()
 
Float GetAutoScaleValue (Bool noRadius)
 
Float GetBrushFalloff (Int32 index, Vector32 *pRetStencilColor=nullptr, Float *pCustomDistance=nullptr)
 
Float GetBrushFalloffFromPos (const Vector &pos)
 
void OffsetPoint (Int32 index, const Vector &offset, Vector32 *pVertexColor=nullptr, SCULPTOFFSETFLAGS flags=SCULPTOFFSETFLAGS::NONE)
 
Bool IsPreviewDab ()
 
void OffsetPreviewPoint (Int32 index, const Vector &offset, SCULPTOFFSETFLAGS flags=SCULPTOFFSETFLAGS::NONE)
 
void DirtyAllPoints (SCULPTBRUSHDATATYPE type)
 
Bool IsPointModified (Int32 index)
 
Float GetStencilColor (const Vector &point, Vector32 *pRetColor=nullptr, Vector32 *pRetCoords=nullptr, SAMPLEMODE mode=SAMPLEMODE::TAKEONEPIXEL)
 
Float GetStampColor (const Vector &point, Float distanceFromHitPoint, Vector32 *pRetColor=nullptr, Vector32 *pRetCoords=nullptr, SAMPLEMODE mode=SAMPLEMODE::TAKEONEPIXEL)
 
const BaseBitmapGetStencil ()
 
const BaseBitmapGetStamp ()
 
SculptBrushToolDataGetBrush ()
 
Int32 GetStrokeInstanceID ()
 
Bool IsSculptObject ()
 
Vector GetMirrorPoint (const Vector &point, Bool isNormal)
 
Float32GetMaskCache ()
 
Float32 PointPolysAverage (Int32 vertex, Float32 *values)
 
Vector PointPolysAverage (Int32 vertex, Vector *values)
 
Bool IsPointInFillArea (const Vector &p)
 
Bool IsBackface ()
 

Private Member Functions

 BrushDabData ()
 
 ~BrushDabData ()
 

Constructor & Destructor Documentation

◆ BrushDabData()

BrushDabData ( )
private

◆ ~BrushDabData()

~BrushDabData ( )
private

Member Function Documentation

◆ GetData()

const BaseContainer* GetData ( )

Gets the settings data for the brush.

Returns
The container for the brush.

◆ GetObject()

const SculptObject* GetObject ( )

Gets the sculpt object that the dab is for.

Returns
The sculpt object.

◆ GetPointData()

const BrushPointData* GetPointData ( )

Gets the list of points that are affected by the brush.

Note
Call GetPointCount() to get the number of points in the returned array.
Returns
The list of points.

◆ GetPolyData()

const BrushPolyData* GetPolyData ( )

Gets the list of the polygons that are affected by the brush.

Note
Call GetPolyCount() to get the number of polygons in the returned array.
Returns
The list of polygons.

◆ GetPolygonObject()

PolygonObject* GetPolygonObject ( )

Gets the PolygonObject for the SculptObject that is currently being displayed in the viewport.

Returns
The polygon object.

◆ GetBaseObject()

PolygonObject* GetBaseObject ( )

Gets the original object that the SculptTag is applied to.

Note
In the case where this there is no SculptTag on then this will return the same as the call to GetPolygonObject().
Returns
The PolygonObject.

◆ GetPointCount()

Int32 GetPointCount ( )

Gets the number of points that are touched by the dab.

Note
This is the number of points in the array returned from GetPointData().
Returns
The number of points.

◆ GetPolyCount()

Int32 GetPolyCount ( )

Gets the number of polygons that are touched by the dab.

Note
this is the number of polygons in the array returned from GetPolyData().
Returns
The number of polygons.

◆ GetNeighbor()

Neighbor* GetNeighbor ( )

Gets the Neighbor information for the SculptObject if it is currently at level 0.

Note
If the user is sculpting a regular unsubdivided PolygonObject then this also returns a valid pointer.
Returns
The Neighbor information if SculptObject is at level 0 or if the user is sculpting on a regular PolygonObject, otherwise nullptr.

◆ GetLayer()

SculptLayer* GetLayer ( )

Gets the currently selected Layer for a subdivided SculptObject.

Note
If the user is sculpting a regular PolygonObject then this returns nullptr.
Returns
The currently selected layer in the Layer Manager if it is a subdivided SculptObject, otherwise nullptr.

◆ GetPoints()

const Vector* GetPoints ( )

Retrieves the live points that are modified on the surface during a brush stroke.
These points may already have been modified by previous brush dabs during the current brush stroke.

Returns
The points on the PolygonObject that is currently displayed in the viewport.

◆ GetOriginalPoints()

const Vector32* GetOriginalPoints ( )

Retrieves a copy of the points in their state before the brush stroke started.
Use these points to compare where the surface was before the user started sculpting.

Note
As an example this data is used by the grab tool to correctly offset the points based on their original location on the surface at the first mouse click.
Returns
The points on the PolygonObject at the state it was in when the user first pressed the left mouse button down.

◆ GetNormal()

Vector GetNormal ( )

Gets the normal at the current hit point for the dab.
This is the average vertex normal of all the points that are affected by the dab.

Returns
The normal at the current hit point.

◆ GetDrawDirectionNormal()

Vector GetDrawDirectionNormal ( )

If the brush supports the Draw Direction, i.e. the user has set SculptBrushParams::EnableDrawDirection(true),
then this returns the direction selected by the user, otherwise it just returns the same vector as GetNormal().

Returns
The Draw Direction normal.

◆ GetBrushStrength()

Float GetBrushStrength ( )

Gets the brush strength for the dab.

Note
This strength is not the same as the strength in the container returned by GetData().
This also takes into account many other variables including tablet pressure to create the value.
Returns
The strength of the brush.

◆ GetBrushRadius()

Float GetBrushRadius ( )

Gets the brush radius for the dab.

Note
This is not the same as the brush size in the container returned by GetData().
. This also takes into account other factors such as the distance from the camera, scale of the object and tablet values to determine the correct brush radius.
Returns
The radius of the brush. The size of the radius is in the sculpt objects local space.

◆ GetMousePos3D()

Vector GetMousePos3D ( )

If the brush mode is ref SCULPTBRUSHMODE::GRAB then this method can be used to get the location of the mouse pointer in world space in the scene.

Returns
If the brush mode is SCULPTBRUSHMODE::GRAB returns the position of the mouse in world space, otherwise Vector(0,0,0).

◆ GetHitPoint()

Vector GetHitPoint ( )

Gets the point on the surface of the SculptObject where the dab is going to be placed. This is the center of the dab.

Note
If the mode is set to SCULPTBRUSHMODE::GRAB then this always returns the initial hit point that occurred when the user first pressed the left mouse button down.
Returns
The hit point on the surface.

◆ GetLastHitPoint()

Vector GetLastHitPoint ( )

Gets the hit point for the previous dab during the stroke.

Returns
The hit point on the surface.

◆ GetHitPolygon()

Int32 GetHitPolygon ( )

Gets the index of the polygon on the surface of the SculptObject where the dab is going to be placed. This is the center of the dab.

Note
If the mode is set to SCULPTBRUSHMODE::GRAB then this always returns the initial hit polygon that occurred when the user first pressed the left mouse button down.
Since
R17.032
Returns
The index of the polygon on hit the surface.

◆ GetEyePoint()

Vector GetEyePoint ( )

Gets the location of the mouse in local space above the model.

Note
This point is created by interpolating between previous and next real mouse hit point on the surface of the SculptObject.
This is then projected down onto the surface of the model to get the real hit point for the interpolated value.
Returns
The virtual mouse location in local space above the surface of the SculptObject.

◆ IsMirroredDab()

Bool IsMirroredDab ( )

Checks if the dab is for a mirrored brush stroke.

Returns
true it is a mirrored dab or false if it is the main brush stroke.

◆ GetBrushOverride()

OVERRIDE GetBrushOverride ( )

Gets the override flags. This can be any combination of the OVERRIDE flags.

Returns
The brush override flags if there are any or 0 if there are none: OVERRIDE

◆ GetBaseDraw()

BaseDraw* GetBaseDraw ( )

Gets the view that the user is currently drawing in.

Returns
The view.

◆ GetAveragePointAndNormal()

void GetAveragePointAndNormal ( Vector averagePoint,
Vector normal 
)

Gets the average point and normal.
The returned values depend on what the fixed plane (MDATA_SCULPTBRUSH_SETTINGS_FIXEDPLANE) setting is for the brush:

◆ ApplySmooth()

void ApplySmooth ( )

Applies an effect of the smooth brush to the current dab.

Note
Call this after modification of the dab to smooth it out.

◆ GetVertexNormals()

const Vector32* GetVertexNormals ( )

Gets the vertex normals for the SculptObject.

Note
The number of vertex normals is equal to the number of points on the PolygonObject returned from GetPolygonObject().
Returns
The vertex normals for the SculptObject.

◆ GetOriginalVertexNormals()

const Vector32* GetOriginalVertexNormals ( )

Gets the state of the vertex normals before the user started a brush stroke.

Note
The number of vertex normals is equal to the number of points on the PolygonObject returned from GetPolygonObject().
Since
R17.032
Returns
The vertex normals for the SculptObject.

◆ GetFaceNormals()

const Vector32* GetFaceNormals ( )

Gets the face normals for the SculptObject.

Note
The number of face normals is equal to the number of polygons on the PolygonObject returned from GetPolygonObject().
Since
R17.032
Returns
The face normals for the SculptObject.

◆ GetAutoScaleValue()

Float GetAutoScaleValue ( Bool  noRadius)

Gets a value which represents the scale of the SculptObject.

Note
This value can be used to convert a distance in object space with the value returned from GetBrushRadius() to help adjust the algorithm for the brush
since the value returned from GetBrushRadius() is also already adjusted using the same value.
Parameters
[in]noRadiustrue means it does not take into account the radius of the object in its calculation and only uses the scale.
Returns
The scale value with which to adjust the local space vector or distance value.

◆ GetBrushFalloff()

Float GetBrushFalloff ( Int32  index,
Vector32 pRetStencilColor = nullptr,
Float pCustomDistance = nullptr 
)

Retrieves the brush falloff for the brush point at index.
The falloff is already adjusted by using the values from the stamp and stencil so it can be used directly to adjust the strength of an offset to add to the layer.

Parameters
[in]indexThe index of the point on the SculptObject.
This index can be found for the current point using BrushPointData.pointIndex.
[out]pRetStencilColorAssigned the color of the stencil. This saves an additional call to GetStencilColor().
[in]pCustomDistanceThe custom distance to use.
Internally this method uses the distance that the point is from the hit point in its calculation (BrushPointData::distance).
Pass a value instead to use custom distance.
Returns
The final falloff value that can be used to adjust the offset value.

◆ GetBrushFalloffFromPos()

Float GetBrushFalloffFromPos ( const Vector pos)

Retrieves the falloff value, defined by the falloff curve, based on the distance from input pos to the hit point for the dab.

Parameters
[in]posA point in 3D space to get the falloff for.
Returns
The falloff value.

◆ OffsetPoint()

void OffsetPoint ( Int32  index,
const Vector offset,
Vector32 pVertexColor = nullptr,
SCULPTOFFSETFLAGS  flags = SCULPTOFFSETFLAGS::NONE 
)

Offsets the brush point at index point on the layer by the given offset amount.

Note
This method should be used only if IsPreviewDab() returns false, otherwise use OffsetPreviewPoint() method.
Parameters
[in]indexThe index of the point on the SculptObject.
This index can be found for the current point using BrushPointData.pointIndex.
[in]offsetThe vector to offset the point by.
[in]pVertexColorPrivate. Used internally.
[in]flagsThe flags to let use or ignore settings such as the layers mask or strength when offsetting the point: SCULPTOFFSETFLAGS By setting the SCULPTOFFSETFLAGS::IGNOREMASK flag it will ignore whatever the mask checkbox state is for the layer
Otherwise it uses this state to determine if it should use the mask.

◆ IsPreviewDab()

Bool IsPreviewDab ( )

Checks if the dab is a preview dab.

Note
Currently only DragRect and DragDab support preview brushes.
Returns
true if if it is a preview dab, otherwise false.

◆ OffsetPreviewPoint()

void OffsetPreviewPoint ( Int32  index,
const Vector offset,
SCULPTOFFSETFLAGS  flags = SCULPTOFFSETFLAGS::NONE 
)

If IsPreviewDab() returns true then apply the offset using this method.
This adds the offset to a temporary preview layer that is created when using the DragDab and DragRect draw modes.

Note
This method should be used only if IsPreviewDab() returns true, otherwise use OffsetPoint() method.
Parameters
[in]indexThe index of the point on the SculptObject.
This index can be found for the current point using BrushPointData.pointIndex.
[in]offsetThe vector to offset the point by.
[in]flagsThe flags to let use or ignore settings such as the layers mask or strength when offsetting the point: SCULPTOFFSETFLAGS
By setting the SCULPTOFFSETFLAGS::IGNOREMASK flag it ignores whatever the mask checkbox state is for the layer.
Otherwise it uses this state to determine if it should use the mask.

◆ DirtyAllPoints()

void DirtyAllPoints ( SCULPTBRUSHDATATYPE  type)

Makes dirty all the points for the dab according to the SCULPTBRUSHDATATYPE.

Parameters
[in]typeThe type to use for the brush data to make dirty.

◆ IsPointModified()

Bool IsPointModified ( Int32  index)

Checks if another brush stroke has changed a point.

Note
When using Symmetry, another mirrored brush may change the point.
Parameters
[in]indexThe index of the point on the SculptObject.
This index can be found for the current point using BrushPointData.pointIndex.
Returns
true if the point was modified, otherwise false.

◆ GetStencilColor()

Float GetStencilColor ( const Vector point,
Vector32 pRetColor = nullptr,
Vector32 pRetCoords = nullptr,
SAMPLEMODE  mode = SAMPLEMODE::TAKEONEPIXEL 
)

Retrieves the color and gray values of the stencil for a point in the SculptObject local space.

Parameters
[in]pointA point on the surface of the SculptObject for which to get a color for.
[out]pRetColorAssigned the color of the stencil.
[out]pRetCoordsAssigned the returned coordinates of the pixel on the stencil bitmap.
[in]modeThe sample mode used to sample the stencil texture: SAMPLEMODE
Returns
The gray scale value of the stencil, which has been adjusted by the stencil gray value.

◆ GetStampColor()

Float GetStampColor ( const Vector point,
Float  distanceFromHitPoint,
Vector32 pRetColor = nullptr,
Vector32 pRetCoords = nullptr,
SAMPLEMODE  mode = SAMPLEMODE::TAKEONEPIXEL 
)

Retrieves the color and gray values of the stamp for a point in the SculptObject local space.

Parameters
[in]pointA point in the SculptObject coordinate system which is used to sample the stamp on the current dab.
[in]distanceFromHitPointCan be either the BrushPointData.distance value, the length of the vector (hit point - point) or a custom distance value.
This is used to get the correct falloff for the point.
[out]pRetColorAssigned the color of the stamp.
[out]pRetCoordsAssigned the coordinates of the pixel on the stamp bitmap.
[in]modeThe sample mode used to sample the stencil texture: SAMPLEMODE
Returns
The gray scale value of the stamp, which has been adjusted by the stamp gray value.

◆ GetStencil()

const BaseBitmap* GetStencil ( )

Get the stencil used for the dab.

Returns
The bitmap for the stencil.

◆ GetStamp()

const BaseBitmap* GetStamp ( )

Gets the stamp used for the dab.

Returns
The bitmap for the stamp.

◆ GetBrush()

SculptBrushToolData* GetBrush ( )

Gets the Brush being used. This only returns the brush if SculptBrushParams::EnableBrushAccess(true) has been set.

Warning
If this is called by a Modifier then it returns nullptr. Always check to make sure the returned pointer is not a nullptr.
Returns
A pointer to the brush tool data.

◆ GetStrokeInstanceID()

Int32 GetStrokeInstanceID ( )

Gets the ID of the stroke instance that the dab is being drawn for.

Returns
The stroke instance ID.

◆ IsSculptObject()

Bool IsSculptObject ( )

Checks if the object being touched is a SculptObject (i.e. it has a SculptTag).

Returns
trueIfOtherwiseFalse{it is a SculptObject}

◆ GetMirrorPoint()

Vector GetMirrorPoint ( const Vector point,
Bool  isNormal 
)

Gets the mirrored point (or Normal) from the objects space to the correct location for the current dab.

Warning
This should only be used to get the symmetrically mirrored point for a point.
In most cases this method would never be used because the brush system automatically handles symmetrical points.
Parameters
[in]pointThe input point, or normal, to mirror.
[in]isNormalSet to true if the point is a normal, the point is then only rotated and not offseted.
Returns
The mirrored point.

◆ GetMaskCache()

Float32* GetMaskCache ( )

Gets the current mask values for the PolygonObject.

Note
The number of points returned is equal to the number of points on the PolygonObject.
Returns
The mask values.

◆ PointPolysAverage() [1/2]

Float32 PointPolysAverage ( Int32  vertex,
Float32 values 
)

Averages out the values for a vertex on the PolygonObject.

Parameters
[in]vertexThe vertex number on the PolygonObject to get the average value for.
[out]valuesThe values to average out. This must contains the same number of values as there are points on the PolygonObject.
Returns
The mask values.

◆ PointPolysAverage() [2/2]

Vector PointPolysAverage ( Int32  vertex,
Vector values 
)

Averages out the values for a vertex on the PolygonObject.

Parameters
[in]vertexThe vertex number on the PolygonObject to get the average value for.
[in]valuesThe values to average out. This must contains the same number of values as there are points on the PolygonObject.
Returns
The mask values.

◆ IsPointInFillArea()

Bool IsPointInFillArea ( const Vector p)

Checks if a point is within the drawn fill area.

Note
This method is useful in Fill brush tools.
Parameters
[in]pA point in local space to check.
Returns
true if if the point is within the fill area, otherwise false.

◆ IsBackface()

Bool IsBackface ( )

Returns true if this dab is being applied backfacing polygons.

Note
Backface polygons will only be sculpted on if the brush has its BackFaceSculpting option enabled and the Backface option is also checked by the user.
Since
R17.032
Returns
True if the dab is on backfacing polygons.