From 4a4f3fddc7b1b6619e870502f3cd255148900b94 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 5 Nov 2017 22:52:07 +0100 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/213: log an error instead of letting the fbx-importer crash. --- code/FBXConverter.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index a1121cc40..a1e3ae07c 100644 --- a/code/FBXConverter.cpp +++ b/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() );