ソースを参照

FBXImporter: Fix GetUniqueName to return names properly

Kenneth Perry (thothonegan) 7 年 前
コミット
7967f0a33f
2 ファイル変更4 行追加3 行削除
  1. 3 2
      code/FBXConverter.cpp
  2. 1 1
      code/FBXConverter.h

+ 3 - 2
code/FBXConverter.cpp

@@ -407,14 +407,15 @@ static bool HasName( NodeNameCache &cache, const std::string &name ) {
     return it != cache.end();
 
 }
-void Converter::GetUniqueName( const std::string &name, std::string uniqueName ) {
+void Converter::GetUniqueName( const std::string &name, std::string& uniqueName ) {
     if ( !HasName( mNodeNames, name ) ) {
         uniqueName = name;
+        mNodeNames.push_back( uniqueName );
         return;
     }
 
     int i( 0 );
-    std::string newName;
+    std::string newName (name);
     while ( HasName( mNodeNames, newName ) ) {
         ++i;
         newName.clear();

+ 1 - 1
code/FBXConverter.h

@@ -131,7 +131,7 @@ private:
     void ConvertCamera( const Camera& cam, const std::string &orig_name );
 
     // ------------------------------------------------------------------------------------------------
-    void GetUniqueName( const std::string &name, std::string uniqueName );
+    void GetUniqueName( const std::string &name, std::string& uniqueName );
 
     // ------------------------------------------------------------------------------------------------
     // this returns unified names usable within assimp identifiers (i.e. no space characters -