Hello,
I am working on a plugin that utilize Fields to affect the position of points in a spline. With the code listed below that I took from the FieldList Manual I am able to retrieve the falloff value from the positions I feed into the Fields.
However, the returned value does no give the effects of the Delay/Smooth/Spring/Decay Modifiers within the Field. How can I get the modified value?
Here is a video for clarity of what SHOULD be happening .
GeData data;
Matrix opMat = op->GetMg();
const DescID fieldParameterID(idFieldList);
if (!op->GetParameter(fieldParameterID, data, DESCFLAGS_GET::NONE))
return returnArray;
CustomDataType* const customData = data.GetCustomDataType(CUSTOMDATATYPE_FIELDLIST);
FieldList* const fieldList = static_cast<FieldList*>(customData);
if (!fieldList)
return returnArray;
Int32 fieldListCount = 0;
if (fieldList)
fieldListCount = fieldList->GetCount();
if (fieldListCount > 0)
{
maxon::BaseArray<maxon::Vector> positions;
maxon::BaseArray<maxon::Vector> uvws;
maxon::BaseArray<maxon::Vector> directions;
resultVoid = positions.Resize(vectorArray.GetCount());
resultVoid = uvws.Resize(vectorArray.GetCount());
resultVoid = directions.Resize(vectorArray.GetCount());
Int32 pointIndex = 0;
for (maxon::Vector& pos : positions)
{
pos = opMat * vectorArray[pointIndex];
pointIndex++;
}
FieldInput points(positions.GetFirst(), directions.GetFirst(), uvws.GetFirst(), pointIndex, Matrix());
FieldOutput results = fieldList->SampleListSimple(*op, points) iferr_return;
Bool valid = FALSE;
for (Int32 index = 0; index < positions.GetCount(); index++)
{
// Retreive falloff value to use
results._value[index];
}
}
Any help would be greatly appreciated.
John Terenece