Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt3D 2.0 - Scene doesn't update when adding new QEntities

Qt3D 2.0 - Scene doesn't update when adding new QEntities

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 920 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    x6herbius
    wrote on last edited by
    #1

    I've just started playing with the new Qt3D 2.0, but as documentation is sparse I need a solution to the following.

    I can get a scene to render fine by creating my QEntities and then setting the root on the QAspectEngine. However, any entities that I add after having set the root do not show up in the scene. I'd imagine there would need to be some communication sent to notify that the scene has been updated but I don't know what this would be. Can anyone point me in the right direction on this?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      x6herbius
      wrote on last edited by x6herbius
      #2

      Sorry to bump but I can't really progress until I've solved this.

      EDIT: Just discovered something: if a QEntity has its parent entity set in its constructor after having called QAspectEngine::setRootEntity() then it doesn't show up in the scene, but if the parent is set using setParent() then it does show up. This might be a bug with Qt 5.5's implementation of Qt3D.

      To test this, you can copy the code from the "simple-cpp" Qt3D example and put the following at the bottom of main.cpp, between engine.setRootEntity(rootEntity) and view.show():

      // This torus should appear 5 units below the central one.
      Qt3D::QEntity* test = new Qt3D::QEntity(rootEntity);    // Setting the parent here means the torus doesn't show up.
      Qt3D::QTransform* testTransform = new Qt3D::QTransform();
      Qt3D::QTranslateTransform* testTranslate = new Qt3D::QTranslateTransform();
      testTranslate->setDy(-5);
      testTransform->addTransform(testTranslate);
      test->addComponent(testTransform);
      test->addComponent(torusMesh);
      test->addComponent(material);
      
      // This torus should appear 5 units above the central one.
      Qt3D::QEntity* test2 = new Qt3D::QEntity(/*No parent this time*/);
      Qt3D::QTransform* testTransform2 = new Qt3D::QTransform();
      Qt3D::QTranslateTransform* testTranslate2 = new Qt3D::QTranslateTransform();
      testTranslate2->setDy(+5);
      testTransform2->addTransform(testTranslate2);
      test2->addComponent(testTransform2);
      test2->addComponent(torusMesh);
      test2->addComponent(material);
      test2->setParent(rootEntity);   // Setting the parent here makes the torus show up.
      

      I'd post an issue on the Qt3D GitHub page but I don't think they allow that right now (or I don't have the permissions).

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved