BaseMaterial Class Reference

#include <c4d_basematerial.h>

Inheritance diagram for BaseMaterial:

Public Types

typedef BaseList2D SUPER
 
- Public Types inherited from BaseList2D
typedef GeListNode SUPER
 
- Public Types inherited from GeListNode
typedef PrivateChunk SUPER
 

Public Member Functions

virtual Bool IsInstanceOf (melange::Int32 id) const
 
- Public Member Functions inherited from BaseList2D
 BaseList2D ()
 
virtual ~BaseList2D ()
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
NodeDataGetNodeData ()
 
void SetNodeData (NodeData *data)
 
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask)
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits ()
 
void SetAllBits (Int32 bits)
 
BaseContainer GetData ()
 
BaseContainerGetDataInstance ()
 
BaseContainerGetDataInstanceRef ()
 
const StringGetName ()
 
void SetName (const String &new_name)
 
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
 
BaseShaderGetFirstShader ()
 
Bool InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
Bool InsertShaderLast (BaseShader *shader)
 
RootCTrackGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
Bool AppendCTrack (CTrack *t)
 
void InsertTrackSorted (CTrack *track)
 
LayerObjectGetLayerObject ()
 
void SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
DynamicDescriptionGetDynamicDescription ()
 
virtual Bool IsBaseList ()
 
virtual void Remove ()
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
RootPluginNodeGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
virtual Bool TranslateDescID (const DescID &id, DescID &res_id, GeListNode *&res_at)
 
- Public Member Functions inherited from GeListNode
 GeListNode ()
 
 ~GeListNode ()
 
virtual Bool GetNBit (Int32 bit) const
 
virtual Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
BaseDocumentGetDocument ()
 
virtual Int32 GetInfo ()
 
GeListNodeGetPred ()
 
GeListNodeGetNext ()
 
GeListNodeGetUp ()
 
GeListNodeGetDown ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *op)
 
void InsertAfter (GeListNode *op)
 
void Remove ()
 
void InsertUnder (GeListNode *op)
 
void InsertUnderLast (GeListNode *op)
 
RootList2DGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
- Public Member Functions inherited from PrivateChunk
 PrivateChunk ()
 
Bool ReadChunk (HyperFile *hf, Bool keepin=false, Bool noheader=false)
 
virtual Bool IsListHead ()
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf, Int32 type)
 
Bool CopyTo (PrivateChunk *dest, COPYFLAGS flags, AliasTrans *trans)
 
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)
 
- Public Member Functions inherited from GeTempPublicNode2D< PrivateChunk >
PrivateChunkGetNext () const
 
PrivateChunkGetPrev () const
 
void InsertBefore (PrivateChunk *n)
 
void InsertAfter (PrivateChunk *n)
 
void Remove ()
 

Public Attributes

Bool _hasNimbus
 
Int _nimbusXmlUnknownDataLength
 
void * _nimbusXmlUnknownData
 
Int _nimbusNodesUnknownDataLength
 
void * _nimbusNodesUnknownData
 

Protected Member Functions

 BaseMaterial (Int32 typeID=NOTOK, Int32 pID=NOTOK)
 
virtual Bool GetDParameter (const DescID &id, GeData &data)
 
virtual Bool SetDParameter (const DescID &id, const GeData &data)
 
virtual Int32 GetInstanceType () const
 
virtual Int32 GetChunkLevel ()
 
- Protected Member Functions inherited from BaseList2D
void SetID (Int32 id)
 

Private Attributes

BaseBitmap preview_image
 

Alloc/Free

static BaseMaterialAlloc (Int32 type)
 
static void Free (BaseMaterial *&bl)
 

Clone

virtual BaseList2DGetClone (COPYFLAGS flags, AliasTrans *trans)
 

Navigation

BaseMaterialGetNext ()
 
BaseMaterialGetPred ()
 

Type

virtual Int32 GetType () const
 
Bool HasNimbusRef () const
 
virtual Int32 GetDiskType () const
 

Preview

BaseBitmapGetPreview ()
 

Alien Overload

virtual Bool Execute ()
 

Private

virtual Bool CopyToX (PrivateChunk *dst, COPYFLAGS flags, AliasTrans *trn)
 
virtual Bool HandleSubChunk (HyperFile *hf, Int32 id, Int32 level)
 
virtual Bool Write (HyperFile *hf)
 

Additional Inherited Members

- Protected Attributes inherited from BaseList2D
Int32 m_id
 
RootShader mp_rootshader
 
RootShader root_shader_repository
 
Int32 l_bitfeld
 
RootCTrack mp_rootctrack
 
RootPluginNode root_override
 
NotifyListnotify_events
 
DescIdStorekeyframestore
 
DescIdStorepropstore
 
BaseContainer m_bc
 
NodeDatam_data
 
- Protected Attributes inherited from GeListNode
GeAliasGoal m_xgoal
 
UInt32 m_bits [4]
 
RootList2Dt_rootlist_parent
 
RootList2Dm_children
 
BaseDocumentparent_doc
 
void * unknownData
 
Int unknownDataSize
 
Int32 unknownDataLevel
 
Int32 pluginID
 

Detailed Description

The material base class that all materials in Cinema 4D are derived from.

Note
Has to be created with Alloc() and destroyed with Free().

Member Typedef Documentation

◆ SUPER

typedef BaseList2D SUPER

Constructor & Destructor Documentation

◆ BaseMaterial()

