CustomDataTypeClass Class Reference

abstract

#include <c4d_customdatatype.h>

Inheritance diagram for CustomDataTypeClass:
Inheritance graph
[ legend ]

详细描述

A data class for creating custom data types.
These can be used in descriptions and container just like built-in data types. Use RegisterCustomDataTypePlugin() to register a custom data type plugin.

公共成员函数

  CustomDataTypeClass ()
virtual Int32   GetId ()=0
virtual Int32   GetDataID ()
virtual Int32   GetValueID ()
virtual CustomDataType AllocData ()=0
virtual void  FreeData ( CustomDataType *data)=0
virtual Bool   CopyData (const CustomDataType *src, CustomDataType *dest, AliasTrans *aliastrans)=0
virtual Int32   比较 (const CustomDataType *d1, const CustomDataType *d2)=0
virtual Bool   WriteData (const CustomDataType *d, HyperFile *hf)=0
virtual Bool   ReadData ( CustomDataType *d, HyperFile *hf, Int32 level)=0
virtual const Char GetResourceSym ()=0
virtual CustomProperty GetProperties ()
virtual void  GetDefaultProperties ( BaseContainer &data)
virtual Int32   GetConversionsFrom ( Int32 *&table)
virtual GvError   ConvertFromGv ( Int32 src_type, const void *const src, Int32 cpu_id, CustomDataType *dst)
virtual Int32   GetConversionsTo ( Int32 *&table)
virtual GvError   ConvertToGv ( Int32 dst_type, const CustomDataType *src, void *dst, Int32 cpu_id)
virtual GvError   ConvertToGeData ( Int32 dst_type, const CustomDataType *src, GeData &dst)
virtual GvValueFlags   GetCalculationFlags ()
virtual GvError   Calculate ( Int32 calculation, const CustomDataType *src1, const CustomDataType *src2, CustomDataType *dst, Float parm1)
virtual GV_VALUE_HANDLER GetGvValueHandler ()
virtual Bool   ConvertGeDataToGv (const GeData &src, void *dst, Int32 cpu_id)
virtual Bool   ConvertGvToGeData (const void *const src, Int32 cpu_id, GeData &dst)
virtual Bool   GetDescription ()
virtual Bool   _GetDescription (const CustomDataType *data, 描述 &res, DESCFLAGS_DESC &flags, const BaseContainer &parentdescription, DescID *singledescid)
virtual Bool   GetParameter (const CustomDataType *data, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags)
virtual Bool   SetDParameter ( CustomDataType *data, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags)
virtual Bool   GetEnabling (const CustomDataType *data, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE &flags, const BaseContainer *itemdesc)
virtual Bool   InterpolateKeys ( GeData &res, const GeData &t_data1, const GeData &t_data2, Float mix, Int32 flags)
virtual void  CheckData (const BaseContainer &bc, GeData &data)
-  Public Member Functions inherited from BaseData
  BaseData ()
virtual  ~BaseData (void)
void  Destructor (void)

Private Attributes

Int32   defaultconversiontype
GV_VALUE_HANDLER valuehandler

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

◆  CustomDataTypeClass()

CustomDataTypeClass ( )

Default constructor.

由于
R17.032

成员函数文档编制

◆  GetId()

virtual Int32 GetId ( )
pure virtual

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

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

◆  GetDataID()

virtual Int32 GetDataID ( )
virtual

Called to get the plugin ID used for the custom data type.

注意
Normally it is not needed to override this. By default it returns GetId() .
返回
A unique plugin ID. Must be obtained from http://www.plugincafe.com

◆  GetValueID()

virtual Int32 GetValueID ( )
virtual

Called to get the plugin ID used for Graph View values.

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

◆  AllocData()

virtual CustomDataType * AllocData ( )
pure virtual

Called to allocate an instance of the internal data type class and return it.

返回
A custom data type instance.

◆  FreeData()

virtual void FreeData ( CustomDataType data )
pure virtual

Called to free an instance of the custom data type.

参数
[in,out] data The custom data type instance to free.

◆  CopyData()

