ResourceDataTypeClass Class Referenceabstract

#include <c4d_customdatatype.h>

Inheritance diagram for ResourceDataTypeClass:

Detailed Description

A data class for creating custom data types' aliases.
These can be used in descriptions as a shortcut for a custom data type with certain options, for example like VECTOR and COLOR.
Use RegisterResourceDataTypePlugin() to register a resourse data type plugin.

Public Member Functions

 ResourceDataTypeClass (Int32 datatypeid, CUSTOMDATATYPEPLUGIN *datatype)
 
virtual Int32 GetId ()=0
 
virtual Int32 GetCustomDataType ()
 
virtual CUSTOMDATATYPEPLUGIN * GetCustomDataTypePlugin ()
 
virtual void GetDefaultProperties (BaseContainer &data)
 
virtual const CharGetResourceSym ()
 
virtual CustomPropertyGetProperties ()
 
virtual Bool GetDescription (const CustomDataType *data, Description &res, DESCFLAGS_DESC &flags, const BaseContainer &parentdescription, DescID *singledescid)
 
virtual void CheckData (const BaseContainer &bc, GeData &data)
 
- Public Member Functions inherited from BaseData
 BaseData ()
 
virtual ~BaseData (void)
 
void Destructor (void)
 

Private Attributes

Int32 datatypeid
 
CUSTOMDATATYPEPLUGIN * datatype
 

Constructor & Destructor Documentation

§ ResourceDataTypeClass()

ResourceDataTypeClass ( Int32  datatypeid,
CUSTOMDATATYPEPLUGIN *  datatype 
)

Constructor. Pass the ID and plugin structure for the custom data type to create an alias for.
The easiest way to get the plugin structure is to call FindCustomDataTypePlugin(), for example:

ResourceDataTypeClass(MY_CUSTOM_DATA_TYPE, FindCustomDataTypePlugin(MY_CUSTOM_DATA_TYPE));
Parameters
[in]datatypeidThe custom data type ID.
[in]datatypeThe custom data type plugin structure.

Member Function Documentation

§ GetId()

virtual Int32 GetId ( )
pure virtual

Called to get the plugin ID of the resource data type.

Returns
A unique plugin ID. Must be obtained from http://www.plugincafe.com

§ GetCustomDataType()

virtual Int32 GetCustomDataType ( )
virtual

Called to get the plugin ID of the custom data type that this is an alias for.

Note
By default returns the value passed to the constructor.
Returns
The custom data type ID for the resource type.

§ GetCustomDataTypePlugin()

virtual CUSTOMDATATYPEPLUGIN* GetCustomDataTypePlugin ( )
virtual

Called to get the internal plugin structure of the custom data type that this is an alias for.

Note
By default returns the value passed to the constructor.
Returns
The plugin structure of the custom data of the resource type. Cinema 4D owns the pointed plugin structure.

§ GetDefaultProperties()

virtual void GetDefaultProperties ( BaseContainer data)
virtual

Called to provide default properties for the data type.
These properties will be used if the user does not specify anything else.
It is common to add DESC_ANIMATE and DESC_CUSTOMGUI to the default properties:

Note
This is normally the very reason for using ResourceDataTypeClass.
Parameters
[in]dataFilled with the default properties for the data type in the resource.

§ GetResourceSym()

virtual const Char* GetResourceSym ( )
virtual

Called to get the symbol to use in resource files, for example "GRADIENT".

Note
Only 7-bit ASCII characters are allowed, hence the Char type.
Returns
A pointer to a global const Char* string with the resource symbol.

§ GetProperties()

virtual CustomProperty* GetProperties ( )
virtual

Called to get the properties that the data type accepts in resource files.

See also
CustomProperty.
Returns
A pointer to a global array of CustomProperty elements, ended with a CUSTOMTYPE_END property:
CustomProperty bitmapbuttonprops[] =
{
{ CUSTOMTYPE_END, 0, nullptr }
};

§ GetDescription()

virtual Bool GetDescription ( const CustomDataType data,
Description res,
DESCFLAGS_DESC flags,
const BaseContainer parentdescription,
DescID singledescid 
)
virtual

Called to add sub-parameters to the description for the data.
Modify the passed description res object as needed, set the appropriate flags and then make sure to include a call to the parent at the end:

return SUPER::GetDescription(data, description, flags, parentdescription);
Parameters
[in]dataThe custom data type to get the description for. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[out]resThe description to add the parameters to.
[in,out]flagsThe flags for the description operation: DESCFLAGS_DESC
[in]parentdescriptionThe description container for the parent's description, encoded as described in Description.
[out]singledescidPrivate.
Returns
true if successful, otherwise false. It is recommended to include a call to the parent function as last return.

§ CheckData()

virtual void CheckData ( const BaseContainer bc,
GeData data 
)
virtual

Called to let validate the values of data with the settings in bc.
Modify data accordingly so that it is valid.

Parameters
[in]bcThe settings container.
[in,out]dataThe data value to check.

Member Data Documentation

§ datatypeid

Int32 datatypeid
private

§ datatype

CUSTOMDATATYPEPLUGIN* datatype
private