Exemplo n.º 1
0
// Save
status_t
BitmapSetSaver::Save(Document* document)
{
	entry_ref actualRef(fRef);
	char name[B_OS_NAME_LENGTH];

	// 64x64
	snprintf(name, sizeof(name), "%s_64.png", fRef.name);
	actualRef.set_name(name);
	Exporter* exporter = new BitmapExporter(64);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	// 16x16
	snprintf(name, sizeof(name), "%s_16.png", fRef.name);
	actualRef.set_name(name);
	exporter = new BitmapExporter(16);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	// 32x32
	snprintf(name, sizeof(name), "%s_32.png", fRef.name);
	actualRef.set_name(name);
	exporter = new BitmapExporter(32);
	exporter->SetSelfDestroy(true);
	exporter->Export(document, actualRef);

	return B_OK;
}
Exemplo n.º 2
0
// ------------------------------------------------------------------------------------------------
ASSIMP_API aiReturn aiExportSceneEx( const aiScene* pScene, const char* pFormatId, const char* pFileName, aiFileIO* pIO, unsigned int pPreprocessing )
{
	Exporter exp;

	if (pIO) {
		exp.SetIOHandler(new CIOSystemWrapper(pIO));
	}
	return exp.Export(pScene,pFormatId,pFileName,pPreprocessing);
}
Exemplo n.º 3
0
void MainWindow::on_butExport_clicked()
{
    using namespace Assimp;

#ifndef ASSIMP_BUILD_NO_EXPORT
    QString filename, filter, format_id;
    Exporter exporter;
    QTime time_begin;
    aiReturn rv;
    QStringList exportersList;
    QMap<QString, const aiExportFormatDesc*> exportersMap;


	if(mScene == nullptr)
	{
		QMessageBox::critical(this, "Export error", "Scene is empty");

		return;
	}

	for (size_t i = 0; i < exporter.GetExportFormatCount(); ++i)
	{
		const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
		exportersList.push_back(desc->id + QString(": ") + desc->description);
		exportersMap.insert(desc->id, desc);
	}

	// get an exporter
	bool dialogSelectExporterOk;
	QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk);
	if (!dialogSelectExporterOk)
		return;

	// build the filter
	QString selectedId = selectedExporter.left(selectedExporter.indexOf(':'));
	filter = QString("*.") + exportersMap[selectedId]->fileExtension;

	// get file path
	filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
	// if it's canceled
	if (filename == "")
		return;

	// begin export
	time_begin = QTime::currentTime();
	rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
	ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
	if(rv == aiReturn_SUCCESS)
		LogInfo("Export done: " + filename);
	else
	{
		QString errorMessage = QString("Export failed: ") + filename;
		LogError(errorMessage);
		QMessageBox::critical(this, "Export error", errorMessage);
	}
#endif
}
Exemplo n.º 4
0
    virtual bool exporterTest() {
        Importer importer;
        Exporter exporter;
        const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", 0);
        EXPECT_NE(nullptr, scene);
        EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "ply", ASSIMP_TEST_MODELS_DIR "/PLY/cube_test.ply"));

        return true;
    }
Exemplo n.º 5
0
void MainWindow::on_butExport_clicked()
{
using namespace Assimp;

QString filename, filter, format_id;
Exporter exporter;
QTime time_begin;
aiReturn rv;

	if(mScene == nullptr)
	{
		QMessageBox::critical(this, "Export error", "Scene is empty");

		return;
	}

	// build filter
	{
		aiString filter_temp;

		mImporter.GetExtensionList(filter_temp);
		filter = filter_temp.C_Str();
		filter.replace(';', ' ');
	}

	// get file path
	filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
	// extract format ID
	format_id = filename.right(filename.length() - filename.lastIndexOf('.') - 1);
	if(format_id.isEmpty())
	{
		QMessageBox::critical(this, "Export error", "File name must has extension.");

		return;
	}

	// begin export
	time_begin = QTime::currentTime();
	rv = exporter.Export(mScene, format_id.toLocal8Bit(), filename.toLocal8Bit());
	ui->lblExportTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime())));
	if(rv == aiReturn_SUCCESS)
		LogInfo("Export done: " + filename);
	else
		LogError("Export failed: " + filename);
}