From 0c378399c4033bba5ead4d184b3ce7e094cb4a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Thu, 12 Dec 2019 19:21:34 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@697 a8b55f48-bf90-11e4-a774-851b48703e85 --- qglengine/formats/loader_assimp.cpp | 8 ++++++++ qglengine/formats/loader_assimp.h | 1 + qglengine/globject.h | 2 +- qglengine/qglview_test/qglview_window.cpp | 17 +++++------------ qglengine/qglview_test/qglview_window.h | 1 + 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/qglengine/formats/loader_assimp.cpp b/qglengine/formats/loader_assimp.cpp index 5fd6790..8ea663c 100644 --- a/qglengine/formats/loader_assimp.cpp +++ b/qglengine/formats/loader_assimp.cpp @@ -253,3 +253,11 @@ Scene * loadScene(const QString & filepath) { return scene; } + + +QStringList supportedFormats() { + Assimp::Importer importer; + aiString ret; + importer.GetExtensionList(ret); + return fromAiString(ret).toLower().split(";"); +} diff --git a/qglengine/formats/loader_assimp.h b/qglengine/formats/loader_assimp.h index 43070dc..19b63e4 100644 --- a/qglengine/formats/loader_assimp.h +++ b/qglengine/formats/loader_assimp.h @@ -22,5 +22,6 @@ #include "gltypes.h" Scene * loadScene(const QString & filepath); +QStringList supportedFormats(); #endif // LOADER_ASSIMP_H diff --git a/qglengine/globject.h b/qglengine/globject.h index a797c3d..a98d2b6 100644 --- a/qglengine/globject.h +++ b/qglengine/globject.h @@ -147,7 +147,7 @@ public: QMatrix4x4 matrix() const; bool isRawMatrix() {return raw_matrix;} QVector3D inParentSpace(const QVector3D & v) const; - void transferTransformToChildren(bool only_scale = true); + void transferTransformToChildren(bool only_scale = false); void cleanTree(); bool isAcceptLight() const {return accept_light;} diff --git a/qglengine/qglview_test/qglview_window.cpp b/qglengine/qglview_test/qglview_window.cpp index ace6511..5d9291a 100644 --- a/qglengine/qglview_test/qglview_window.cpp +++ b/qglengine/qglview_test/qglview_window.cpp @@ -30,6 +30,9 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView setupUi(this); session.setFile("session_qglview_test.conf"); session.addEntry(this); + + extensions = "All(" + supportedFormats().join(" ") + " *.qgl)"; + extensions += ";;QGLEngine(*.qgl)"; //view->view()->camera()->setPos(QVector3D(2, 2, 2)); //view->view()->camera()->setAim(QVector3D()); @@ -148,12 +151,7 @@ void QGLViewWindow::on_actionReset_triggered() { void QGLViewWindow::on_actionImport_triggered() { - QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;" - "QGLView(*.qgl);;" - "Ascii Scene Export(*.ase);;" - "3D Studio(*.3ds);;" - "Wavefront OBJ(*.obj);;" - "Collada(*.dae)"); + QStringList fl = QFileDialog::getOpenFileNames(this, "Select files", prev_path, extensions); if (fl.isEmpty()) return; prev_path = fl.back(); foreach (QString f, fl) @@ -188,12 +186,7 @@ void QGLViewWindow::on_actionSaveSelected_triggered() { void QGLViewWindow::on_actionOpen_triggered() { - QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, "Supported types(*.qgl *.ase *.3ds *.obj *.dae);;" - "QGLView(*.qgl);;" - "Ascii Scene Export(*.ase);;" - "3D Studio(*.3ds);;" - "Wavefront OBJ(*.obj);;" - "Collada(*.dae)"); + QString f = QFileDialog::getOpenFileName(this, "Select file", prev_path, extensions); if (f.isEmpty()) return; prev_path = f; loadFile(f); diff --git a/qglengine/qglview_test/qglview_window.h b/qglengine/qglview_test/qglview_window.h index 9670b4e..c96687c 100644 --- a/qglengine/qglview_test/qglview_window.h +++ b/qglengine/qglview_test/qglview_window.h @@ -53,6 +53,7 @@ private: void changeEvent(QEvent * e); void timerEvent(QTimerEvent * ); + QString extensions; QTranslator translator; QString prev_path; //GLPrimitiveCube * box;