示例#1
0
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
}
示例#2
0
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);
}