Merge branch 'master' into issue_1655
commit
58c38022ab
|
@ -39,22 +39,22 @@ QTime time_begin = QTime::currentTime();
|
||||||
aiProcess_GenUVCoords | aiProcess_TransformUVCoords | aiProcess_FlipUVs);
|
aiProcess_GenUVCoords | aiProcess_TransformUVCoords | aiProcess_FlipUVs);
|
||||||
if(mScene != nullptr)
|
if(mScene != nullptr)
|
||||||
{
|
{
|
||||||
ui->lblLoadTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime())));
|
ui->lblLoadTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
|
||||||
LogInfo("Import done: " + pFileName);
|
LogInfo("Import done: " + pFileName);
|
||||||
// Prepare widgets for new scene.
|
// Prepare widgets for new scene.
|
||||||
ui->leFileName->setText(pFileName.right(pFileName.length() - pFileName.lastIndexOf('/') - 1));
|
ui->leFileName->setText(pFileName.right(pFileName.length() - pFileName.lastIndexOf('/') - 1));
|
||||||
ui->lstLight->clear();
|
ui->lstLight->clear();
|
||||||
ui->lstCamera->clear();
|
ui->lstCamera->clear();
|
||||||
ui->cbxLighting->setChecked(true), mGLView->Lighting_Enable();
|
ui->cbxLighting->setChecked(true); mGLView->Lighting_Enable();
|
||||||
ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false);
|
ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false);
|
||||||
ui->cbxTextures->setChecked(true), mGLView->Enable_Textures(true);
|
ui->cbxTextures->setChecked(true); mGLView->Enable_Textures(true);
|
||||||
//
|
//
|
||||||
// Fill info labels
|
// Fill info labels
|
||||||
//
|
//
|
||||||
// Cameras
|
// Cameras
|
||||||
ui->lblCameraCount->setText(QString("%1").arg(mScene->mNumCameras));
|
ui->lblCameraCount->setText(QString::number(mScene->mNumCameras));
|
||||||
// Lights
|
// Lights
|
||||||
ui->lblLightCount->setText(QString("%1").arg(mScene->mNumLights));
|
ui->lblLightCount->setText(QString::number(mScene->mNumLights));
|
||||||
// Meshes, faces, vertices.
|
// Meshes, faces, vertices.
|
||||||
size_t qty_face = 0;
|
size_t qty_face = 0;
|
||||||
size_t qty_vert = 0;
|
size_t qty_vert = 0;
|
||||||
|
@ -65,9 +65,9 @@ QTime time_begin = QTime::currentTime();
|
||||||
qty_vert += mScene->mMeshes[idx_mesh]->mNumVertices;
|
qty_vert += mScene->mMeshes[idx_mesh]->mNumVertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->lblMeshCount->setText(QString("%1").arg(mScene->mNumMeshes));
|
ui->lblMeshCount->setText(QString::number(mScene->mNumMeshes));
|
||||||
ui->lblFaceCount->setText(QString("%1").arg(qty_face));
|
ui->lblFaceCount->setText(QString::number(qty_face));
|
||||||
ui->lblVertexCount->setText(QString("%1").arg(qty_vert));
|
ui->lblVertexCount->setText(QString::number(qty_vert));
|
||||||
// Animation
|
// Animation
|
||||||
if(mScene->mNumAnimations)
|
if(mScene->mNumAnimations)
|
||||||
ui->lblHasAnimation->setText("yes");
|
ui->lblHasAnimation->setText("yes");
|
||||||
|
@ -87,11 +87,26 @@ QTime time_begin = QTime::currentTime();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->lblLoadTime->clear();
|
ResetSceneInfos();
|
||||||
LogError(QString("Error parsing \'%1\' : \'%2\'").arg(pFileName).arg(mImporter.GetErrorString()));
|
|
||||||
|
QString errorMessage = QString("Error parsing \'%1\' : \'%2\'").arg(pFileName).arg(mImporter.GetErrorString());
|
||||||
|
QMessageBox::critical(this, "Import error", errorMessage);
|
||||||
|
LogError(errorMessage);
|
||||||
}// if(mScene != nullptr)
|
}// if(mScene != nullptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ResetSceneInfos()
|
||||||
|
{
|
||||||
|
ui->lblLoadTime->clear();
|
||||||
|
ui->leFileName->clear();
|
||||||
|
ui->lblMeshCount->setText("0");
|
||||||
|
ui->lblFaceCount->setText("0");
|
||||||
|
ui->lblVertexCount->setText("0");
|
||||||
|
ui->lblCameraCount->setText("0");
|
||||||
|
ui->lblLightCount->setText("0");
|
||||||
|
ui->lblHasAnimation->setText("no");
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/************************ Logging functions *************************/
|
/************************ Logging functions *************************/
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
@ -202,6 +217,8 @@ using namespace Assimp;
|
||||||
mLoggerView = new CLoggerView(ui->tbLog);
|
mLoggerView = new CLoggerView(ui->tbLog);
|
||||||
DefaultLogger::create("", Logger::VERBOSE);
|
DefaultLogger::create("", Logger::VERBOSE);
|
||||||
DefaultLogger::get()->attachStream(mLoggerView, DefaultLogger::Debugging | DefaultLogger::Info | DefaultLogger::Err | DefaultLogger::Warn);
|
DefaultLogger::get()->attachStream(mLoggerView, DefaultLogger::Debugging | DefaultLogger::Info | DefaultLogger::Err | DefaultLogger::Warn);
|
||||||
|
|
||||||
|
ResetSceneInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -223,8 +240,8 @@ using namespace Assimp;
|
||||||
|
|
||||||
void MainWindow::Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance)
|
void MainWindow::Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance)
|
||||||
{
|
{
|
||||||
ui->lblRenderTime->setText(QString("%1").arg(pPaintTime_ms));
|
ui->lblRenderTime->setText(QString::number(pPaintTime_ms));
|
||||||
ui->lblDistance->setText(QString("%1").arg(pDistance));
|
ui->lblDistance->setText(QString::number(pDistance));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SceneObject_Camera(const QString& pName)
|
void MainWindow::SceneObject_Camera(const QString& pName)
|
||||||
|
@ -265,9 +282,10 @@ QString filename, filter, format_id;
|
||||||
Exporter exporter;
|
Exporter exporter;
|
||||||
QTime time_begin;
|
QTime time_begin;
|
||||||
aiReturn rv;
|
aiReturn rv;
|
||||||
QStringList exporterList;
|
QStringList exportersList;
|
||||||
QMap<QString, const aiExportFormatDesc*> exportersMap;
|
QMap<QString, const aiExportFormatDesc*> exportersMap;
|
||||||
|
|
||||||
|
|
||||||
if(mScene == nullptr)
|
if(mScene == nullptr)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, "Export error", "Scene is empty");
|
QMessageBox::critical(this, "Export error", "Scene is empty");
|
||||||
|
@ -278,13 +296,13 @@ QMap<QString, const aiExportFormatDesc*> exportersMap;
|
||||||
for (int i = 0; i < exporter.GetExportFormatCount(); ++i)
|
for (int i = 0; i < exporter.GetExportFormatCount(); ++i)
|
||||||
{
|
{
|
||||||
const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
|
const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
|
||||||
exporterList.push_back(desc->id + QString(": ") + desc->description);
|
exportersList.push_back(desc->id + QString(": ") + desc->description);
|
||||||
exportersMap.insert(desc->id, desc);
|
exportersMap.insert(desc->id, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get an exporter
|
// get an exporter
|
||||||
bool dialogSelectExporterOk;
|
bool dialogSelectExporterOk;
|
||||||
QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exporterList, 0, false, &dialogSelectExporterOk);
|
QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk);
|
||||||
if (!dialogSelectExporterOk)
|
if (!dialogSelectExporterOk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -301,13 +319,14 @@ QMap<QString, const aiExportFormatDesc*> exportersMap;
|
||||||
// begin export
|
// begin export
|
||||||
time_begin = QTime::currentTime();
|
time_begin = QTime::currentTime();
|
||||||
rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
|
rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
|
||||||
ui->lblExportTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime())));
|
ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
|
||||||
if(rv == aiReturn_SUCCESS)
|
if(rv == aiReturn_SUCCESS)
|
||||||
LogInfo("Export done: " + filename);
|
LogInfo("Export done: " + filename);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogError("Export failed: " + filename);
|
QString errorMessage = QString("Export failed: ") + filename;
|
||||||
QMessageBox::critical(this, "Error", "Export failed: " + filename);
|
LogError(errorMessage);
|
||||||
|
QMessageBox::critical(this, "Export error", errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,11 @@ private:
|
||||||
/// \param [in] pFileName - path and name of the file.
|
/// \param [in] pFileName - path and name of the file.
|
||||||
void ImportFile(const QString& pFileName);
|
void ImportFile(const QString& pFileName);
|
||||||
|
|
||||||
|
|
||||||
|
/// \fn void ResetSceneInfos()
|
||||||
|
/// Reset informations about the scene
|
||||||
|
void ResetSceneInfos();
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/************************ Logging functions *************************/
|
/************************ Logging functions *************************/
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue