|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| C++ API: Accessing Interpolated Animation Parameters
|
|
|
Is it possible, please, to access interpolated animation parameters within Softimage please?
Example: I have deafult 100 frames. I create an animation; in my example, it would be an object that follows motion path from 0 to 100 frames. I might have setup addional 5 rotation keyfrmes. What I wish is to get the final position/rotation/scaling of the selected object at every frame from those 100.
Therefore, I would have 100 positions/rotations/scaling parameters exported.
|
|
|
|
How about CParameterRefArray::PlotAnimation?
|
|
|
|
Hi Stephen,
I tried more ways, but this one worked for me at the end:
// list animation frames
Parameter paramPosX = my3DObject.GetParameter(L"posx");
Parameter paramPosY = my3DObject.GetParameter(L"posy");
Parameter paramPosZ = my3DObject.GetParameter(L"posz");
Parameter paramRotX = my3DObject.GetParameter(L"rotx");
Parameter paramRotY = my3DObject.GetParameter(L"roty");
Parameter paramRotZ = my3DObject.GetParameter(L"rotz");
Parameter paramSclX = my3DObject.GetParameter(L"sclx");
Parameter paramSclY = my3DObject.GetParameter(L"scly");
Parameter paramSclZ = my3DObject.GetParameter(L"sclz");
// Get the current project
Application app;
Project ProjectActive = app.GetActiveProject();
// The PlayControl property set is stored with scene data under the project
CRefArray aPropertiesList = ProjectActive.GetProperties();
Property propertyPlayctrl( aPropertiesList.GetItem(L"Play Control") );
int nStartFrame = (int)propertyPlayctrl.GetParameterValue("In");
int nLastFrame = (int)propertyPlayctrl.GetParameterValue("Out");
exportFileParam << "#begin " << nLastFrame - nStartFrame + 1 << " animation frames" << endl;
exportFileParam << "as " << nLastFrame - nStartFrame + 1 << endl;
for (int nFrame = nStartFrame; nFrame <= nLastFrame; nFrame++ )
{
exportFileParam << "a " << CString( paramPosX.GetValue(nFrame)).GetAsciiString() << " " << CString( paramPosY.GetValue(nFrame)).GetAsciiString() << " " << CString( paramPosZ.GetValue(nFrame)).GetAsciiString();
exportFileParam << " " << CString( paramRotX.GetValue(nFrame)).GetAsciiString() << " " << CString( paramRotY.GetValue(nFrame)).GetAsciiString() << " " << CString( paramRotZ.GetValue(nFrame)).GetAsciiString();
exportFileParam << " " << CString( paramSclX.GetValue(nFrame)).GetAsciiString() << " " << CString( paramSclY.GetValue(nFrame)).GetAsciiString() << " " << CString( paramSclZ.GetValue(nFrame)).GetAsciiString() << endl;
}
In other words, I create a Parameter of animatable Softimage type, which is based on script name, like ”posx”. Then, I call Parameter::GetValue(nFrameNo), to get the posx, at particular frame. It works well.
But thanks for support.
|
|
|
|
|
|