virtual Bool CopyData ( const CustomDataType src ,
CustomDataType dest ,
AliasTrans aliastrans  
)
pure virtual

Called to copy an instance of the custom data type. Copy the data from src to dest .

参数
[in] src The source custom data type.
[out] dest The destination custom data type.
[in] aliastrans An alias translator for the operation. Can be nullptr . The caller owns the pointed alias translator.
返回
true if the custom data type was copied, otherwise false .

◆  Compare()

virtual Int32 比较 ( const CustomDataType d1 ,
const CustomDataType d2  
)
pure virtual

Called to compare a pair of custom data types.

参数
[in] d1 The first data.
[in] d2 The second data.
返回
The result of the comparison: if (d1 == d2) return 0; if (d1 < d2) return -1; if (d1 > d2) return 1;

◆  WriteData()

virtual Bool WriteData ( const CustomDataType d ,
HyperFile hf  
)
pure virtual

Called to write the custom data type to a file.

参数
[in] d The custom data type instance to write. Cinema 4D owns the pointed data.
[in] hf The hyper file to write the custom data type to. Cinema 4D owns the pointed hyper file.
返回
true if the custom data type was written successfully, otherwise false .

◆  ReadData()

virtual Bool ReadData ( CustomDataType d ,
HyperFile hf ,
Int32   level  
)
pure virtual

Called to read the custom data type from a file.

参数
[in,out] d The custom data type instance to read. Cinema 4D owns the pointed data.
[in] hf The hyper file to read the custom data type from. Cinema 4D owns the pointed hyper file.
[in] level The plugin level is similar to a version number. The default level is 0 .
Increase this for new revisions of a plugin to allow for forward and backward compatibility.

As an example you may have updated a plugin. If you now need to write additional information for new settings or changed types for old settings increase the level.
During loading either a 0 is passed (if the file was written by the old plugin) or 1 (if the file was written by the new plugin). This allows to easily write/read new values.
For forward and backward compatibility to work any existing read order from a given level must not be changed. Cinema 4D skips any new settings automatically if they have not been read.
返回
true if the custom data type was read successfully, otherwise false .

◆  GetResourceSym()

virtual const Char * GetResourceSym ( )
pure 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 custom 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 } };

◆  GetDefaultProperties()

virtual void GetDefaultProperties ( BaseContainer data )
virtual

Called to provide default properties for the custom 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 ); }
参数
[in] data The container to fill with the default properties.

◆  GetConversionsFrom()

virtual Int32 GetConversionsFrom ( Int32 *&  table )
virtual

Called to retrieve a pointer to a global array representing the data types that the custom data type can be converted from.

注意
Include the custom data type ID, since it is a possible conversion.
Here is an example: static Int32 MyDataTypeConversionsFrom[] = { MYDATATYPE_ID, DA_STRING , DA_LONG , }; Int32 MyDataTypeClass::GetConversionsFrom( Int32 *& table) { table = MyDataTypeConversionsFrom; return CUSTOMGUIARRAY_SIZE (MyDataTypeConversionsFrom); }
参数
[out] table Set this to point to the custom data type conversion from table.
返回
The size of the assigned conversion from table.
使用 CUSTOMGUIARRAY_SIZE for convenience. See example above.

◆  ConvertFromGv()

virtual GvError ConvertFromGv ( Int32   src_type ,
const void *const  src ,
Int32   cpu_id ,
CustomDataType dst  
)
virtual

Converts the Graph View data given by src_type and src [ cpu_id ] to the custom data type in dst .

参数
[in] src_type The source type. One of the IDs given by GetConversionsFrom() .
[in] src The source data array. Depends on src_type . Cinema 4D owns the pointed array.
[in] cpu_id The CPU index, i.e. the position in the src array.
[out] dst The destination custom data type. Points to an instance of the internal data type. Write the converted data to this object. Cinema 4D owns the pointed data.
返回
The conversion result: GvError

◆  GetConversionsTo()

virtual Int32 GetConversionsTo ( Int32 *&  table )
virtual

Called to retrieve a pointer to a global array representing the data types that the custom data type can be converted to.

