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

Qt3D: Changing entity parent is not reflected on the backend

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 5.12.4
    • 5.12.1
    • Qt3D
    • None

      If the parent of an entity is changed in a scene graph with more than one level of entities, the entity is not reported as a child of the parent on the backend.

      The following code reproduces the issue:

      Qt3DCore::QEntity *grandParentNode = new Qt3DCore::QEntity(rootEntity);
      Qt3DCore::QEntity *parentNode = new Qt3DCore::QEntity(rootEntity);
      Qt3DCore::QEntity *leafNode = new Qt3DCore::QEntity(rootEntity);
      
      grandParentNode->setParent(rootEntity);
      parentNode->setParent(grandParentNode);
      leafNode->setParent(parentNode); 

      A working example is attached, based on cylinder-cpp.

      The problem appears to be that m_changeArbiter is not properly set on all of the nodes. I am not sure where the m_changeArbiter should have been set in this case.

      However, even with m_changeArbiter set properly, the children of a QEntity will never be propagated correctly to the backend if there are other non-QEntity nodes in the tree. This is because QNode::_q_addChild does not take into account that entity parent/child relationships traverse across non-QEntity nodes (see the implementation of QEntity::parentEntity). This is also illustrated in the attached example.

      Actual result:

      Expected result:

       

        1. cylinder-cpp.zip
          3 kB
          Svenn-Arne Dragly
        2. image-2019-02-19-22-40-33-863.png
          5 kB
          Svenn-Arne Dragly
        3. image-2019-02-19-22-46-50-548.png
          6 kB
          Svenn-Arne Dragly
        4. cylinder-cpp.zip
          3 kB
          Svenn-Arne Dragly
        For Gerrit Dashboard: QTBUG-73905
        # Subject Branch Project Status CR V

            jim.albamont James Albamont
            dragly Svenn-Arne Dragly
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes