VariationShaderData Class Reference

#include <c4d_variationshaderdata.h>

Inheritance diagram for VariationShaderData:

Public Types

typedef NodeData SUPER
 
- Public Types inherited from NodeData
typedef PrivateChunk SUPER
 

Public Member Functions

virtual Bool IsInstanceOf (cineware::Int32 id) const
 
- Public Member Functions inherited from NodeData
 NodeData ()
 
BaseList2DGetNode ()
 
void SetNode (BaseList2D *ptr)
 
BaseTagGetTag (Int32 id)
 
BaseTagMakeTag (Int32 id)
 
- Public Member Functions inherited from PrivateChunk
 PrivateChunk ()
 
Bool ReadChunk (HyperFile *hf, Bool keepin=false, Bool noheader=false)
 
virtual Bool IsListHead ()
 
virtual Int32 GetType () const
 
virtual Int32 GetInstanceType () const
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf, Int32 type)
 
Bool CopyTo (PrivateChunk *dest, COPYFLAGS flags, AliasTrans *trans)
 
virtual Bool GetDParameter (const DescID &id, GeData &data)
 
virtual Bool SetDParameter (const DescID &id, const GeData &data)
 
Bool GetParameter (Int32 id, GeData &data)
 
Bool SetParameter (Int32 id, const GeData &data)
 
Bool GetParameter (const DescID &id, GeData &data)
 
Bool SetParameter (const DescID &id, const GeData &data)
 
virtual Int32 GetChunkLevel ()
 
- Public Member Functions inherited from GeTempPublicNode2D< PrivateChunk >
PrivateChunkGetNext () const
 
PrivateChunkGetPrev () const
 
void InsertBefore (PrivateChunk *n)
 
void InsertAfter (PrivateChunk *n)
 
void Remove ()
 

Private Member Functions

virtual Bool Init ()
 
virtual void Free ()
 

Allocation/Free

static VariationShaderDataAlloc ()
 
static void Free (VariationShaderData *&v)
 

Read/Write

virtual Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 

Add / Remove textures

Bool AddTextureLayer (TextureLayer layerData)
 
TextureLayer GetTextureLayer (Int32 textureId)
 
Bool RemoveTextureLayer (Int32 textureId)
 
Bool RemoveAllTextures ()
 
Int32 GetTextureCount ()
 
Bool GetActive (Int32 textureId)
 
Bool SetActive (Int32 textureId, Bool active)
 
Float GetPropability (Int32 textureId)
 
Bool SetPropability (Int32 textureId, Float probability)
 
Bool Distribute (DISTRIBUTION dis)
 

Additional Inherited Members

- Protected Member Functions inherited from NodeData
virtual Bool Execute ()
 
virtual Int32 GetDiskType () const
 
virtual Bool CopyToX (PrivateChunk *dst, COPYFLAGS flags, AliasTrans *trans)
 
virtual Bool TranslateDescID (GeListNode *node, const DescID &id, DescID &res_id, GeListNode *&res_at)
 
- Protected Member Functions inherited from PrivateChunk
virtual Bool HandleSubChunk (HyperFile *hf, Int32 id, Int32 level)
 

Detailed Description

Node data class for Cinema 4D's Variation shader.

Member Typedef Documentation

◆ SUPER

typedef NodeData SUPER

Member Function Documentation

◆ IsInstanceOf()

virtual Bool IsInstanceOf ( cineware::Int32  id) const
virtual

Reimplemented from NodeData.

◆ Init()

virtual Bool Init ( )
privatevirtual

Called when an instance of a derived node data class needs to be initialized.

Returns
true if successful, otherwise false.

Reimplemented from NodeData.

◆ Free() [1/2]

virtual void Free ( )
privatevirtual

Reimplemented from NodeData.

◆ Alloc()

static VariationShaderData* Alloc ( )
static

Allocates a VariationShaderData. Destroy the allocated VariationShaderData with Free().

Returns
The allocated VariationShaderData, or nullptr if the allocation failed.

◆ Free() [2/2]

static void Free ( VariationShaderData *&  v)
static

Destructs VariationShaderData allocated with Alloc().

Parameters
[in,out]vThe VariationShaderData to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Read()

virtual Bool Read ( HyperFile hf,
Int32  id,
Int32  level 
)
virtual

Reads the variation shader data from a hyper file.

Parameters
[in]hfThe hyper file to read from. The caller owns the pointed hyper file.
[in]idThe ID of the node to read.
[in]levelThe disklevel of the node to read.
Returns
true if successful, otherwise false.

Reimplemented from NodeData.

◆ Write()

Bool Write ( HyperFile hf)
virtual

Writes the variation shader to a hyper file.

Parameters
[in]hfThe hyper file to write to. The caller owns the pointed hyper file.

Reimplemented from PrivateChunk.

◆ AddTextureLayer()

Bool AddTextureLayer ( TextureLayer  layerData)

Adds a new texture layer.

Note
A passed shader will be added automatically, a nullptr will just keep the link empty.
Parameters
[in]layerDataThe data to be used for the new texture layer.
Returns
true if the texture layer was successfully added, otherwise false.

◆ GetTextureLayer()

TextureLayer GetTextureLayer ( Int32  textureId)

Gets the data of the texture layer.

Parameters
[in]textureIdThe ID to get the data for.
Returns
The texture layer data.

◆ RemoveTextureLayer()

Bool RemoveTextureLayer ( Int32  textureId)

Removes a texture layer.

Note
If there is only one texture layer nothing will be removed.
Parameters
[in]textureIdThe ID of the texture layer to remove.
Returns
true if the texture layer was successfully removed, otherwise false.

◆ RemoveAllTextures()

Bool RemoveAllTextures ( )

Removes all texture layers from the shader list except the first one.

Returns
true if all texture layers were successfully removed, otherwise false.

◆ GetTextureCount()

Int32 GetTextureCount ( )

Returns the amount of textures the shader list contains.

Note
The minimum amount of textures is 1.
Returns
The number of textures the shader list contains.

◆ GetActive()

Bool GetActive ( Int32  textureId)

Returns the activation state of the texture layer.

Parameters
[in]textureIdThe ID of the layer to get the state for.
Returns
true if the texture layer is active, otherwise false.

◆ SetActive()

Bool SetActive ( Int32  textureId,
Bool  active 
)

Enables or disables a texture layer.

Parameters
[in]textureIdThe ID of the texture to set the state for.
[in]activetrue to enable or or false to disable the layer.
Returns
true if the state could be set, otherwise false.

◆ GetPropability()

Float GetPropability ( Int32  textureId)

Returns the probability of the texture layer.

Parameters
[in]textureIdThe ID of the layer to get the probability for.
Returns
The probability.

◆ SetPropability()

Bool SetPropability ( Int32  textureId,
Float  probability 
)

Sets the probability for the texture layer.

Parameters
[in]textureIdThe ID of the texture to set the probability for.
[in]probabilityThe new probability value of the layer.
Returns
true if the probability could be set, otherwise false.

◆ Distribute()

Bool Distribute ( DISTRIBUTION  dis)

Distributes the probability values for all textures in the shader list.

Note
For normalized distribution at least 2 textures are needed. Otherwise the single one value will not be changed.
Parameters
[in]disThe type of distribution: DISTRIBUTION
Returns
true if the distribution was successful, otherwise false.