ResourceDataTypeClass Class Reference

abstract

#include <c4d_customdatatype.h>

Inheritance diagram for ResourceDataTypeClass:
Inheritance graph
[ legend ]

详细描述

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 .
使用 RegisterResourceDataTypePlugin() to register a resourse data type plugin.

公共成员函数

  ResourceDataTypeClass ( Int32 datatypeid , CUSTOMDATATYPEPLUGIN * datatype )
virtual Int32   GetId ()=0
virtual Int32   GetCustomDataType ()
virtual CUSTOMDATATYPEPLUGIN *  GetCustomDataTypePlugin ()
virtual void  GetDefaultProperties ( BaseContainer &data)
virtual const Char GetResourceSym ()
virtual CustomProperty GetProperties ()
virtual Bool   GetDescription (const CustomDataType *data, 描述 &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

构造函数 & 析构函数文档编制

◆  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));
参数
[in] datatypeid The custom data type ID.
[in] datatype The custom data type plugin structure.

成员函数文档编制

◆  GetId()

virtual Int32 GetId ( )
pure virtual

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

返回
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.

注意
By default returns the value passed to the constructor.
返回
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.

注意
By default returns the value passed to the constructor.
返回
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:

virtual void GetDefaultProperties ( BaseContainer &data) { data. SetInt32 ( GRADIENTPROPERTY_ALPHA_WITH_COLOR , false ); data. SetInt32 ( GRADIENTPROPERTY_ALPHA , false ); data. SetInt32 ( DESC_ANIMATE , DESC_ANIMATE_ON ); data. SetInt32 ( DESC_CUSTOMGUI , CUSTOMGUI_GRADIENT ); }
注意
This is normally the very reason for using ResourceDataTypeClass .
参数
[in] data Filled 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" .

注意
Only 7-bit ASCII characters are allowed, hence the Char type.
返回
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.

另请参阅
CustomProperty .
返回
A pointer to a global array of CustomProperty elements, ended with a CUSTOMTYPE::END property: CustomProperty bitmapbuttonprops[] = { { CUSTOMTYPE::FLAG , BITMAPBUTTON_BORDER , "BORDER" }, { CUSTOMTYPE::FLAG , BITMAPBUTTON_BUTTON , "BUTTON" }, { CUSTOMTYPE::END , 0, nullptr } };

◆  GetDescription()

virtual Bool GetDescription ( const CustomDataType data ,
描述 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);
参数
[in] data The custom data type to get the description for. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[out] res The description to add the parameters to.
[in,out] flags The flags for the description operation: DESCFLAGS_DESC
[in] parentdescription The description container for the parent's description, encoded as described in 描述 .
[out] singledescid Private .
返回
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.

参数
[in] bc The settings container.
[in,out] data The data value to check.

Member Data Documentation

◆  datatypeid

Int32 datatypeid
private

◆  datatype

CUSTOMDATATYPEPLUGIN* datatype private
DESC_ANIMATE
@ DESC_ANIMATE
Int32 Animation mode:
定义: lib_description.h:104
FindCustomDataTypePlugin
CUSTOMDATATYPEPLUGIN * FindCustomDataTypePlugin(Int32 type)
ResourceDataTypeClass::GetDefaultProperties
virtual void GetDefaultProperties(BaseContainer &data)
CUSTOMTYPE::END
@ END
End marker.
BaseContainer::SetInt32
void SetInt32(Int32 id, Int32 l)
定义: c4d_basecontainer.h:505
GRADIENTPROPERTY_ALPHA
#define GRADIENTPROPERTY_ALPHA
定义: customgui_gradient.h:49
BITMAPBUTTON_BORDER
#define BITMAPBUTTON_BORDER
定义: customgui_bitmapbutton.h:33
CustomProperty
定义: c4d_customguidata.h:113
CUSTOMGUI_GRADIENT
#define CUSTOMGUI_GRADIENT
Gradient custom GUI ID.
定义: customgui_gradient.h:26
DESC_CUSTOMGUI
@ DESC_CUSTOMGUI
Int32 The ID of the GUI for this element. Either a custom ID or one of: CUSTOMGUI
定义: lib_description.h:125
GRADIENTPROPERTY_ALPHA_WITH_COLOR
#define GRADIENTPROPERTY_ALPHA_WITH_COLOR
定义: customgui_gradient.h:44
DESC_ANIMATE_ON
@ DESC_ANIMATE_ON
Parameter is animatable.
定义: lib_description.h:106
ResourceDataTypeClass::ResourceDataTypeClass
ResourceDataTypeClass(Int32 datatypeid, CUSTOMDATATYPEPLUGIN *datatype)
BITMAPBUTTON_BUTTON
#define BITMAPBUTTON_BUTTON
定义: customgui_bitmapbutton.h:35
CUSTOMTYPE::FLAG
@ FLAG
Bool data. (Either the property is there or not.)
BaseContainer
定义: c4d_basecontainer.h:46