[osg-users] Fast move a lot of nodes to another group

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Apr 4 01:07:44 PDT 2017



Hi Yura,
> Hi,
> I need to move a lot of nodes from Group to MatrixTransform to translate them into new position by user input, and then move them back into Group with new position. Call addChild and removeChild for each node is slow because of removeChild. Also I cant use removeChildren to remove all nodes at once because my node list is not continuous.
You could use the replaceChild like this: (assuming node is the Node to 
move and group its current parent)

transform = new MatrixTransform
transform->addChild(node);
group->replaceChild(node, transform);

This way the child list (implemented as a vector) is not changed in size 
for every operation.

Cheers
Sebastian
>
 >
>
>
> Thank you!
>
> Cheers,
> Yura
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70624#70624
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list