VertexColorTag Class Reference

#include <c4d_basetag.h>

Inheritance diagram for VertexColorTag:

Detailed Description

VertexColorTag is a Variable Tag used to store colors (RGBA) into the mesh structure. It can store data in 2 ways: per polygon vertex and per mesh vertex.

Using per polygon vertex mode the tag provides all methods to set/get color per polygons or per vertex(average). It also provides some convenience functions to get/set just color or just alpha value in both modes.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
Since
R18

Public Member Functions

ConstVertexColorHandle GetDataAddressR () const
 
VertexColorHandle GetDataAddressW ()
 
Bool IsPerPointColor ()
 
Bool SetPerPointMode (Bool perPointColor)
 
- Public Member Functions inherited from VariableTag
Int32 GetDataCount () const
 
Int32 GetDataSize () const
 
maxon::UniqueHash GetDataHash () const
 
const void * GetLowlevelDataAddressR () const
 
void * GetLowlevelDataAddressW ()
 
- Public Member Functions inherited from BaseTag
Bool Draw (BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)
 
BaseTagGetNext ()
 
BaseTagGetPred ()
 
BaseObjectGetObject ()
 
BaseTagGetOrigin ()
 
- Public Member Functions inherited from BaseList2D
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
String GetName () const
 
void SetName (const maxon::String &name)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot ()
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName ()
 
BaseList2DGetMain () const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot ()
 
GeListHeadGetHiddenShaderRoot ()
 
maxon::NimbusForwardRef GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusForwardRefPrivateGetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::NimbusForwardRef > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
GeListNodeGetPred ()
 
GeListNodeGetDown ()
 
GeListNodeGetUp ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
GeListHeadGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData ()
 
BaseDocumentGetDocument ()
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated ()
 
Int32 GetInfo () const
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 

Static Public Member Functions

static void Get (ConstVertexColorHandle dataptr, Int32 i, VertexColorStruct &res)
 
static void Set (VertexColorHandle dataptr, Int32 i, const VertexColorStruct &s)
 
