Merge pull request #186 from google/fix_sub_obj_bug

Fix sub object id bug
This commit is contained in:
FanZhang 2017-08-23 11:54:34 -07:00 committed by GitHub
commit b8f8aea97e

View File

@ -484,12 +484,12 @@ bool ObjDecoder::ParseObject(bool *error) {
if (!parser::ParseString(buffer(), &obj_name)) if (!parser::ParseString(buffer(), &obj_name))
return false; return false;
auto it = obj_name_to_id_.find(obj_name); auto it = obj_name_to_id_.find(obj_name);
if (it != obj_name_to_id_.end()) { if (it == obj_name_to_id_.end()) {
// TODO(zhafang): An object name can appear multiple places in an .obj? obj_name_to_id_[obj_name] = num_sub_objects_;
return false; num_sub_objects_++;
} else {
num_sub_objects_ = it->second;
} }
obj_name_to_id_[obj_name] = num_sub_objects_;
num_sub_objects_++;
return true; return true;
} }