当前位置: 首页>>代码示例>>C++>>正文


C++ Exporter::GetExportFormatDescription方法代码示例

本文整理汇总了C++中Exporter::GetExportFormatDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ Exporter::GetExportFormatDescription方法的具体用法?C++ Exporter::GetExportFormatDescription怎么用?C++ Exporter::GetExportFormatDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exporter的用法示例。


在下文中一共展示了Exporter::GetExportFormatDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_butExport_clicked

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
}
开发者ID:BeamNG,项目名称:assimp,代码行数:57,代码来源:mainwindow.cpp

示例2: orig

// ------------------------------------------------------------------------------------------------
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t index)
{
    // Note: this is valid as the index always pertains to a built-in exporter,
    // for which the returned structure is guaranteed to be of static storage duration.
    Exporter exporter;
    const aiExportFormatDesc* orig( exporter.GetExportFormatDescription( index ) );
    if (NULL == orig) {
        return NULL;
    }

    aiExportFormatDesc *desc = new aiExportFormatDesc;
    desc->description = new char[ strlen( orig->description ) + 1 ]();
    ::strncpy( (char*) desc->description, orig->description, strlen( orig->description ) );
    desc->fileExtension = new char[ strlen( orig->fileExtension ) + 1 ]();
    ::strncpy( ( char* ) desc->fileExtension, orig->fileExtension, strlen( orig->fileExtension ) );
    desc->id = new char[ strlen( orig->id ) + 1 ]();
    ::strncpy( ( char* ) desc->id, orig->id, strlen( orig->id ) );

    return desc;
}
开发者ID:BeamNG,项目名称:assimp,代码行数:21,代码来源:AssimpCExport.cpp


注:本文中的Exporter::GetExportFormatDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。