Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47486

Weird entity/component/scene setup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.5.1
    • Qt3D
    • 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

            lagocs Laszlo Agocs
            lagocs Laszlo Agocs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes