FBX: Fix for loading taking a very long time on models with many duplicate names (issue_2390)

This commit is contained in:
Matias
2019-03-27 11:20:16 +01:00
parent a43ac5b3fd
commit ca08c4a209
2 changed files with 10 additions and 7 deletions

View File

@@ -410,16 +410,17 @@ namespace Assimp {
void FBXConverter::GetUniqueName(const std::string &name, std::string &uniqueName)
{
int i = 0;
uniqueName = name;
while (mNodeNames.find(uniqueName) != mNodeNames.end())
int i = 0;
auto it = mNodeNameInstances.find(uniqueName);
if (it != mNodeNameInstances.end())
{
++i;
i = it->second + 1;
std::stringstream ext;
ext << name << std::setfill('0') << std::setw(3) << i;
uniqueName = ext.str();
}
mNodeNames.insert(uniqueName);
mNodeNameInstances[name] = i;
}