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

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));
CUSTOMDATATYPEPLUGIN * FindCustomDataTypePlugin(Int32 type)
ResourceDataTypeClass(Int32 datatypeid, CUSTOMDATATYPEPLUGIN *datatype)
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:

{
}
Definition: c4d_basecontainer.h:47
void SetInt32(Int32 id, Int32 l)
Definition: c4d_basecontainer.h:505
virtual void GetDefaultProperties(BaseContainer &data)
#define CUSTOMGUI_GRADIENT
Gradient custom GUI ID.
Definition: customgui_gradient.h:26
@ DESC_ANIMATE_ON
Parameter is animatable.
Definition: lib_description.h:106
@ DESC_CUSTOMGUI
Int32 The ID of the GUI for this element. Either a custom ID or one of: CUSTOMGUI
Definition: lib_description.h:125
@ DESC_ANIMATE
Int32 Animation mode:
Definition: lib_description.h:104
#define GRADIENTPROPERTY_ALPHA_WITH_COLOR
Definition: customgui_gradient.h:44
#define GRADIENTPROPERTY_ALPHA
Definition: customgui_gradient.h:49
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 }
};
#define BITMAPBUTTON_BUTTON
Definition: customgui_bitmapbutton.h:35
#define BITMAPBUTTON_BORDER
Definition: customgui_bitmapbutton.h:33
@ FLAG
Bool data. (Either the property is there or not.)
@ END
End marker.
Definition: c4d_customguidata.h:114

◆ 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);
PyCompilerFlags * flags
Definition: ast.h:14
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