static maxon::ColorA32 Get (ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
 
static void Set (VertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex, const maxon::ColorA32 &color)
 
static maxon::Color32 GetColor (ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
 
static void SetColor (VertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex, const maxon::Color32 &color)
 
static Float32 GetAlpha (ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
 
static void SetAlpha (VertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex, Float32 value)
 
static VertexColorTagAlloc (Int32 count)
 
static void Free (VertexColorTag *&bl)
 
- Static Public Member Functions inherited from VariableTag
static VariableTagAlloc (Int32 type, Int32 count)
 
static void Free (VariableTag *&bl)
 
- Static Public Member Functions inherited from BaseTag
static BaseTagAlloc (Int32 type)
 
static void Free (BaseTag *&bl)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 

Private Member Functions

 VertexColorTag ()
 
 ~VertexColorTag ()
 

Additional Inherited Members

- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ VertexColorTag()

VertexColorTag ( )
private

◆ ~VertexColorTag()

~VertexColorTag ( )
private

Member Function Documentation

◆ GetDataAddressR()

ConstVertexColorHandle GetDataAddressR ( ) const

Gets the read-only data handle. It automatically recognizes if the tag is per vertex or per polygon vertex.

Returns
The handle to the read-only VertexColor data. The tag owns the pointed data.

◆ GetDataAddressW()

VertexColorHandle GetDataAddressW ( )

Gets the writable data handle. It automatically recognizes if the tag is per vertex or per polygon vertex.

Returns
The handle to the writable VertexColor data. The tag owns the pointed data.

◆ IsPerPointColor()

Bool IsPerPointColor ( )

Checks if the data is stored per vertex or per polygon vertex.

Returns
true if colors are stored per vertex, otherwise false.

◆ SetPerPointMode()

Bool SetPerPointMode ( Bool  perPointColor)

Sets wether the data is stored per vertex or per polygon vertex.

Note
The item count is automatically updated and the data converted if possible.
Warning
All handles are invalidated after this call.
Parameters
[in]perPointColorIf true the data will be stored per vertex otherwise per polygon vertex.
Returns
true if successful, otherwise false.

◆ Get() [1/2]

static void Get ( ConstVertexColorHandle  dataptr,
Int32  i,
VertexColorStruct res 
)
static

Retrieves the Vertex Colors for the polygon i in per polygon vertex mode.
Example:

ConstVertexColorHandle dataptr = ((VertexColorTag*)tag)->GetDataAddressR()
for (Int32 i = 0; i < faceCount; ++i)
{
VertexColorTag::Get(dataptr, faces[i], vcs);
// Do something with vcs (you can just read values)
}
Py_ssize_t i
Definition: abstract.h:645
Definition: c4d_basetag.h:824
static void Get(ConstVertexColorHandle dataptr, Int32 i, VertexColorStruct &res)
Definition: c4d_basetag.h:874
maxon::Int32 Int32
Definition: ge_sys_math.h:60
const void * ConstVertexColorHandle
Handle for read-only vertex color data. See also VertexColorTag.
Definition: operatingsystem.h:466
Definition: operatingsystem.h:659
Parameters
[in]dataptrThe data handle.
[in]iThe polygon index.
[out]resThe retrieved Vertex Color data.

◆ Set() [1/2]

static void Set ( VertexColorHandle  dataptr,
Int32  i,
const VertexColorStruct s 
)
static

Sets the Vertex Colors Unclamped for the polygon i in per polygon vertex mode.
Example:

VertexColorHandle dataptr = ((VertexColorTag*)tag)->GetDataAddressW()
for (Int32 i = 0; i < faceCount; ++i)
{
VertexColorTag::Get(dataptr, faces[i], vcs);
// Do something with vcs (e.g. write values)
for (Int32 a = 0; a < 4; ++a)
vcs[a] = Vecor4d32(1, 0, 0, 0.5);
// Do not forget to set values again
VertexColorTag::Set(dataptr, faces[i], vcs);
}
static void Set(VertexColorHandle dataptr, Int32 i, const VertexColorStruct &s)
Definition: c4d_basetag.h:896
void * VertexColorHandle
Handle for vertex color data. See also VertexColorTag.
Definition: operatingsystem.h:465
Parameters
[in]dataptrThe data handle.
[in]iThe polygon index.
[in]sThe Vertex Color data to be set to the polygon.

◆ Get() [2/2]

static maxon::ColorA32 Get ( ConstVertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex 
)
static

Retrieves the Vertex Color for the vertex pIndex traversing all polygons attached to it.

Note
If different values are found the average value will be returned.
Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part.
[in]vadrThe object CPolygon array. Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
Returns
The RGBA color for the passed vertex or the average color if multiple values were found.

◆ Set() [2/2]

static void Set ( VertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex,
const maxon::ColorA32 color 
)
static

Sets the Vertex Color for the vertex pIndex traversing all polygons attached to it.

Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part. Pass nullptr if in per vertex mode.
[in]vadrThe object CPolygon array. Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
[in]colorThe new RGBA value to be assigned to the vertex.

◆ GetColor()

static maxon::Color32 GetColor ( ConstVertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex 
)
static

Retrieves the Vertex Color for the vertex pIndex.

Note
If in per polygon vertex mode it traverses all polygons attached to it. If different values are found in per polygon vertex mode then the average value will be returned.
Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part. Pass nullptr if in per vertex mode.
[in]vadrThe object CPolygon array. Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
Returns
The RGB color for the passed vertex or the average color if multiple values were found.

◆ SetColor()

static void SetColor ( VertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex,
const maxon::Color32 color 
)
static

Sets the Vertex Color for the vertex pIndex.

Note
If in per polygon vertex mode it traverses all polygons attached to it.
Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part. Pass nullptr if in per vertex mode.
[in]vadrThe object CPolygon array Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
[in]colorThe new RGB value to be assigned to the Vertex Color.

◆ GetAlpha()

static Float32 GetAlpha ( ConstVertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex 
)
static

Retrieves the Vertex Color alpha value for the vertex pIndex.

Note
| If in per polygon vertex mode it traverses all polygons attached to it. | If different values are found in per polygon vertex mode then the average value will be returned.
Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part. Pass nullptr if in per vertex mode.
[in]vadrThe object CPolygon array Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
Returns
The alpha value for the passed vertex or the average alpha value if multiple values were found.

◆ SetAlpha()

static void SetAlpha ( VertexColorHandle  dataptr,
Neighbor nb,
const CPolygon vadr,
Int32  pIndex,
Float32  value 
)
static

Sets the Vertex Color alpha value for the vertex pIndex.

Note
If in per polygon vertex mode it traverses all polygons attached to it.
Parameters
[in]dataptrThe data handle.
[in]nbA Neighbor helper class. Can be initialized with a polygon selection to limit the function to a specific object part. Pass nullptr if in per vertex mode.
[in]vadrThe object CPolygon array Pass nullptr if in per vertex mode.
[in]pIndexThe vertex index.
[in]valueThe new alpha value to be assigned to the vertex.

◆ Alloc()

static VertexColorTag* Alloc ( Int32  count)
static

Allocates a VertexColorTag instance. Destroy the allocated VertexColorTag instance with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]countThe element count in the tag. Must be equal to the object polygon count if in per polygon vertex storage, otherwise must be equal to the object point count.
Returns
The allocated VertexColorTag instance, or nullptr if the allocation failed.

◆ Free()

static void Free ( VertexColorTag *&  bl)
static

Destructs vertex color tags allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in]blThe VertexColorTag instance to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.