AlPlayFrame
 
 
 

An optimization of the view frame operation.

Synopsis

#include <AlPlayFrame.h> class AlPlayFrame
AlPlayFrame (boolean bAllChannels = FALSE); ~AlPlayFrame (); statusCode viewFrame (const double frame, const boolean doRedraw = TRUE); void setShowSameFrame (const boolean showSameFrame = FALSE) 

Description

Viewframes can be quite slow when done individually. The problem is that some information is being recomputed every time the viewFrame operation is called. This class encapsulates that dependency, doing the computation once, allowing for a series of viewframes to take place in rapid succession.

Be VERY VERY CAREFUL about how you use this class. As part of its optimization technique, a lot of animation information is cached outside of the normal messaging system. This means that if you delete some animation objects while an AlPlayFrame object is active, then at some stage PowerAnimator will become very confused (as in core dump confused). In addition, the constructor for this class REQUIRES that modeling windows be opened. Core dumps or strange behaviour within the application can occur if this condition is not met.

Ordinarily the AlPlayFrame class will not recompute a requested frame if it is already the current frame. However for certain uses (for example, if you are changing a keyframe position) it may be necessary to recompute the current frame. Passing TRUE to the setShowSameFrame method will allow you to override the default behavior.

To use AlPlayFrame, create an instance of AlPlayFrame at the point in your code where the viewFrames are to begin. Call the viewFrame member of that AlPlayframe object for as many frames as are necessary. When that AlPlayFrame object goes out of scope, the destructor undoes the optimization and it becomes safe to modify Alias structures. For example:

     make list_of_frames;      {          AlPlayFrame playframe;          for frm in list_of_frames do          {              playframe.viewFrame( frm );          }      }

AlPlayFrame::AlPlayFrame (boolean bAllChannels)

Description

Constructs a new AlPlayFrame object, and setup the PowerAnimator view frame module for playback.

Arguments

bAllChannels - if TRUE all channels are played

AlPlayFrame::~AlPlayFrame ()

Description

Destructor for a AlPlayFrame object. Undoes the playframe optimizations and allows safe modifications of Alias objects.

statusCode AlPlayFrame::viewFrame(const double frame, const boolean doRedraw)

Description

Views the universe at the frame time specified by "frame". All animated items in the universe will have their animation evaluated at the given frame time, and the animated parameters will now take on their new values. Note that if the model contains construction history, fillets and trims may be re-evaluated. This could cause any surface CV pointers to become invalid. Afterwards, any viewFrame pointers to anything should not be trusted. If this is a problem you should add a message handler for kMessageDagNodeReplaceGeometry.

Arguments

< frame - the time at which to evaluate the animation in the universe

< doRedraw - TRUE if this method should do the redraw, FALSE if the calling function well do it (perhaps by calling AlUniverse::redrawScreen)

Return Codes

sSuccess - the viewframe succeeded

sFailure - an error occurred (that is, the universe may not have been initialized)