I am trying to create a deformer plugin that will work on splines by modifying the positions of the points.
Using the code below I am getting the points from a spline and offsetting its position along the Z axis as a simple test.
Bool DeformPlugin::ModifyObject(BaseObject* mod, BaseDocument* doc, BaseObject* op, const Matrix& op_mg, const Matrix& mod_mg, Float lod, Int32 flags, BaseThread* thread)
// Check the input parameters validity.
if (!mod || !op || !doc)
// Retrieve BaseContainer instance pointer and check for validity
BaseContainer* bc = mod->GetDataInstance();
// Verify the modifier inherits from PointObject and cast the pointer to the corresponding PointObject.
// Verify the modified object inherits from PointObject and cast the pointer to the corresponding PointObject.
SplineObject *opSplineObj = static_cast<SplineObject*>(op);
maxon::Result<void> DeformPlugin::MovePoints(SplineObject* opSplineObj, PointObject* modPointObj)
const Vector* opPointsR = opSplineObj->GetPointR();
const Int32 opPointsCnt = opSplineObj->GetPointCount();
Vector* opPointsW = opSplineObj->GetPointW();
for (Int32 opPointIdx = 0; opPointIdx < opPointsCnt; opPointIdx++)
opPointsW[opPointIdx] = opPointsR[opPointIdx];
opPointsW[opPointIdx].z = opPointsR[opPointIdx].z + 20;
The code is working to properly move the points, the problem is that I am getting the line points of the spline that I am deforming when I am trying to get the spline points.
This is the selection of points I am getting.
This is the selection of points I want to get.
I tried using the base SDK examples and they are also using the line points instead of the spline points.
Is there a way to get and use the spline points or do deformers only utilize the line points?
Any help would be greatly appreciated.
Hi @JohnThomas, thanks for reaching out us.
With regard to your question, I confirm that what you see is correct since the deformer provided data is the tessellated representation of the original spline.
@r_gigante Thanks for the response, that's what I thought the case would be.