[osg-users] FindNodeVisitor Operation?
umituzun84 at gmail.com
Tue Jul 15 07:09:50 PDT 2008
Thanks for your useful help. I will try to create new TransformMatrixes for
unhandled geodes. First method can create so many problem. Programmatic way
is more understandable. Maybe, after I create MatrixTransformes and collect
all components then I can save .osg format the model with arranged type, and
then I can read this .osg model instead of collection the parent-child
status every time :)
2008/7/15 David Spilling <david.spilling at gmail.com>:
> Firstly, do you need to add MatrixTransforms above all your geodes, or just
> the ones that have them now?
> You have a couple of strategies.
> The first one is to modify your model so it has uniquely named
> _MatrixTransforms_ above every geode. At the moment they are all called the
> same thing, so you end up finding 8 nodes when you look for a particular
> name. I don't know much about 3DS, so if it were up to me I would probably
> do it by hand editing the OSG file. However, this clearly impacts your art
> path (because updates to your model will always involve some hand editing).
> There is probably a way of persuading 3DS to name transforms... anybody?
> The second one is more programmatic. Your geodes are, at least, all
> uniquely named. You can search fo a geode, and then look for it's parent. If
> it's parent is a MatrixTransform, then you have your node. e.g. (lots of
> checks omitted)
> findNodeVisitor findNode("1_planetar");
> std::vector<osg::Node*> nodeList = findNode.getNodeList();
> osg::Node* node = nodeList; // no check on size of list
> osg::MatrixTransform* tf =
> dynamic_cast<osg::MatrixTransform>(node->getParent(0)); // no check on
> whether there is more than one parent
> if(tf!=NULL) // do stuff
> This route is hard to generalise. For example, there's no check on whether
> any geodes share a MatrixTransform as a parent - in which case strange
> things will happen later. Also if the parent isn't a MatrixTransform, you'll
> want to add one as a child to said parent, and move the geode across to be a
> child of the MatrixTransform via addChild, removeChild etc., which is a bit
> It will come down to how 3DStudio works in the end, I think, and what you
> can persuade it to output so that your approach can be generalised.
> osg-users mailing list
> osg-users at lists.openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users