Fix sub object id are the same bug

This commit is contained in:
Fan Zhang 2017-08-23 11:52:01 -07:00
parent cd70826afe
commit 087c1c34c3

View File

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