even more efficient
parent
b957d44943
commit
13bba4fb4c
|
@ -442,15 +442,17 @@ namespace Assimp {
|
|||
void FBXConverter::GetUniqueName(const std::string &name, std::string &uniqueName)
|
||||
{
|
||||
uniqueName = name;
|
||||
int i = 0;
|
||||
while (mNodeNames.find(uniqueName) != mNodeNames.end())
|
||||
auto it_pair = mNodeNameInstances.insert({ name, 0 }); // duplicate node name instance count
|
||||
unsigned int& i = it_pair.first->second;
|
||||
auto uniqueIt_pair = mNodeNames.insert(uniqueName);
|
||||
while (!uniqueIt_pair.second)
|
||||
{
|
||||
i++;
|
||||
std::stringstream ext;
|
||||
ext << name << std::setfill('0') << std::setw(3) << i;
|
||||
uniqueName = ext.str();
|
||||
uniqueIt_pair = mNodeNames.insert(uniqueName);
|
||||
}
|
||||
mNodeNames.insert(uniqueName);
|
||||
}
|
||||
|
||||
const char* FBXConverter::NameTransformationComp(TransformationComp comp) {
|
||||
|
|
|
@ -461,6 +461,10 @@ private:
|
|||
using NodeAnimBitMap = std::map<std::string, unsigned int> ;
|
||||
NodeAnimBitMap node_anim_chain_bits;
|
||||
|
||||
// number of nodes with the same name
|
||||
using NodeAnimNameMap = std::unordered_map<std::string, unsigned int>;
|
||||
NodeAnimNameMap mNodeNameInstances;
|
||||
|
||||
using NodeNameCache = std::unordered_set<std::string>;
|
||||
NodeNameCache mNodeNames;
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ TEST_F(utFBXImporterExporter, importCubesComplexTransform) {
|
|||
ASSERT_STREQ(child1->mName.C_Str(), "Cube3");
|
||||
|
||||
auto parent = child1;
|
||||
constexpr size_t chain_length = 8u;
|
||||
const size_t chain_length = 8u;
|
||||
const char* chainStr[chain_length] = {
|
||||
"Cube1001_$AssimpFbx$_Translation",
|
||||
"Cube1001_$AssimpFbx$_RotationPivot",
|
||||
|
|
Loading…
Reference in New Issue