Importing objects in Qt3D doesn't work but there's not error message

南楼画角 提交于 2020-01-30 09:21:25

问题


I have a Qt3D application which imports STL file formats:

m_sceneLoaderEntity = new Qt3DCore::QEntity();
m_sceneLoaderEntity->setObjectName("New imported entity");

Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(m_sceneLoaderEntity);

sceneLoader->setSource(fileUrl); // fileUrl is input

m_sceneLoaderEntity->addComponent(sceneLoader);

My application builds and runs without any problem with Qt 5.9.0, 5.9.1, 5.9.2, 5.9.3 and 5.9.4. So far so good.

My application build fine with Qt 5.9.5, 5.9.6 and Qt 5.11.0, but when runs, it cannot import STL files and does NOT give any error message! Can anybody give me a hint?


I understand that Qt3D uses assimp to import STL files. I tried to replace Qt 5.11.0 assimp dynamic library, i.e. libassimpsceneimport.so, with that of Qt 5.9.4, but it didn't work:

m3g1dd@linux:~/Qt5.11.0/5.11.0/gcc_64/plugins/sceneparsers> ls -lhrtci
total 17M
1613482572 -rwxrwxr-x 1 m3g1dd m3g1dd 172K Jun 10 08:41 libgltfsceneimport.so
1613482571 -rwxrwxr-x 1 m3g1dd m3g1dd 226K Jun 10 08:41 libgltfsceneexport.so
1613596422 -rwxr-xr-x 1 m3g1dd m3g1dd 6.8M Oct  8 10:00 libassimpsceneimport.so.Qt5.9.4
1613482570 -rwxrwxr-x 1 m3g1dd m3g1dd 9.8M Oct  8 10:00 libassimpsceneimport.so

回答1:


I downloaded and installed Qt 5.11.2 and my STL import code works fine as show below. But the imported STL has its Ambient, Diffuse and Specular colors set to white by default, which I thinks is related to an issue of assimp library mentioned on these:

https://bugreports.qt.io/browse/QTBUG-69385

https://github.com/assimp/assimp/issues/2059



来源:https://stackoverflow.com/questions/52697782/importing-objects-in-qt3d-doesnt-work-but-theres-not-error-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!