Robert Osfield wrote on Thursday, May 21, 2009 3:49 AM:
> On Thu, May 21, 2009 at 9:44 AM, Philip Lamb <[email protected]> wrote:
>> Thanks for the help. However, I'm not sure how I go about locating
which
>> nodes have AnimationPathCallback attached in the nodevisitor. I think
I
>> understand that usually in a nodevisitor, one can just overload the
accept()
>> method with the node type one is interested in, but in this case the
>> callbacks are attached to MatrixTransformation nodes; how to I
identify
>> whether a MatrixTransform has an attached AnimationPathCallback?
>>
>> If there's a piece of sample code which shows a method, I'd be happy
just to
>> be pointed to that.
>
> In the NodeiVisitor simply do:
>
> void apply(osg::Transform& tranform)
> {
> osg::AnimationPathCallback* apc =
>
dynamic_cast<osg::AnimationPathCallback*>(transform.getUpdateCallback())
;
> if (apc)
> {
> // do your stuff...
> }
> }
If you're just worried about AnimationPathCallback, it has a
setPause(bool pause) function.
Also, if Philip wants to pause all animations in the scene (instead of
just ones from the subgraph), he could just pause the simulation time in
the frame loop like this untested code:
while (!viewer.done())
{
double simTime = USE_REFERENCE_TIME;
if (paused)
{
simTime = timeAtPause;
}
viewer.frame(simTime);
}
--
Bryan Thrall
FlightSafety International
[email protected]
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org