c4d.VariableTag¶
-
class
c4d.VariableTag¶ A tag class that can store multiple elements with variable data size.
See also
Methods Signatures
Creates a |
Gets the data for the variable tag. |
|
Sets the data for the variable tag. |
|
Gets the number of data elements in the variable tag. |
|
Gets the size of one data element in bytes. |
|
Gets the writable buffer object for the variable tag’s data. |
|
Gets the read-only buffer object for the variable tag’s data. |
Inheritance
Parent Class:
Children Classes:
Methods Documentation
-
VariableTag.__init__(self, type, count)¶ Creates a
VariableTag.Note
Use
VariableTagchildren classes to create aUVWTag,NormalTag,PointTagetc.Here is how to create a vertex map tag and add it to the current polygon object.
tag = c4d.VariableTag(c4d.Tvertexmap, op.GetPointCount()) op.InsertTag(tag) c4d.EventAdd()
- Parameters
type (int) –
The variable tag type:
The table lists the supported variable tags by
VariableTag.GetAllHighlevelData()/SetAllHighlevelData()and their corresponding data.Tag
Data
Description
Tpoint
list of
c4d.VectorThe points.
Tpolygon
list of
c4d.CPolygonThe polygons.
Ttangent
list of (
c4d.Vector,c4d.Vector)The tangents left and right interpolation.
Tsegment
list of dict{cnt: int, closed: bool}
The segments number of points and closed state.
Tline
list of dict{pos: float, t: float}
The line points percentage position and original spline point.
Tvertexmap
list of float
The vertex map values.
Tnormal
List[int]eger
The normals. Note: Contains 12 times more elements than
VariableTag.GetDataCount()returns.Tvertexcolor
list of dict{a, b, c, d:
c4d.Vector4d}The vertex colors for a polygon.
Tsoftselection
list of float
The soft selection values.
count (int) – The number of data elements in the tag.
-
VariableTag.GetAllHighlevelData(self)¶ Gets the data for the variable tag.
The following code prints the weights from a vertex map tag.
tag = op.GetTag(c4d.Tvertexmap) if tag: print(tag.GetAllHighlevelData())
Note
See warning in
GetDataCount()for Tnormal /NormalTag.- Return type
Any
- Returns
The data for the variable tag. See table in Variable Tag Types.
-
VariableTag.SetAllHighlevelData(self, data)¶ Sets the data for the variable tag.
Note
See warning in
GetDataCount()for Tnormal /NormalTag.- Parameters
data (any) – The data for the variable tag. See table in :doc:
/types/tags_variable.
-
VariableTag.GetDataCount(self)¶ Gets the number of data elements in the variable tag.
Warning
The Tnormal /
NormalTagdata contains 12 times more elements thanGetDataCount()returns.- Return type
int
- Returns
The number of data elements.
-
VariableTag.GetDataSize(self)¶ Gets the size of one data element in bytes.
- Return type
int
- Returns
The byte size of a data element.
-
VariableTag.GetLowlevelDataAddressW(self)¶ Gets the writable buffer object for the variable tag’s data.
Warning
Use with special care. Only if the host tag is still alive.
- Return type
memoryview
- Returns
The buffer object.
-
VariableTag.GetLowlevelDataAddressR(self)¶ Gets the read-only buffer object for the variable tag’s data.
Warning
Use with special care.
- Return type
memoryview
- Returns
The buffer object.