sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
923 stars 311 forks source link

[SofaGuiQt] QTreeWidget is not correctly updated with a DefaultCollisionGroupManager #2066

Open alxbilger opened 3 years ago

alxbilger commented 3 years ago

The component DefaultCollisionGroupManager manipulates the scene graph structure, by creating nodes, and moving nodes or objects. It happens when there are contacts. The scene graph is correctly updated, but the tree in the runSofa Qt panel is not correctly updated according to the new graph structure. Here is an example: Capture d’écran du 2021-05-06 23-25-18 In the screenshot, we can see that the root node has only one child node in the Qt panel (SaladBowl), but it has two child nodes in its Data child (SaladBowl and collision1). collision1 is created by DefaultCollisionGroupManager after a contact and should contain other nodes and objects. The issue arises in examples/Tutorials/Collision/MultipleObjectsDynamicCollisionGroups.scn where I took the screenshot, but also in other scenes with a DefaultCollisionGroupManager.

Note: DefaultCollisionGroupManager is optional in a scene.

fredroy commented 3 years ago

Not really related to your issue itself (GUI) but are you sure that DefaultCollisionGroupManager is working well? last time I tried, if you let the simulation running, you can see in MechanicalObjects keeping allocating vectors (without deleting them)... leading to a big slowdown and memory consumption.

alxbilger commented 3 years ago

No I am not sure. And I strongly suspect that it is related to the crash revealed in #2047. If what you say is true, it is a critical bug: I count 156 scenes (.scn) in Sofa where there is a DefaultCollisionGroupManager

alxbilger commented 3 years ago

As a workaround, the Qt tree view can be refreshed by switching to another tab (for example 'View'), and going back into the 'Graph' tab.