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

Qt3D: Changing entity parent is not reflected on the backend

    XMLWordPrintable

Details

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

    Description

      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:

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes