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