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:
@@ -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);
|
||||
|
||||
@@ -126,6 +126,7 @@ namespace lwosg
|
||||
bool capture_cam_motion_;
|
||||
|
||||
Options options_;
|
||||
unsigned int version_;
|
||||
};
|
||||
|
||||
// INLINE METHODS
|
||||
|
||||
Reference in New Issue
Block a user