Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / C++ API: Accessing Interpolated Animation Parameters
  RSS 2.0 ATOM  

C++ API: Accessing Interpolated Animation Parameters
Rate this thread
 
56021
 
Permlink of this thread  
avatar
  • Total Posts: 101
  • Joined: 31 August 2010 07:17 AM

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.



Replies: 0
avatar

How about CParameterRefArray::PlotAnimation?



Replies: 0
avatar

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 propertyPlayctrlaPropertiesList.GetItem(L"Play Control") );
 

 
int nStartFrame = (int)propertyPlayctrl.GetParameterValue("In");
 
int nLastFrame = (int)propertyPlayctrl.GetParameterValue("Out"); 

 
 
exportFileParam << "#begin " << nLastFrame nStartFrame << " animation frames" << endl;
 
exportFileParam << "as " << nLastFrame nStartFrame << endl;
 for (
int nFrame nStartFramenFrame <= nLastFramenFrame++ )
 
{

 exportFileParam 
<< "a " << CStringparamPosX.GetValue(nFrame)).GetAsciiString() << " " << CStringparamPosY.GetValue(nFrame)).GetAsciiString() << " " << CStringparamPosZ.GetValue(nFrame)).GetAsciiString();
 
exportFileParam << " " << CStringparamRotX.GetValue(nFrame)).GetAsciiString() << " " << CStringparamRotY.GetValue(nFrame)).GetAsciiString()  << " " << CStringparamRotZ.GetValue(nFrame)).GetAsciiString();
 
exportFileParam << " " << CStringparamSclX.GetValue(nFrame)).GetAsciiString() << " " << CStringparamSclY.GetValue(nFrame)).GetAsciiString() << " " << CStringparamSclZ.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.



Replies: 0