void ViewerWindow::openAnimations() { #if 0 QFileDialog dialog(this, "Open Animations", QDir::homePath(), "IFP Animations (*.ifp)"); if(dialog.exec()) { std::ifstream dfile(dialog.selectedFiles().at(0).toStdString().c_str()); AnimationList anims; if(dfile.is_open()) { dfile.seekg(0, std::ios_base::end); size_t length = dfile.tellg(); dfile.seekg(0); char *file = new char[length]; dfile.read(file, length); LoaderIFP loader; if( loader.loadFromMemory(file) ) { for(auto& f : loader.animations) { anims.push_back(f); } } delete[] file; } animationswidget->setAnimations(anims); } #endif }
//-------------------------------------------------------------------------- void FLevelFile::loadAnimations( const HRCFilePtr &model, const AnimationList &animations ) { AFileManager &a_mgr( AFileManager::getSingleton() ); AnimationList::const_iterator it ( animations.begin() ) , it_end( animations.end() ); while( it != it_end ) { String animation_name; StringUtil::splitBase( it->name, animation_name ); StringUtil::toLowerCase( animation_name ); String animation_filename( animation_name + FF7::EXT_A ); AFilePtr animation( a_mgr.load( animation_filename, model->getGroup() ) ); animation_name = FF7::NameLookup::animation( animation_name ); Ogre::LogManager::getSingleton().stream() << " Adding Animation: " << animation_name; animation->addTo( model->getSkeleton(), animation_name ); ++it; } }
void ModelViewer::loadAnimations(const QString& file) { std::ifstream dfile(file.toStdString().c_str(), std::ios_base::binary); AnimationList anims; if (dfile.is_open()) { dfile.seekg(0, std::ios_base::end); size_t length = dfile.tellg(); dfile.seekg(0); char* file = new char[length]; dfile.read(file, length); LoaderIFP loader; if (loader.loadFromMemory(file)) { for (auto& f : loader.animations) { anims.push_back(f); } } delete[] file; } animationWidget->setAnimations(anims); }
//----------------------------------------------------------------------------- void XsiSkeletonExporter::createAnimations(Skeleton* pSkel, DeformerMap& deformers, float fps, AnimationList& animList, AxisAlignedBox& AABBPadding) { for (AnimationList::iterator ai = animList.begin(); ai != animList.end(); ++ai) { AnimationEntry& animEntry = *ai; // Note that we don't know if this time period includes bone animation // but we sample it anyway just in case; animation optimisation will // eliminate anything that's redundant // A little wasteful perhaps, but it's the only guaranteed way to pick // up all the potentially derived effects on deformers float animLength = (float)(animEntry.endFrame - animEntry.startFrame) / fps; StringUtil::StrStreamType str; str << "Creating animation " << animEntry.animationName << " with length " << animLength << " seconds"; LogOgreAndXSI(str.str()); Animation* anim = pSkel->createAnimation(animEntry.animationName, animLength); createAnimationTracksSampled(anim, animEntry, deformers, fps, AABBPadding); } }
void LocationParser_ns::parseAnimation(AnimationList &list, char *name) { debugC(5, kDebugParser, "parseAnimation(name: %s)", name); if (_vm->_location.findAnimation(name)) { _zoneProg++; _script->skip("endanimation"); return; } AnimationPtr a(new Animation); _zoneProg++; strncpy(a->_name, name, ZONENAME_LENGTH); a->_flags |= kFlagsIsAnimation; list.push_front(AnimationPtr(a)); ctxt.a = a; _parser->pushTables(&_locationAnimParsers, _locationAnimStmt); }
///Удаление анимации void RemoveAnimation (AnimationImpl* animation) { animations.erase (stl::remove (animations.begin (), animations.end (), animation), animations.end ()); }