c4d.modules.sculpting.SculptModifierInterface¶
-
class
c4d.modules.sculpting.
SculptModifierInterface
¶ 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.
New in version R16.021.
See also
sculpt_modifier_deformer plugin example showing how to use
SculptModifierInterface
in a deformer implementation.
Methods Signatures
Initializes the interface so that you can apply modifiers to the given Polygon Object. |
|
Clears the interface.
|
|
Gets the default brush data setting. These settings can be found in toolsculptbrushbase.h. |
|
Gets the number of available modifiers that are currently registered and able to be used. |
|
Gets the information about a modifier given its index. |
|
Sets the brush data and modifier data for the the next dab to be drawn.
|
|
|
Applies a modifier to the Polygon Object near the specified vertex. |
|
Exactly applies a modifier to the Polygon Object near the specified vertex using the given hitpoint. |
Methods Documentation
-
SculptModifierInterface.
Init
(self, poly)¶ Initializes the interface so that you can apply modifiers to the given Polygon Object.
- Parameters
poly (c4d.PolygonObject) – The Polygon Object that you wish to apply modifiers to.
- Return type
bool
- Returns
True if successfully initialized.
-
SculptModifierInterface.
Clear
(self)¶ - Clears the interface.This will free up any internal data that was required to apply modifiers to the initialized
PolygonObject
inInit()
.
-
SculptModifierInterface.
GetDefaultData
(self)¶ Gets the default brush data setting. These settings can be found in toolsculptbrushbase.h.
- Return type
- Returns
The container containing all the default brush settings.
-
SculptModifierInterface.
GetModifierCount
(self)¶ 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
(self, 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
(self, 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 toApplyModifier()
.Operations that take time are things such as enabling stamps, changing a stamps texture, calculation of the falloff values etc…- Parameters
brushData (c4d.BaseContainer) – The brush data settings. By default you can just use the container returned by
GetDefaultData()
.modifierData (c4d.BaseContainer) –
The settings for the modifier itself. Each modifier is aBaseList2D
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
(self, 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 (c4d.BaseContainer) – The brush data settings. By default you can just use the container returned by
GetDefaultData()
.modifierData (c4d.BaseContainer) –
The settings for the modifier itself. Each modifier is aBaseList2D
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
(self, 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 (c4d.BaseContainer) – The brush data settings. By default you can just use the container returned by
GetDefaultData()
.modifierData (c4d.BaseContainer) –
The settings for the modifier itself. Each modifier is aBaseList2D
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 (c4d.Vector) – The exact hitpoint on the surface of a polygon that is connected to the passed vertex.
lasthitpoint (c4d.Vector) –
The last hitpoint from the previous call toApplyModifier()
.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.