GV_VALUE_HANDLER Struct Reference

#include <c4d_graphview_def.h>

Detailed Description

Value handler. Use GvRegisterValueType() to register.

Public Attributes

GvValueID value_id
 
GvValueFlags value_flags
 
void * userdata
 
Bool(* Alloc )(void *userdata, void *&data, Int32 nr_of_cpus)
 
void(* Free )(void *userdata, void *&data, Int32 nr_of_cpus)
 
GvCalcError(* Convert )(void *userdata, GvValueID source_id, const void *const source, GvValueID dest_id, void *dest, Int32 cpu_id)
 
GvCalcError(* Calculate )(void *userdata, GvValueID id, const void *const source1, const void *const source2, void *dest, Int32 cpu_id, GvValueFlags calculation, Float parm1)
 
void(* CopyFrom )(void *userdata, const void *const source, void *dest, Int32 cpu_id)
 
void(* CopyTo )(void *userdata, const void *const source, void *dest, Int32 cpu_id)
 
Int32(* GetConversionsFrom )(void *userdata, GvValueID *&table)
 
Int32(* GetConversionsTo )(void *userdata, GvValueID *&table)
 
String(* GetName )(void *userdata)
 
Bool(* Read )(void *userdata, void *data, Int32 nr_of_cpus, HyperFile &hf, Int32 level)
 
Bool(* Write )(void *userdata, const void *const data, Int32 nr_of_cpus, HyperFile &hf)
 
BaseBitmap *(* GetIcon )(void *userdata)
 
const void *(* GetDataInstance )(void *userdata, const void *const source, Int32 cpu_id)
 

Member Data Documentation

◆ value_id

GvValueID value_id

Value ID.

◆ value_flags

GvValueFlags value_flags

Value flags: GvValueFlags.

◆ userdata

void* userdata

User data.

◆ Alloc

Bool(* Alloc) (void *userdata, void *&data, Int32 nr_of_cpus)

Allocate an array of nr_of_cpus instances of the value and set data to point to this array.

Parameters
[in]userdataUser data.
[out]dataAssign a pointer to the allocated array.
[in]nr_of_cpusNumber of CPUs to allocate values for.
Returns
true if successful, otherwise false.

◆ Free

void(* Free) (void *userdata, void *&data, Int32 nr_of_cpus)

Free allocated values in Alloc.

Parameters
[in]userdataUser data.
[out]dataAn array of nr_of_cpus values to free. Assigned nullptr afterwards.
[in]nr_of_cpusNumber of CPUs to free values for.
Returns
true if successful, otherwise false.

◆ Convert

GvCalcError(* Convert) (void *userdata, GvValueID source_id, const void *const source, GvValueID dest_id, void *dest, Int32 cpu_id)

Convert source to dest if possible.

Parameters
[in]userdataUser data.
[in]source_idDetermines the type of source.
[in]sourceSource data. Points to GV data. The layout of the pointed data is determined by source_id.
[in]dest_idDetermines the type of dest.
[out]destDestination data. Points to GV data. The layout of the pointed data is determined by dest_id.
[in]cpu_idCPU ID.
Returns
Result: GvCalcError

◆ Calculate

GvCalcError(* Calculate) (void *userdata, GvValueID id, const void *const source1, const void *const source2, void *dest, Int32 cpu_id, GvValueFlags calculation, Float parm1)

Perform a calculation.

Parameters
[in]userdataUser data.
[in]idDetermines the type of the data parameters.
[in]source1First source data. Points to GV data. The layout of the pointed data is determined by id.
[in]source2Second source data. Points to GV data. The layout of the pointed data is determined by id.
[out]destDestination data. Points to GV data. The layout of the pointed data is determined by id.
[in]cpu_idCPU ID.
[in]calculationCalculation: GvValueFlags
[in]parm1Parameter.
Returns
Result: GvCalcError

◆ CopyFrom

void(* CopyFrom) (void *userdata, const void *const source, void *dest, Int32 cpu_id)

Copy the data from an array in source to dest: *dest = source[cpu_id].

Parameters
[in]userdataUser data.
[in]sourceSource data. Points to GV data. The layout of the pointed data is determined by value_id.
[out]destDestination data. Points to GV data. The layout of the pointed data is determined by value_id.
[in]cpu_idCPU ID.

◆ CopyTo

void(* CopyTo) (void *userdata, const void *const source, void *dest, Int32 cpu_id)

Copy the data from source to an array in dest: dest[cpu_id] = *source.

Parameters
[in]userdataUser data.
[in]sourceSource data. Points to GV data. The layout of the pointed data is determined by value_id.
[out]destDestination data. Points to GV data. The layout of the pointed data is determined by value_id.
[in]cpu_idCPU ID.

◆ GetConversionsFrom

Int32(* GetConversionsFrom) (void *userdata, GvValueID *&table)

Report the value types that this value handler can convert from.

Parameters
[in]userdataUser data.
[out]tableAssign a pointer to a table of value IDs. The handler owns the pointed table.
Returns
The number of entries in table.

◆ GetConversionsTo

Int32(* GetConversionsTo) (void *userdata, GvValueID *&table)

Report the value types that this value handler can convert to.

Parameters
[in]userdataUser data.
[out]tableAssign a pointer to a table of value IDs. The handler owns the pointed table.
Returns
Number of entries in table.

◆ GetName

String(* GetName) (void *userdata)

Get the value name.

Parameters
[in]userdataUser data.
Returns
Value name. The handler owns the pointed String.

◆ Read

Bool(* Read) (void *userdata, void *data, Int32 nr_of_cpus, HyperFile &hf, Int32 level)

Read the value to data from hf.

Parameters
[in]userdataUser data.
[out]dataData to read to. Points to GV data. The layout of the pointed data is determined by value_id.
[in]nr_of_cpusNumber of CPUs.
[in]hfHyper file to read from.
[in]levelDisc level.
Returns
true if successful, otherwise false.

◆ Write

Bool(* Write) (void *userdata, const void *const data, Int32 nr_of_cpus, HyperFile &hf)

Write the value in data to hf.

Parameters
[in]userdataUser data.
[in]dataData to write from. Points to GV data. The layout of the pointed data is determined by value_id.
[in]nr_of_cpusNumber of CPUs.
[out]hfHyper file to write to.
Returns
true if successful, otherwise false.

◆ GetIcon

BaseBitmap*(* GetIcon) (void *userdata)

Get the icon for the value.

Note
Currently not used.
Returns
Value icon. The handler owns the pointed BaseBitmap.

◆ GetDataInstance

const void*(* GetDataInstance) (void *userdata, const void *const source, Int32 cpu_id)

Retrieve a pointer to the data in source: &source[cpu_id].

Warning
This is a dangerous function, but it can be useful to avoid unnecessary copies.
Parameters
[in]userdataUser data.
[in]sourceSource data. Points to GV data. The layout of the pointed data is determined by value_id.
[in]cpu_idCPU ID.
Returns
Pointer to the data.