SculptModifierInterface Class Reference

#include <lib_sculptbrush.h>

Detailed Description

This interface lets apply the affects of a sculpting modifier to any polygon object.
It allows to use the same algorithms outside of the sculpting system itself and deform a polygon object using the same brush algorithms that the sculpt brushes use.

Public Member Functions

Bool Init (PolygonObject *poly)
 
void Clear ()
 
BaseContainer GetDefaultData ()
 
Int32 GetModifierCount ()
 
Bool GetModifierInfo (Int32 index, Int32 &modifierId, String &name)
 
Bool SetData (const BaseContainer &brushData, const BaseContainer &modifierData)
 
Bool ApplyModifier (Int32 modifierId, Int32 vertex, const BaseContainer &brushData, const BaseContainer &modifierData, Vector *pHitPoint=nullptr, Vector *pLastHitPoint=nullptr, Bool respectSelections=false)
 

Static Public Member Functions

static SculptModifierInterfaceAlloc ()
 
static void Free (SculptModifierInterface *&brush)
 

Private Member Functions

 SculptModifierInterface ()
 
 ~SculptModifierInterface ()
 

Constructor & Destructor Documentation

◆ SculptModifierInterface()

◆ ~SculptModifierInterface()

Member Function Documentation

◆ Alloc()

static SculptModifierInterface* Alloc ( )
static

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

Returns
The allocated SculptModifierInterface object, or nullptr if the allocation failed.

◆ Free()

static void Free ( SculptModifierInterface *&  brush)
static

Destructs SculptModifierInterface objects allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]brushThe SculptModifierInterface object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Init()

Bool Init ( PolygonObject poly)

Initializes the interface to apply modifiers to the given polygon object.

Parameters
[in]polyThe polygon object to apply modifiers to.
Returns
true if successful, otherwise false.

◆ Clear()

void Clear ( )

Clears the interface. Frees up any internal data that was required to apply modifiers to the initialized polygon object.

◆ GetDefaultData()

BaseContainer GetDefaultData ( )

Gets the default brush data setting. These settings can be found in toolsculptbrushbase.h

Returns
The container containing all the default brush settings.

◆ GetModifierCount()

Int32 GetModifierCount ( )

Gets the number of available modifiers that are currently registered and able to be used.

Returns
The number of modifiers.

◆ GetModifierInfo()

Bool GetModifierInfo ( Int32  index,
Int32 modifierId,
String name 
)

Gets the information about a modifier given its index.

Parameters
[in]indexThe index into the list of available modifiers: 0 <= index < GetModifierCount()
[out]modifierIdAssigned the plugin ID of the modifier.
[out]nameAssigned the name of the modifier.
Returns
true if a modifier was found at the given index, otherwise false.

◆ SetData()

Bool SetData ( const BaseContainer brushData,
const BaseContainer modifierData 
)

Sets the brush data and modifier data for the the next dab to be drawn.
Initializes any time consuming data before making repeated calls to ApplyModifier(). Operations that take time are things such as enabling stamps, changing a stamps texture, calculation of the falloff values etc.

Parameters
[in]brushDataThe brush data container settings. By default just use what is returned from calling GetDefaultData().
[in]modifierDataThe container for the modifier itself. Each modifier is a BaseList2D node and could have its own settings. Refer to each modifiers BM file (BMknife.h as an example).
Returns
true if the data was correctly set, otherwise false.

◆ ApplyModifier()

Bool ApplyModifier ( Int32  modifierId,
Int32  vertex,
const BaseContainer brushData,
const BaseContainer modifierData,
Vector pHitPoint = nullptr,
Vector pLastHitPoint = nullptr,
Bool  respectSelections = false 
)

Applies a modifier to the PolygonObject near the specified vertex.

Precondition
SetData() must be called before.
Note
If a hit point is given then it must be on the surface of a polygon that is attached to the specified vertex.
Parameters
[in]modifierIdThe plugin ID of the modifier to apply. This is retrieved from a call to GetModifierInfo().
[in]vertexThe index of the vertex on the PolygonObject where to apply the modifier to.
[in]brushDataThe brush data container settings. By default just use what is returned from calling GetDefaultData();
[in]modifierDataThe container for the modifier itself. Each modifier is a BaseList2D node and could have its own settings. Refer to each modifiers BM file (BMknife.h as an example).
[in]pHitPointThe exact hit point on the surface of a polygon that is connected to the vertex.
[in]pLastHitPointThe last hit point from the previous call to ApplyModifier().
This is used to determine the direction of the dab for modifiers such as the knife and pinch modifier.
[in]respectSelectionstrue to tell the modifier to respect any Polygon or Point selections on the PolygonObject.
Returns
true if the data was correctly set, otherwise false.