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:
@@ -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") {
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace lwosg
|
||||
osg::Vec3 pivot;
|
||||
osg::Vec3 pivot_rot;
|
||||
Motion_envelope motion;
|
||||
std::string name;
|
||||
|
||||
Scene_object(): parent(-1) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user