注意
It is not need to include the custom data type ID.

Here is an example:

Int32 MyDataTypeConversionsTo[] = { DA_STRING , DA_LONG , }; Int32 MyDataTypeClass::GetConversionsTo( Int32 *&table) { table = MyDataTypeConversionsTo; return CUSTOMGUIARRAY_SIZE (MyDataTypeConversionsTo); }
参数
[out] table Set this to point to the custom data type conversion to table.
返回
The size of the assigned conversion to table.
使用 CUSTOMGUIARRAY_SIZE for convenience. See example above.

◆  ConvertToGv()

virtual GvError ConvertToGv ( Int32   dst_type ,
const CustomDataType src ,
void *  dst ,
Int32   cpu_id  
)
virtual

Called to convert the custom data type in src to the Graph View data given by dst_type and dst [ cpu_id ].

参数
[in] dst_type The destination type. One of the IDs given by GetConversionsTo() .
[in] src The source custom data type. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[out] dst The destination data array. Depends on dst_type . Write the converted data to this object. Cinema 4D owns the pointed array.
[in] cpu_id The CPU index, i.e. the position in the dst array.
返回
The conversion result: GvError

◆  ConvertToGeData()

virtual GvError ConvertToGeData ( Int32   dst_type ,
const CustomDataType src ,
GeData dst  
)
virtual

Called to convert the custom data type in src to GeData dst .

参数
[in] dst_type The destination type. One of the IDs given by GetConversionsTo() .
[in] src The source custom data type. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[out] dst The destination data. Depends on dst_type . Write the converted data to this object. Cinema 4D owns the pointed data.
返回
The conversion result: GvError

◆  GetCalculationFlags()

virtual GvValueFlags GetCalculationFlags ( )
virtual

Called to retrieve the valid calculations for the custom data type.

注意
Used for calls to Calculate() .
返回
A combination of the following: GvValueFlags

◆  Calculate()

virtual GvError Calculate ( Int32   calculation ,
const CustomDataType src1 ,
const CustomDataType src2 ,
CustomDataType dst ,
Float   parm1  
)
virtual

Called to carry out a calculation .

参数
[in] calculation The calculation: GvValueFlags
[in] src1 The first source custom data type. Depends on calculation . Cinema 4D owns the pointed data.
[in] src2 The second source custom data type. Depends on calculation . Cinema 4D owns the pointed data.
[out] dst The destination custom data type. Depends on calculation . Cinema 4D owns the pointed data.
[in] parm1 A Float parameter. Depends on calculation .
返回
The calculation result: GvError

◆  GetGvValueHandler()

virtual GV_VALUE_HANDLER * GetGvValueHandler ( )
virtual

Called to retrieve the internal GV_VALUE_HANDLER struct for the custom data type.

警告
It is normally never needed to override this method.
返回
The internal GV_VALUE_HANDLER struct.

◆  ConvertGeDataToGv()

virtual Bool ConvertGeDataToGv ( const GeData src ,
void *  dst ,
Int32   cpu_id  
)
virtual

Called to convert the data in src to the Graph View data given by dst [ cpu_id ].

警告
It is normally never needed to override this method.
参数
[in] src The source data. Cinema 4D owns the pointed data.
[out] dst The destination data array. Cinema 4D owns the pointed array.
[in] cpu_id The CPU index, i.e. the position in the dst array.
返回
true if the conversion was successful, otherwise false .

◆  ConvertGvToGeData()

virtual Bool ConvertGvToGeData ( const void *const  src ,
Int32   cpu_id ,
GeData dst  
)
virtual

Called to convert the internal data in src as an array referenced by cpu_id GeData in dst .

警告
It is normally never needed to override this method.
参数
[in] src The source data array. Cinema 4D owns the pointed array.
[in] cpu_id The CPU index, i.e. the position in the src array.
[out] dst The destination data. Cinema 4D owns the pointed data.
返回
true if the conversion was successful, otherwise false .

◆  GetDescription()

virtual Bool GetDescription ( )
virtual

Dummy virtual method to get the virtual warning.

