On 27/07/2016 at 03:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform:
Language(s) : C++ ;
---------
Hi! I'm trying to interpolate between two GeData values. But when I call CustomDataTypeClass::Calculate(),
it always gives me GV_CALC_ERR_UNDEFINED . Does someone know what I'm doing wrong?
Thanks a lot in advance,
-Niklas
GeData InterpolateValues(GeData const& left, GeData const& right, BaseList2D* node, Float w) {
Int32 const type = left.GetType();
if (type != right.GetType()) return left;
// Load the CustomDataTypeClass plugin for this datatype.
CUSTOMDATATYPEPLUGIN* plug = FindCustomDataTypePlugin(left.GetType());
if (!plug) return left;
auto data = static_cast<CustomDataTypeClass*>(plug->adr);
if (!data) return left;
GeData res = left;
GvError err = (data->*plug->Calculate)(
GV_CALC_MIX,
left.GetCustomDataType(type),
right.GetCustomDataType(type),
res.GetCustomDataType(type),
w);
if (err != GV_IO_ERR_NONE) {
// Always gets here with err == GV_CALC_ERR_UNDEFINED
GePrint("Oh Noes! " + String::IntToString(err));
}
return res;
}
// Calling example
GeData l(10);
GeData r(50);
GeData res = InterpolateValues(l, r, nullptr, 0.5);
Int32 val = res.GetInt32();