c4d.VariableTag

class c4d.VariableTag

A tag class that can store multiple elements with variable data size.

See also

Variable Tag Types.

Methods Signatures

VariableTag.__init__(self, type, count)

Creates a VariableTag.

VariableTag.GetAllHighlevelData(self)

Gets the data for the variable tag.

VariableTag.SetAllHighlevelData(self, data)

Sets the data for the variable tag.

VariableTag.GetDataCount(self)

Gets the number of data elements in the variable tag.

VariableTag.GetDataSize(self)

Gets the size of one data element in bytes.

VariableTag.GetLowlevelDataAddressW(self)

Gets the writable buffer object for the variable tag’s data.

VariableTag.GetLowlevelDataAddressR(self)

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 VariableTag children classes to create a UVWTag, NormalTag, PointTag etc.

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.Vector

    The points.

    Tpolygon

    list of c4d.CPolygon

    The 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 / NormalTag data contains 12 times more elements than GetDataCount() 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.