Currently there are two ways to store data of variable type. The first one is GeData, the class that is used in most of the SDK for example in BaseContainer. The second one is the void*
data that is used in Graph View. This document describes how the Graph View data type system works.
Note: Types registered with CustomDataTypeClass are automatically included in the Graph View type system as well.
The actual format of the data stored in the void*
pointer is determined by its value, described by a GvValueID. This is all you need to know to be able to perform calculations with the data or convert it to other types.
Similar kinds of data can share a common value. The combination of a symbol/name and a value is called a data, described by a GvDataID. For example both the normal and the color data types could be implemented as a vector value.
The different data types are grouped in value groups. However, currently there is only one group, so you can ignore this feature most of the time.
For the common built-in types (Int32, Float, Vector, Matrix, BaseTime and String) the void*
pointer simply points to the data type in question. For custom data types it instead points to the GvHelper structure. Please observe that generally these pointers are to an array that you should index with the current CPU ID.
GvDynamicData is a convenience structure that stores both the void*
data pointer and a GvDataInfo structure with the handlers. There are several ways to get a dynamic data structure:
Many of these functions are implemented in clear code in c4d_graphview.h and c4d_graphview.cpp, so you can see how they work.
Getting a GeData from a calculated port:
Setting the port data from a GeData:
Getting a Thinking Particles particle ID from a port: