SculptModifierInterface

c4d.modules.sculpting

New in version R16.021.

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.

See also

Py-SculptModifierDeformer plugin example showing how to use SculptModifierInterface in a deformer implementation.

Members

SculptModifierInterface.Init(poly)

Initializes the interface so that you can apply modifiers to the given Polygon Object.

Parameters:poly (PolygonObject) – The Polygon Object that you wish to apply modifiers to.
Return type:bool
Returns:True if successfully initialized.
SculptModifierInterface.Clear()

Clears the interface. This will free up any internal data that was required to apply modifiers to the initialized PolygonObject in Init().

SculptModifierInterface.GetDefaultData()

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

Return type:BaseContainer
Returns:The container containing all the default brush settings.
SculptModifierInterface.GetModifierCount()

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

Return type:int
Returns:The number of Modifiers.
SculptModifierInterface.GetModifierInfo(index)

Gets the information about a modifier given its index.

Parameters:index (int) – The index into the list of available modifiers. GetModifierCount() returns the number of modifiers.
Return type:dict{id: int, name: str}
Returns:The modifier information.
SculptModifierInterface.SetData(brushData, modifierData)
Sets the brush data and modifier data for the the next dab to be drawn.
This must be called before ApplyModifier(). This will initialize any time consuming data before you make 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:
  • brushData (BaseContainer) – The brush data settings. By default you can just use the container returned by GetDefaultData().
  • modifierData (BaseContainer) –
    The settings 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).
Return type:

bool

Returns:

True if the data was correctly set.

SculptModifierInterface.ApplyModifier(modifierId, vertex, brushData, modifierData[, respectselections=False])

Applies a modifier to the Polygon Object near the specified vertex.

Parameters:
  • modifierId (int) – The ID of the modifier to apply. This is retrieved from a call to GetModifierInfo().
  • vertex (int) – The index of the vertex on the PolygonObject where you want to apply the modifier to.
  • brushData (BaseContainer) – The brush data settings. By default you can just use the container returned by GetDefaultData().
  • modifierData (BaseContainer) –
    The settings 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).
  • respectselections (bool) – Pass True for the modifier to respect any polygon or point selections on the Polygon Object. Default to False.
Return type:

bool

Returns:

True if the modifier was successfully applied.

SculptModifierInterface.ApplyModifierExact(modifierId, vertex, brushData, modifierData, hitpoint, lasthitpoint[, respectselections=False])

Exactly applies a modifier to the Polygon Object near the specified vertex using the given hitpoint.

Parameters:
  • modifierId (int) – The ID of the modifier to apply. This is retrieved from a call to GetModifierInfo().
  • vertex (int) – The index of the vertex on the PolygonObject where you want to apply the modifier to.
  • brushData (BaseContainer) – The brush data settings. By default you can just use the container returned by GetDefaultData().
  • modifierData (BaseContainer) –
    The settings 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).
  • respectselections (bool) – Pass True for the modifier to respect any polygon or point selections on the Polygon Object. Default to False.
  • hitpoint (Vector) – The exact hitpoint on the surface of a polygon that is connected to the passed vertex.
  • lasthitpoint (Vector) –
    The last hitpoint 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.
Return type:

bool

Returns:

True if the modifier was successfully applied.

Table Of Contents