From Rick Pingry, "n my application I am walking through the scene graph looking for nodes of a specific name. I noticed there were times when some of the nodes were not named what I had expected. Upon reviewing the code, I noticed this was happening when there was a forward reference to a parented object.

The existing code uses a map with object ID's.  The original code only applied the name to a node for a new ID only if the node did not already exist in the map.  The problem was that there was another part of the code (when a parent was forward declared) that also created the node with the ID in the map, but it did not know its name.  I simply made sure that the name was set regardless of whether or not the node was already in the map. "
This commit is contained in:
Robert Osfield
2006-12-06 14:17:55 +00:00
parent 152c999f99
commit 49cd96cd44

View File

@@ -155,10 +155,10 @@ osg::Group *SceneLoader::load(const std::string &filename, const osgDB::ReaderWr
osg::ref_ptr<osg::PositionAttitudeTransform> pat = pats[j];
if (!pat.valid()) {
pat = new osg::PositionAttitudeTransform;
pat->setName(i->name);
pats[j] = pat;
}
pat->setName(i->name);
pat->addChild(i->layer_node.get());
pat->setPivotPoint(options_.csf->fix_point(i->pivot));