-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
5.5.1
-
None
-
01a380405e05ad18251ec6635c096392c89633a7
Change the assimp-cpp example to:
diff --git a/examples/qt3d/assimp-cpp/main.cpp b/examples/qt3d/assimp-cpp/main.cpp index d068f44..47149e8 100644 --- a/examples/qt3d/assimp-cpp/main.cpp +++ b/examples/qt3d/assimp-cpp/main.cpp @@ -92,10 +92,11 @@ int main(int ac, char **av) Qt3D::QSceneLoader *sceneLoader = new Qt3D::QSceneLoader(sceneLoaderEntity); sceneLoaderEntity->addComponent(sceneLoader); - QWidget *container = new QWidget(); - QFileDialog dialog; - dialog.setFileMode(QFileDialog::AnyFile); - sceneLoader->setSource(dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"))); + // QWidget *container = new QWidget(); + // QFileDialog dialog; + // dialog.setFileMode(QFileDialog::AnyFile); + // sceneLoader->setSource(dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"))); + sceneLoader->setSource(QUrl::fromLocalFile("../exampleresources/assets/obj/toyplane.obj")); engine.setRootEntity(sceneRoot); view.show();
the rendering is still correct. However, there are now messages like:
Trying to assign a non shareable component to more than one Entity Trying to assign a non shareable component to more than one Entity Qt3D.Renderer.Frontend: It is strongly discouraged to share SceneLoader component between entities
These are not present when the file is selected via a (modal) dialog from main() before showing the window and entering the main event loop.
A quick inspection of the m_componentToEntities for the QSceneLoader component indicates that the multi-hash indeed has multiple entity IDs for the component, but they are all the same ID.
For Gerrit Dashboard: QTBUG-47486 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
122548,2 | Do not add duplicate entities to the component-to-entities map | 5.5 | qt/qt3d | Status: MERGED | +2 | 0 |