From Cedric Pinson, "I fixed a little issue with the lightwave scene loader. On the version 5 there are id on the command LoadObjectLayer in the scene file and of this version the current code use this field as a part of the filename, and it fails because the file is not found.

I just added a field version_ to read it at the beginning and added extra code to check it and read the extra field if needed and read the good filename"
This commit is contained in:
Robert Osfield
2013-06-24 12:51:02 +00:00
parent 84d7d9a056
commit ba9ccd91a1
2 changed files with 17 additions and 0 deletions

View File

@@ -97,6 +97,17 @@ osg::Group *SceneLoader::load(const std::string &filename, const osgDB::ReaderWr
clear();
std::string field;
std::getline(ifs, field);
if (field.substr(0,4) != "LWSC") {
osg::notify(osg::WARN) << filename << " is not a LWSC file, " << field << std::endl;
return 0;
}
std::getline(ifs, field);
version_ = atoi(field.c_str());
std::string identifier;
while (ifs >> identifier) {
if (identifier == "{") {
@@ -220,6 +231,11 @@ bool SceneLoader::parse_block(const std::string &name, const std::string &data)
if (name == "LoadObjectLayer") {
unsigned layer;
iss >> layer;
std::string id;
if (version_ >= 5) {
iss >> id;
}
std::ws(iss);
std::string filename;
std::getline(iss, filename);

View File

@@ -126,6 +126,7 @@ namespace lwosg
bool capture_cam_motion_;
Options options_;
unsigned int version_;
};
// INLINE METHODS