How to animate points of a Spline Shape Object?

How to animate points of a Spline Shape Object?

Anonymous
Not applicable
336 Views
2 Replies
Message 1 of 3

How to animate points of a Spline Shape Object?

Anonymous
Not applicable
Hi there,
I try to do something which is really easy using the interface but quite not so obvious for me inside a plug-in... Well the point is to import animated splines from an XML file where all control points are stored for each curve and each frame (this is a hair simulation computed with a standalone mechanical solver)

My question is how can I have access to vertices to assign them a XYZ Point3 controller (then assigning a float expression controller to X, Y and Z, filled with keyframes read from the file)?

Any help will be more than appreciated!

LBx
0 Likes
337 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Would the SplineShape method SetPointAnim(TimeValue t, int poly, int vert, Point3 pt) do what I'd like to perform in my plug-in? There's nothing about it in the documentation...
0 Likes
Message 3 of 3

Anonymous
Not applicable
I implemented a solution which is quite... dirty and causes 3DSMax to crash on quit.
I succeeded in loading the spline shape. Now the problem is to set up the controllers. I don't understand how it works.

In 3DSMAX GUI as user, when you load a spline shape, all you have to do to get automatically the position controllers for each vertex is to select the spline shape object, set mode to move, turn into Animation mod and then add key.

I tried to do so in my plug-in:

// Turn into Select mode
ip->SetStdCommandMode(CID_OBJSELECT);
// Select SplineShape node
theHold.Begin();
ip->SelectNode(hairNode, 1);
MSTR undostr;
undostr.printf("Select");
theHold.Accept(undostr);

// Turn into Move Mode
ip->SetStdCommandMode(CID_OBJMOVE);

// Turn intoAnimation mode
SuspendAnimate();
AnimateOn();

hairNode->AddNewKey(0,ADDKEY_SELECT);
ResumeAnimate();

It doesn't create any controller nor any Key (the AddNewKey method may not be the right one)

I tried another way using the masterCont defined for SplineShapes:

SuspendAnimate();
AnimateOn();
splShape->masterCont->SetNumSubControllers(nbPoints, FALSE);
for(int i=0;i<nbPoints;i++) {
Control* c = (Control*)CreateInstance(CTRL_POINT3_CLASS_ID,Class_ID(HYBRIDINTERP_POINT3_CLASS_ID,0));
splShape->masterCont->AddSubController(c);
splShape->masterCont->GetSubController(i)->SetValue(0,splshape->GetPoint(i));
}
ResumeAnimate();

Here splShape->masterCont->GetSubController(i) returns NULL!!
So what is wrong? AddSubController should set it up?!

So my question is: how do we setup the vertices Point3 controllers ?
Any help will be more than appreciated! I'm totally lost...

Thanks in advance for your help!
0 Likes