From Marco Jez, "makes the LWS loader store LWO object names as node names, for easier recognition and retrieval by scene graph visitors.

With this fix, each PositionAttitudeTransform node that corresponds to an entry in the LWS file carries the name of the loaded object plus the layer number (for example, "objects/myobj.lwo.2")."
This commit is contained in:
Robert Osfield
2004-10-18 14:51:21 +00:00
parent 4c8e48c9e7
commit 6c7c2e32df
2 changed files with 6 additions and 1 deletions

View File

@@ -154,6 +154,7 @@ osg::Group *SceneLoader::load(const std::string &filename, bool search)
osg::ref_ptr<osg::PositionAttitudeTransform> pat = pats[j];
if (!pat.valid()) {
pat = new osg::PositionAttitudeTransform;
pat->setName(i->name);
pats[j] = pat;
}
@@ -252,11 +253,14 @@ bool SceneLoader::parse_block(const std::string &name, const std::string &data)
}
Scene_object so;
std::ostringstream oss;
oss << filename << "." << layer;
so.name = oss.str();
so.layer_node = objnode->getChild(layer-1);
if (so.layer_node.valid()) {
scene_objects_.push_back(so);
}
}
}
}
if (name == "PivotPosition") {

View File

@@ -100,6 +100,7 @@ namespace lwosg
osg::Vec3 pivot;
osg::Vec3 pivot_rot;
Motion_envelope motion;
std::string name;
Scene_object(): parent(-1) {}
};