BaseMaterial ( Int32  typeID = NOTOK,
Int32  pID = NOTOK 
)
protected

Member Function Documentation

◆ IsInstanceOf()

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

Reimplemented from BaseList2D.

Reimplemented in Material.

◆ GetDParameter()

virtual Bool GetDParameter ( const DescID id,
GeData data 
)
protectedvirtual

Reimplemented from BaseList2D.

Reimplemented in Material.

◆ SetDParameter()

virtual Bool SetDParameter ( const DescID id,
const GeData data 
)
protectedvirtual

Reimplemented from BaseList2D.

Reimplemented in Material.

◆ GetInstanceType()

virtual Int32 GetInstanceType ( ) const
protectedvirtual

Reimplemented from BaseList2D.

◆ GetChunkLevel()

virtual Int32 GetChunkLevel ( )
protectedvirtual

Reimplemented from PrivateChunk.

◆ Alloc()

static BaseMaterial* Alloc ( Int32  type)
static

Allocates a base material. Destroy the allocated base material with Free().

Parameters
[in]typeA material type ID.

◆ Free()

static void Free ( BaseMaterial *&  bl)
static

Destructs base materials allocated with Alloc().

Parameters
[in,out]blThe base material to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetClone()

virtual BaseList2D* GetClone ( COPYFLAGS  flags,
AliasTrans trans 
)
virtual

Gets a clone/copy of the base material.

Parameters
[in]flagsFlags for the clone.
[in]transAn alias translator for the operation. Can be nullptr. The caller owns the pointed alias translator.
Returns
The cloned base material. The caller owns the pointed base material.

Reimplemented from BaseList2D.

◆ GetNext()

BaseMaterial* GetNext ( )

Gets the next base material in the list.

Returns
The next base material, or nullptr if there is none. Melange owns the pointed base material.

◆ GetPred()

BaseMaterial* GetPred ( )

Gets the previous base material in the list.

Returns
The previous base material, or nullptr if there is none. Melange owns the pointed base material.

◆ GetType()

virtual Int32 GetType ( ) const
virtual

Gets the type of the base material.

Warning
Must be used to make sure that the derived tag really is of the right type before casting it and accessing its members.
Note
Plugin materials return their unique plugin IDs.
Returns
The base material type, for example Mbanzi.

Reimplemented from BaseList2D.

◆ HasNimbusRef()

Bool HasNimbusRef ( ) const

Check if the base material is a node material.

Since
R20
Returns
true if it is a node material, otherwise false.

◆ GetDiskType()

virtual Int32 GetDiskType ( ) const
virtual

Gets the base material's unique disk type.

Note
Normally this is the same as GetType(), but there are exceptions.
Returns
The base material's unique disk type.

Reimplemented from BaseList2D.

◆ GetPreview()

BaseBitmap* GetPreview ( )

Gets the preview picture of the base material.

Returns
The preview picture, or nullptr if none has been calculated. The base material owns the pointed bitmap.

◆ Execute()

virtual Bool Execute ( )
virtual

Overload this for self defined plugin materials.

Bool AlienBaseMaterial::Execute()
{
Char* pName = GetName().GetCStringCopy();
if (pName)
{
printf("\n - AlienPluginMaterial (%d): %s\n", (int)GetType(), pName);
DeleteMem(pName);
}
else
printf("\n - AlienPluginMaterial (%d): <noname>\n", (int)GetType());
PrintUniqueIDs(this);
// Assign a id to the material
id = tempmatid;
tempmatid++;
switch(GetType())
{
case Mmaterial: printf("Cinema Material\n");
break;
case Msketch: printf("Sketch & Toon Material\n");
break;
case Mdanel: printf("Danel Shader Material\n");
break;
case Mbanji: printf("Banji Shader Material\n");
break;
case Mbanzi: printf("Banzi Shader Material\n");
break;
case Mcheen: printf("Cheen Shader Material\n");
break;
case Mmabel: printf("Mabel Shader Material\n");
break;
case Mnukei: printf("Nukei Shader Material\n");
break;
case SKY_II_SKY_SURFACE_MATERIAL: printf("Sky Material (hidden)\n");
break;
case Mfog: printf("Fog Shader Material\n");
break;
case Mterrain: printf("Terrain Shader Material\n");
break;
case Mhair: printf("Hair Shader Material\n");
break;
default: printf("unknown plugin material\n");
}
return true;
}
Returns
true if the material type is supported by the external application, otherwise false.

Reimplemented in Material.

◆ CopyToX()

virtual Bool CopyToX ( PrivateChunk dst,
COPYFLAGS  flags,
AliasTrans trn 
)
virtual

Private.

Reimplemented from BaseList2D.

Reimplemented in Material.

◆ HandleSubChunk()

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

Private.

Reimplemented from BaseList2D.

Reimplemented in Material.

◆ Write()

virtual Bool Write ( HyperFile hf)
virtual

Private.

Reimplemented from BaseList2D.

Reimplemented in Material.

Member Data Documentation

◆ preview_image

BaseBitmap preview_image
private

◆ _hasNimbus

Bool _hasNimbus

◆ _nimbusXmlUnknownDataLength

Int _nimbusXmlUnknownDataLength

◆ _nimbusXmlUnknownData

void* _nimbusXmlUnknownData

◆ _nimbusNodesUnknownDataLength

Int _nimbusNodesUnknownDataLength

◆ _nimbusNodesUnknownData

void* _nimbusNodesUnknownData