From 6ec25be0a6a21595e878701c776f0ea8c0d3ea8a Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 2 Oct 2017 09:41:01 +0200 Subject: [PATCH] OpenGEX: improve logging to be able to detect error-prone situations. --- code/OpenGEXImporter.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 7c4d0f9..d9c58e9 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -1182,8 +1182,16 @@ void OpenGEXImporter::resolveReferences() { const std::string name( currentRefInfo->m_Names[ i ] ); ReferenceMap::const_iterator it( m_material2refMap.find( name ) ); if ( m_material2refMap.end() != it ) { - unsigned int matIdx = static_cast< unsigned int >( m_material2refMap[ name ] ); - m_currentMesh->mMaterialIndex = matIdx; + if ( nullptr != m_currentMesh ) { + unsigned int matIdx = static_cast< unsigned int >( m_material2refMap[ name ] ); + if ( m_currentMesh->mMaterialIndex != 0 ) { + DefaultLogger::get()->warn( "Override of material reference in current mesh by material reference." ); + } + m_currentMesh->mMaterialIndex = matIdx; + } else { + DefaultLogger::get()->warn( "Cannot resolve material reference, because no current mesh is there." ); + + } } } } else { -- 2.7.4