About
A CustomDataTag is a BaseTag that stores custom point or polygon data. It is a generalized tag type to store mesh-based data like normals, UVs, vertex colors etc. It can replace dedicated tags like NormalTag, UVWTag or VertexColorTag.
A CustomDataTag gives access to data and functionality implemented with maxon::MeshAttribute, maxon::MeshAttributeClassInterface, maxon::CustomDataTagClassInterface and maxon::CustomDataTagDisplayInterface (see Mesh Attributes Interfaces).
Creation
A CustomDataTag object is created using the usual tools and the specific data type ID:
- CustomDataTag::Alloc(): Creates a new CustomDataTag.
- CustomDataTag::Free(): Deletes the given CustomDataTag.
- CustomDataTag::InitData(): Initializes the data. Must be called after the tag is added to the PolygonObject.
- CustomDataTag::Resize(): Resizes the internal data.
BaseTag* const tag = CustomDataTag::Alloc(ID_VERTEXSCALARTAG);
if (tag == nullptr)
polygonObject->InsertTag(tag);
CustomDataTag* const customDataTag = static_cast<CustomDataTag*>(tag);
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
VERTEX
Definition: lib_customdatatag.h:0
#define iferr_return
Definition: resultbase.h:1531
Data Type
The data type stored in a given CustomDataTag is obtained with:
Data
A CustomDataTag can stores either point data (CUSTOMDATATAG_MODE::VERTEX) or polygon point data (CUSTOMDATATAG_MODE::POLYVERTEX):
- CustomDataTag::GetMode(): Returns the current mode.
- CustomDataTag::SetMode(): Sets the current mode.
The number of stored elements is returned with:
- CustomDataTag::GetComponentCount(): Returns the number of stored elements.
The stored vertex data is accessed with these functions:
- CustomDataTag::GetConstVertexDataPtr(): Returns a read-only pointer to the data at the given index.
- CustomDataTag::GetVertexDataPtr(): Returns a pointer to the data at the given index.
- CustomDataTag::SetVertexDataPtr(): Sets the data at the given index.
- CustomDataTag::GetVertexAttribute(): Returns the maxon::MeshAttribute at the given index.
- CustomDataTag::SetVertexAttribute(): Sets the maxon::MeshAttribute at the given index.
- CustomDataTag::GetVertexData(): Returns a read-only reference to the data at the given index.
- CustomDataTag::GetVertexDataRef(): Returns a reference to the data at the given index. Uses GetVertexDataPtr() internally
- CustomDataTag::SetVertexData(): Sets the data at the given index.
const Int count = customDataTag->GetComponentCount();
{
customDataTag->SetVertexData<
Float>(
i, std::move(
value));
}
Py_ssize_t i
Definition: abstract.h:645
Py_ssize_t count
Definition: abstract.h:640
PyObject * value
Definition: abstract.h:715
Definition: lib_math.h:19
FLOAT Get01()
Returns the next random value in the range of [0..1].
maxon::Int32 Int32
Definition: ge_sys_math.h:51
maxon::Float Float
Definition: ge_sys_math.h:57
maxon::Int Int
Definition: ge_sys_math.h:55
The stored polygon data is accessed with:
- CustomDataTag::GetConstPolyVertexDataPtr(): Returns a read-only pointer to the data at the given polygon and point index.
- CustomDataTag::GetPolyVertexDataPtr(): Returns a pointer to the data at the given polygon and point index.
- CustomDataTag::SetPolyVertexDataPtr(): Sets the data at the given polygon and point index.
- CustomDataTag::GetConstPolygonDataPtr(): Returns a read-only pointer to maxon::PolyData for the given polygon index.
- CustomDataTag::GetPolygonDataPtr(): Returns a pointer to maxon::PolyData for the given polygon index.
- CustomDataTag::SetPolygonDataPtr(): Sets the maxon::PolyData for the given polygon index.
- CustomDataTag::GetPolyVertexAttribute(): Returns the maxon::MeshAttribute for the given polygon and point index.
- CustomDataTag::SetPolyVertexAttribute(): Sets the maxon::MeshAttribute for the given polygon and point index.
- CustomDataTag::GetPolygonAttribute(): Returns the maxon::PolyData maxon::MeshAttribute for the given polygon index.
- CustomDataTag::SetPolygonAttribute(): Sets the maxon::PolyData maxon::MeshAttribute for the given polygon index.
- CustomDataTag::GetPolyVertexData(): Returns the read-only data for the given polygon and point index.
- CustomDataTag::GetPolyVertexDataRef(): Returns a reference to the data for the given polygon and point index.
- CustomDataTag::SetPolyVertexData(): Sets the data for the given polygon and point index.
- CustomDataTag::GetPolygonData(): Returns the maxon::PolyData for the given polygon index.
- CustomDataTag::GetPolygonDataRef(): Returns a reference to the maxon::PolyData for the given polygon index.
- CustomDataTag::SetPolygonData(): Sets the maxon::PolyData for the given polygon index.
const Int count = customDataTag->GetComponentCount();
{
for (
Int32 polyvertexIndex = 0; polyvertexIndex < 4; ++polyvertexIndex)
{
}
}
Float64 Float
Definition: apibase.h:196
The maxon::PolyData template class stores data for either a triangle or quad:
for (
Int32 polygonIndex = 0; polygonIndex < polyCount; ++polygonIndex)
{
for (
Int32 pointIndex = 0; pointIndex < 4; ++pointIndex)
{
const maxon::Int colorIndex = 4 * polygonIndex + pointIndex;
cds.vertex_color[colorIndex] =
static_cast<Color32>(color);
}
}
cds.perPolygonVertexColor = true;
Definition: mesh_attribute_utilities.h:14
Int64 Int
signed 32/64 bit int, size depends on the platform
Definition: apibase.h:187
float Float32
32 bit floating point value (float)
Definition: apibase.h:181
Col3< Float32, 1 > Color32
Definition: vector.h:76
Further Reading