I'm doing a scripted operator controlling a value, and I need either the angular velocity, or the rotation values for the current frame, which is easy, and the same for the previous frame, which I have no clue how to get.
how can I access that information?
I don't have XSI in front of me at the moment to verify, but I do know that certain Get/Set methods in the Object Model allow you to pass a time value in which to do it's evaluation (Jscript):
var oRoot = Application.ActiveProject.ActiveScene.Root;
var oMesh = oRoot.AddGeometry( "Sphere", "MeshSurface" );
// Get the sphere's data at frame 13
oMeshAtFrame = oMesh.EvaluateAt( 13 );
oPositionX = oMeshAtFrame.posx.value;
LogMessage( "Sphere's position at frame 13: " + oPositionX, siInfo );
Hope this helps,
Matt
Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com
way cool, thanks!
I'll look into it right now.
actually there was a much simpler way to do that, I should have read the help files a little better before asking.
GetValue( Parameter, [Frame] )
as you can see you can enter the frame nuber there.
Now I have another question though: when doing Expressions the current frame is Fc, but how do you get the current frame number in Scripting?
okay, I got throught that problem as well, but now the only remaining problem is how the heck do you make a scripted operator run every frame? Or even better every time the controlling values are changed. I got an object called Fish with a custom parameter set called Fish, which has a parameter called Flip which contains the Update(In_UpdateContext, Out) function.
Expressions are so nice and simple, and they get run every frame without having to do anything...
the GetValue() command is a generic command for retrieving info. It works, but it will be slower than using the Object model as illustrated earlier.
Scripted operators are persistent - meaning they're always running (like expressions). When you access geometry or other data associated with an object, the retrieved values default to the current frame. If you pass another frame number to those commands (as shown earlier), then the data will be evaluated at that frame and returned.
Finally, if a parameter is part of the update function (eg - the operator's PPG), then you can access the value on the current frame as follows:
flip = In_UpdateContext.Parameters( "Flip" ).Value;
The scripted operator already knows where the PPG is, so you can call the parameter directly.
Matt
Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmail.com