Skip to content

Conversation

@yungyuc
Copy link
Member

@yungyuc yungyuc commented May 3, 2022

The camera controller of scene is also a child of it. For some reason, QObject::findChildren<RStaticMesh<ND> *>() does not only return RStaticMesh<ND> *, but also the controller. Consequently the controller gets deleted when "show" is called to replace the RStaticMesh.

The fix uses a loop through QNode::childNodes() and RTTI in the loop to correctly delete only RStaticMesh<ND>.

This is to fix the issue introduced in #63 , and eventually addresses #57 .

The camera controller of scene is also a child of it.  For some reason,
QObject::findChildren<RStaticMesh<ND> *>() does not only return RStaticMesh<ND>
*, but also the controller.  Consequently the controller gets deleted when
"show" is called to replace the RStaticMesh.

The fix uses a loop through QNode::childNodes() and RTTI in the loop to
correctly delete only RStaticMesh<ND>.
@yungyuc yungyuc added the bug Something isn't working label May 3, 2022
@yungyuc yungyuc self-assigned this May 3, 2022
{
RApplication * app = RApplication::instance();
RScene * scene = app->main()->viewer()->scene();
for (RStaticMesh<2> * child : scene->findChildren<RStaticMesh<2> *>())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The child includes the camera controller which gets deleted although it shouldn't be.

@yungyuc yungyuc merged commit 7dd712b into solvcon:master May 3, 2022
@yungyuc yungyuc deleted the bugfix/wrong-deletion branch May 3, 2022 00:51
@yungyuc
Copy link
Member Author

yungyuc commented May 3, 2022

@yanagiragi FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant