def apply(node):
     
     if _am.valid() :
         return
     if node.getUpdateCallback() : 
         b = dynamic_cast<osgAnimation.AnimationManagerBase*>(node.getUpdateCallback())
         if b : 
             _am = osgAnimation.BasicAnimationManager(*b)
             return
     traverse(node)
class AnimationManagerFinder (osg.NodeVisitor) :
_am = osgAnimation.BasicAnimationManager()
    AnimationManagerFinder() : osg.NodeVisitor(osg.NodeVisitor.TRAVERSE_ALL_CHILDREN) 
    def apply(node):
        
        if _am.valid() :
            return
        if node.getUpdateCallback() : 
            b = dynamic_cast<osgAnimation.AnimationManagerBase*>(node.getUpdateCallback())
            if b : 
                _am = osgAnimation.BasicAnimationManager(*b)
                return
        traverse(node)
    updatecb.getStackedTransforms().push_back(osgAnimation.StackedTranslateElement("position"))
    updatecb.getStackedTransforms().push_back(osgAnimation.StackedRotateAxisElement("euler",osg.Vec3(1,0,0),0))
    #connect the UpdateMatrixTransform callback to the MatrixTRanform
    trans.setUpdateCallback(updatecb)
    #initialize MatrixTranform
    trans.setMatrix(osg.Matrix.identity())
    #append geometry node
    trans.addChild (geode)

    root.addChild (axe)
    root.addChild (trans)

    # Define a scheduler for our animations
    grp = osg.Group()
    #add the animation manager to the scene graph to get it called during update traversals
    mng = osgAnimation.BasicAnimationManager()
    grp.setUpdateCallback(mng)
    #add the rest of the scene to the grp node
    grp.addChild(root)

    # And we finaly define our channel for linear Vector interpolation
    channelAnimation1 = osgAnimation.Vec3LinearChannel()
    #name of the AnimationUpdateCallback
    channelAnimation1.setTargetName("AnimatedCallback")
    #name of the StackedElementTransform for position modification
    channelAnimation1.setName("position")
    #Create keyframes for (in this case linear) interpolation of a osg.Vec3
    channelAnimation1.getOrCreateSampler().getOrCreateKeyframeContainer().push_back(osgAnimation.Vec3Keyframe(0, osg.Vec3(0,0,0)))
    channelAnimation1.getOrCreateSampler().getOrCreateKeyframeContainer().push_back(osgAnimation.Vec3Keyframe(2, osg.Vec3(1,1,0)))
    anim1 = osgAnimation.Animation()
    anim1.addChannel(channelAnimation1)