Disallow repeated nameless assets that use the same file, except for URDFs.
PiperOrigin-RevId: 675114055 Change-Id: I142811ac2d8ef9e12bb8a06d5f3a2fdac02946da
This commit is contained in:
committed by
Copybara-Service
parent
60a1921b34
commit
015bdeb756
@@ -1431,7 +1431,6 @@ void mjCModel::IndexAssets(bool discard) {
|
||||
template <typename T>
|
||||
void mjCModel::SetDefaultNames(std::vector<T*>& assets) {
|
||||
string stripped;
|
||||
std::map<string, std::vector<int>> names;
|
||||
|
||||
// use filename if name is missing
|
||||
for (int i=0; i<assets.size(); i++) {
|
||||
@@ -1439,16 +1438,6 @@ void mjCModel::SetDefaultNames(std::vector<T*>& assets) {
|
||||
if (assets[i]->name.empty()) {
|
||||
stripped = mjuu_strippath(assets[i]->File());
|
||||
assets[i]->name = mjuu_stripext(stripped);
|
||||
names[assets[i]->name].push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
// add suffix if duplicates
|
||||
for (auto const& [name, indices] : names) {
|
||||
if (indices.size() > 1) {
|
||||
for (int i=0; i<indices.size(); i++) {
|
||||
assets[indices[i]]->name += "_" + std::to_string(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user