The code you send seems to be correct, you just apply the visitor on
GROUP and NODE typed OSG objects. But as I know animation paths can
only be attached to
osg::PositionAttitudeTransform
and
osg::MatrixTransform
so you have to apply the visitor on these type of objects...
Finally make the following dynamic casts to see if there is an
animationpath attached on these nodes.
p_UCB = dynamic_cast<osg::NodeCallback*>(NodeFromVisitor->getUpdateCallback());
p_APCB = dynamic_cast<osg::AnimationPathCallback*>(p_UCB);
p_AP = dynamic_cast<osg::AnimationPath *>(p_APCB->getAnimationPath());
In each step test for NULL. at last step p_AP will hold the animation
path if exists...
BR
Mustafa
2006/8/28, GMD GammerMaxyandex.ru <[EMAIL PROTECTED]>:
How to write NodeVisitor for search AnimationPath?
class MyAnimationVisitor : public osg::NodeVisitor
{
public:
MyAnimationVisitor
():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
virtual void apply(osg::Node& node)
{
traverse(node);
}
virtual void apply(osg::Geode& geode)
{
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
????????????????????????????
}
}
virtual void apply(osg::Group& group) {traverse(group); }
virtual void apply(osg::Transform& node)
{
apply((osg::Node&)node);
}
private:
std::string filename;
osg::Image* image;
};
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/