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 (void)
 
VertexColorHandle GetDataAddressW (void)
 
Bool IsPerPointColor ()
 
Bool SetPerPointMode (Bool perPointColor)
 
- Public Member Functions inherited from VariableTag
Int32 GetDataCount (void)
 
Int32 GetDataSize (void)
 
const void * GetLowlevelDataAddressR (void)
 
void * GetLowlevelDataAddressW (void)
 
- Public Member Functions inherited from BaseTag
BaseTagGetNext (void)
 
BaseTagGetPred (void)
 
BaseObjectGetObject (void)
 
BaseTagGetOrigin ()
 
- Public Member Functions inherited from BaseList2D
BaseList2DGetNext (void)
 
BaseList2DGetPred (void)
 
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits (void) const
 
void SetAllBits (Int32 bits)
 
BaseContainer GetData (void)
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance (void) const
 
BaseContainerGetDataInstance (void)
 
const BaseContainerGetDataInstanceRef (void) const
 
BaseContainerGetDataInstanceRef (void)
 
const StringGetName (void) const
 
void SetName (const String &name)
 
String GetBubbleHelp (void)
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit (void)
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot (void)
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
const StringGetTypeName (void)
 
BaseList2DGetMain (void) 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 (void)
 
BaseOverrideGetFirstOverride (void)
 
GeListHeadGetShaderRepositoryRoot (void)
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker (void) 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 (void)
 
CTrackGetFirstCTrack (void)
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext (void)
 
GeListNodeGetPred (void)
 
GeListNodeGetDown (void)
 
GeListNodeGetUp (void)
 
GeListNodeGetDownLast (void)
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove (void)
 
GeListHeadGetListHead (void)
 
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 (void)
 
BaseDocumentGetDocument (void)
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated (void)
 
Int32 GetInfo (void)
 
Bool GetNBit (NBIT bit) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType (void) const
 
Int32 GetRealType (void) const
 
Int32 GetDiskType (void) const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification (void) 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 Vector4d32 Get (ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
 
static void Set (VertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex, const Vector4d32 &color)
 
static Vector32 GetColor (ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
 
static void SetColor (VertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex, const Vector32 &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 ()
 

Constructor & Destructor Documentation

§ VertexColorTag()

VertexColorTag ( )
private

§ ~VertexColorTag()

~VertexColorTag ( )
private

Member Function Documentation

§ GetDataAddressR()

ConstVertexColorHandle GetDataAddressR ( void  )

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 ( void  )

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 successfull, 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)
}
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);
}
Parameters
[in]dataptrThe data handle.
[in]iThe polygon index.
[in]sThe Vertex Color data to be set to the polygon.

§ Get() [2/2]

static Vector4d32 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 Vector4d32 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 Vector32 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 Vector32 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.