So, I'm writing a deformer plugin for MotionBuilder. I'd like to call on my routine to calculate the values to use in the deformation only once for each frame advance in the scene. I have an array of double[3]'s that are used in the DeformerNotify() method thus;
pDstVertex[ndx][0] = myArray[ndx][0]
pDstVertex[ndx][1] = myArray[ndx][1]
pDstVertex[ndx][2] = myArray[ndx][2]
At this point, I'm thinking it's probably good to calculate the postition updates for myArray[][] from within the AnimationNodeNotify() method, since that seems to be the correct place to access the scene's current frame using the HFBEvaluateInfo pEvaluateInfo parameter to that method.
My goal is to test for something simple like this:
if ( currentFrame > lastFrame )
then run the update code if it passes.
The problem is, if I have code like this to get a frame back:
FBTime& pStartTime = pEvaluateInfo->GetLocalStart();
pStartTime.GetTime( pHour, pMinute, pSecond, pFrame, pField, pMilliSecond );
the pFrame value holds a SMPTE-style frame number that only ranges from (for example) 0 to 24--I.E.; how many frames have passed for that second. What I really want to know is:
if ( current frame in the scene > last frame in the scene ).
So, for example, say I just moved to frame# 1783 in the scene. I enter the AnimationNodeNotify() method and perform the test just mentioned. It passes, and I go perform the updates to myArray[][]. Now I only want to perform another update calculation when we later move on to frame# 1784 in the scene, but not to do it all over again while it's still frame# 1783 during the next pass through the AnimationNodeNotify() method.
Only having access to the SMPTE frame, whichs rolls over at 24, doesn't allow me to simply and directly test frame numbers in this way.
Can anyone give me advice on how to get back from the scene frame numbers like #1783 and #1784 directly, without having to write a routine to extract the info from value returns that are formed more like this: 00:10:34:24:00:78 ? (Also, why waste the cycles and slow the performance?)
Thanks in advance for any specific help with this, or for any other general advice on using this approach for deformations.
-MoBooLoo
UPDATE:
So, to update for anyone who's interested, the solution is simple:
FBTime& pStartTime = pEvaluateInfo->GetLocalStart();
kLongLong currFrame = pStartTime.GetFrame( true, kFBTimeModeCinema );
Sorry for the long-winded post on a question so easy. I seem to remember trying to use GetFrame() earlier, and it wasn't working for me, so I was trying a different route when I got into the SMPTE stuff. I must've foobar'd something in the attempt (probably the mode).
-MoBooLoo