ソースを参照

closes https://github.com/assimp/assimp/issues/213: log an error instead of letting the fbx-importer crash.

Kim Kulling 7 年 前
コミット
4a4f3fddc7
1 ファイル変更10 行追加4 行削除
  1. 10 4
      code/FBXConverter.cpp

+ 10 - 4
code/FBXConverter.cpp

@@ -645,7 +645,6 @@ void Converter::ConvertCameras( const Model& model )
     }
 }
 
-
 void Converter::ConvertLight( const Model& model, const Light& light )
 {
     lights.push_back( new aiLight() );
@@ -783,7 +782,6 @@ const char* Converter::NameTransformationComp( TransformationComp comp )
     return NULL;
 }
 
-
 const char* Converter::NameTransformationCompProperty( TransformationComp comp )
 {
     switch ( comp )
@@ -2239,9 +2237,17 @@ void Converter::ConvertAnimations()
     }
 }
 
+void Converter::RenameNode( const std::string& fixed_name, const std::string& new_name ) {
+    if ( node_names.find( fixed_name ) == node_names.end() ) {
+        FBXImporter::LogError( "Cannot rename node " + fixed_name + ", not existing.");
+        return;
+    }
+
+    if ( node_names.find( new_name ) != node_names.end() ) {
+        FBXImporter::LogError( "Cannot rename node " + fixed_name + " to " + new_name +", name already existing." );
+        return;
+    }
 
-void Converter::RenameNode( const std::string& fixed_name, const std::string& new_name )
-{
     ai_assert( node_names.find( fixed_name ) != node_names.end() );
     ai_assert( node_names.find( new_name ) == node_names.end() );