返回
Always false .

◆  _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 custom data type.
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.

◆  GetParameter()

virtual Bool GetParameter ( const CustomDataType data ,
const DescID id ,
GeData t_data ,
DESCFLAGS_GET flags  
)
virtual

Called to override the reading of parameters.
Modify the passed t_data if the right id was provided, and set the appropriate flags . Then make sure to include a call to the parent at the end:

return SUPER::GetParameter(data, id , t_data, flags);
参数
[in] data The custom data type to get the parameters for. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[in] id The ID of the parameter.
[out] t_data The current data for the parameter.
[in,out] flags The flags for the description operation: DESCFLAGS_DESC
返回
true if successful, otherwise false . It is recommended to include a call to the parent function as last return.

◆  SetDParameter()

virtual Bool SetDParameter ( CustomDataType data ,
const DescID id ,
const GeData t_data ,
DESCFLAGS_SET flags  
)
virtual

Called to override the writing of parameters.
Read the passed t_data if the right id was provided, store the data, and set the appropriate flags . Then make sure to include a call to the parent at the end:

return SUPER::SetDParameter(data, id , t_data, flags);
参数
[in] data The data to set the parameter for. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[in] id The ID of the parameter.
[out] t_data The data to write.
[in,out] flags The flags for the description operation: DESCFLAGS_DESC
返回
true if successful, otherwise false . It is recommended to include a call to the parent function as last return.

◆  GetEnabling()

virtual Bool GetEnabling ( const CustomDataType data ,
const DescID id ,
const GeData t_data ,
DESCFLAGS_ENABLE flags ,
const BaseContainer itemdesc  
)
virtual

Called to decide which parameters should be enabled or disabled.
Read the passed t_data if the right id was provided, and return true to enable the parameter or false to disable it depending on the value. Then make sure to include a call to the parent at the end:

return SUPER::GetEnabling(data, id , t_data, flags, itemdesc);
参数
[in] data The data to enable or disable. Points to an instance of the internal data type. Cinema 4D owns the pointed data.
[in] id The ID of the parameter.
[in] t_data The current data for the parameter.
[in] flags Not used.
[in] itemdesc The description, encoded to a container as described in 描述 .
返回
true if the parameter should be enabled, otherwise false . It is recommended to include a call to the parent function as last return.

◆  InterpolateKeys()

virtual Bool InterpolateKeys ( GeData res ,
const GeData t_data1 ,
const GeData t_data2 ,
Float   mix ,
Int32   flags  
)
virtual

Override this method to animate the custom data type.
Set res to t_data1 * mix + t_data2 *(1- mix ) in a way that makes sense for the custom data type.

参数
[in] res The animated value.
[in] t_data1 The first value.
[in] t_data2 The second value.
[in] mix The mixing factor.
[in] flags Not used.
返回
true if the data was animated, otherwise false .

◆  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

◆  defaultconversiontype

Int32 defaultconversiontype
private

◆  valuehandler

GV_VALUE_HANDLER * valuehandler
private
DA_LONG
@ DA_LONG
Int32.
定义: c4d_gedata.h:40
DESC_ANIMATE
@ DESC_ANIMATE
Int32 Animation mode:
定义: lib_description.h:104
CUSTOMTYPE::END
@ END
End marker.
BaseContainer::SetInt32
void SetInt32(Int32 id, Int32 l)
定义: c4d_basecontainer.h:505
CUSTOMGUIARRAY_SIZE
#define CUSTOMGUIARRAY_SIZE(A)
Calculates the size of arrays.
定义: c4d_customguidata.h:80
DA_STRING
@ DA_STRING
String.
定义: c4d_gedata.h:47
GRADIENTPROPERTY_ALPHA
#define GRADIENTPROPERTY_ALPHA
定义: customgui_gradient.h:49
BITMAPBUTTON_BORDER
#define BITMAPBUTTON_BORDER
定义: customgui_bitmapbutton.h:33
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
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
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
CustomDataTypeClass::GetDefaultProperties
virtual void GetDefaultProperties(BaseContainer &data)