[SOLVED] World::getNodes() returns objects inside NodeReferences as separate one


photo

Recommended Posts

Hi UNIGINE-Team,

 

I don't know if it is an intented behavior but after migrating my codebase to the newest 2.10-release, I get an "unexpected" behavior from the World::getNodes()-function. During initializing the world, I iterate through all objects and add them to my custom classes. Previous, I got only that nodes, that are created in editor. Mainly the sun and default player, a static mesh and an node reference.

With the new version I got 6 (?!) objects, the four above and two times the dynamic mesh inside my node reference. Unfortunately the node reference contains only one dynamic mesh, but the World::getNodes() returns the node inside my reference twice. For the .world-file everything seems to be correct, because there are only four nodes in it.

 

Best

Christian

Edited by christian.wolf2
Link to post

Hi Сhristian,

AFAIK, World::getNodes() always returned all the nodes (including cached one, internals of node references and so on). If you want only the root ones, you can try to use World::getRootNodes() instead: https://developer.unigine.com/en/docs/2.10/api/library/engine/class.world?rlang=cpp#getRootNodes_VECNode_void

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi silent,

 

many thanks for the quick reply. Indeed, getRootNodes() does the trick on my site. It was not clear for me by reading the API-documentation about that one.

Thanks!

Link to post
  • silent changed the title to [SOLVED] World::getNodes() returns objects inside NodeReferences as separate one