From 5289954e27675220b89ee2f725fd478170413e11 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 6 May 2017 20:57:17 +0200 Subject: [PATCH] Fix review findings. --- CMakeLists.txt | 1 - code/IFCMaterial.cpp | 34 ++++++++++++++++------------------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e185b8b06..5c1804159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,7 +239,6 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C FIND_PACKAGE( DirectX ) - IF( BUILD_DOCS ) add_subdirectory(doc) ENDIF( BUILD_DOCS ) diff --git a/code/IFCMaterial.cpp b/code/IFCMaterial.cpp index ae2fa3619..0f270ec0b 100644 --- a/code/IFCMaterial.cpp +++ b/code/IFCMaterial.cpp @@ -42,19 +42,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @brief Implementation of conversion routines to convert IFC materials to aiMaterial */ - - #ifndef ASSIMP_BUILD_NO_IFC_IMPORTER + #include "IFCUtil.h" #include #include namespace Assimp { - namespace IFC { +namespace IFC { // ------------------------------------------------------------------------------------------------ -int ConvertShadingMode(const std::string& name) -{ +static int ConvertShadingMode(const std::string& name) { if (name == "BLINN") { return aiShadingMode_Blinn; } @@ -69,8 +67,7 @@ int ConvertShadingMode(const std::string& name) } // ------------------------------------------------------------------------------------------------ -void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv) -{ +static void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionData& conv) { aiString name; name.Set((surf->Name? surf->Name.Get() : "IfcSurfaceStyle_Unnamed")); mat->AddProperty(&name,AI_MATKEY_NAME); @@ -134,8 +131,7 @@ void FillMaterial(aiMaterial* mat,const IFC::IfcSurfaceStyle* surf,ConversionDat } // ------------------------------------------------------------------------------------------------ -unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) -{ +unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat) { STEP::DB::RefMapRange range = conv.db.GetRefs().equal_range(id); for(;range.first != range.second; ++range.first) { if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr()) { @@ -162,31 +158,33 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat unsigned int matindex = static_cast(conv.materials.size() - 1); conv.cached_materials[surf] = matindex; return matindex; + } + } } } } - } - } // no local material defined. If there's global one, use that instead - if( prevMatId != std::numeric_limits::max() ) + if ( prevMatId != std::numeric_limits::max() ) { return prevMatId; + } // we're still here - create an default material if required, or simply fail otherwise - if( !forceDefaultMat ) + if ( !forceDefaultMat ) { return std::numeric_limits::max(); + } aiString name; name.Set(""); // ConvertColorToString( color, name); // look if there's already a default material with this base color - for( size_t a = 0; a < conv.materials.size(); ++a ) - { + for( size_t a = 0; a < conv.materials.size(); ++a ) { aiString mname; conv.materials[a]->Get(AI_MATKEY_NAME, mname); - if( name == mname ) - return (unsigned int)a; + if ( name == mname ) { + return ( unsigned int )a; + } } // we're here, yet - no default material with suitable color available. Generate one @@ -203,4 +201,4 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat } // ! IFC } // ! Assimp -#endif +#endif // ASSIMP_BUILD_NO_IFC_IMPORTER