示例#1
0
bool AnimationManagerBase_readLocalData(osgAnimation::AnimationManagerBase &manager, Input &fr)
{
    int  nbAnims          = 0;
    bool iteratorAdvanced = false;

    if (fr.matchSequence("num_animations %i"))
    {
        fr[1].getInt(nbAnims);
        fr              += 2;
        iteratorAdvanced = true;
    }

    for (int i = 0; i < nbAnims; i++)
    {
        Object                  *o = fr.readObject();
        osgAnimation::Animation *a = dynamic_cast<osgAnimation::Animation*>(o);
        if (a)
        {
            manager.registerAnimation(a);
            iteratorAdvanced = true;
        }
        else
            osg::notify(osg::WARN) << "Warning: can't read an animation object" << std::endl;
    }

    return iteratorAdvanced;
}
示例#2
0
static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManagerBase& manager )
{
    unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
    for ( unsigned int i=0; i<size; ++i )
    {
        osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( is.readObject() );
        if ( ani ) manager.registerAnimation( ani );
    }
    is >> osgDB::END_BRACKET;
    return true;
}