예제 #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;
}
예제 #3
0
static bool writeAnimations( osgDB::OutputStream& os, const osgAnimation::AnimationManagerBase& manager )
{
    const osgAnimation::AnimationList& animations = manager.getAnimationList();
    os.writeSize(animations.size()); os << osgDB::BEGIN_BRACKET << std::endl;
    for ( osgAnimation::AnimationList::const_iterator itr=animations.begin();
          itr!=animations.end(); ++itr )
    {
        os << itr->get();
    }
    os << osgDB::END_BRACKET << std::endl;
    return true;
}
예제 #4
0
bool AnimationManagerBase_writeLocalData(const osgAnimation::AnimationManagerBase &manager, Output &fw)
{
    const osgAnimation::AnimationList &animList = manager.getAnimationList();

    fw.indent() << "num_animations " << animList.size() << std::endl;

    for (osgAnimation::AnimationList::const_iterator it = animList.begin(); it != animList.end(); ++it)
    {
        if (!fw.writeObject(**it))
            osg::notify(osg::WARN) << "Warning: can't write an animation object" << std::endl;
    }

    return true;
}
예제 #5
0
static bool checkAnimations( const osgAnimation::AnimationManagerBase& manager )
{
    return manager.getAnimationList().size()>0;
}