Important: Please read the Qt Code of Conduct -

Qt3D - Scene3D and 'persistent' root entity

  • Hi,

    I've got an application which can switch between a 3d view (Scene3D) and a 'normal' qt quick view (settings page with tables, input fields,...). The root entity in the Scene3D is a custom registered type (inherited from QEntity - RootEntity).
    Everytime I switch from the Scene3D page to another page, the Scene3D gets destructed and the aspectengine which has ownership over the root entity deletes my root entity. This sequence also deletes the meshes in the scene (because they are children of the root entiy). This means that every time i go back to my scene3d, i have to recreate the mesh data. What is the best way to avoid this? I could add another custom QEntity in between the root entity and my custom mesh entities as another 'layer' and detach it on destruction of the RootEntity. When a new Scene3D - RootEntity is instantiated i can then reattach this in between layer (I think), but it doesn't feel like an optimal solution...
    Anybody has other suggestions?


  • I used the extra layer and disconnect it at destruction of the rootentity and reconnect it when a new rootentity is available. Seems to work ok...


Log in to reply