From c6d888531b8c9edf6922327c45fa9fc885bdce96 Mon Sep 17 00:00:00 2001 From: Robert Spencer Date: Sun, 25 Jun 2017 15:10:11 +0200 Subject: [PATCH 1/6] Fixes parameters to pyassimp.load Commit 704e57db4ee640262b8b20f4b687c15231d64354 changed the order of the parameters to `pyassimp.load`. The new order groups `filename` and `file_type` which is preferable, but the samples and other calls to `load` still point to the old order. This fixes that with named arguments where necessary. --- port/PyAssimp/scripts/3d_viewer.py | 2 +- port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py | 2 +- port/PyAssimp/scripts/sample.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/port/PyAssimp/scripts/3d_viewer.py b/port/PyAssimp/scripts/3d_viewer.py index 3a579eb61..9aae25efe 100755 --- a/port/PyAssimp/scripts/3d_viewer.py +++ b/port/PyAssimp/scripts/3d_viewer.py @@ -679,7 +679,7 @@ class PyAssimp3DViewer: logger.info("Loading model:" + path + "...") if postprocess: - self.scene = pyassimp.load(path, postprocess) + self.scene = pyassimp.load(path, processing=postprocess) else: self.scene = pyassimp.load(path) logger.info("Done.") diff --git a/port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py b/port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py index 48c157917..7f98b9004 100755 --- a/port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py +++ b/port/PyAssimp/scripts/fixed_pipeline_3d_viewer.py @@ -98,7 +98,7 @@ class GLRenderer(): logger.info("Loading model:" + path + "...") if postprocess: - self.scene = pyassimp.load(path, postprocess) + self.scene = pyassimp.load(path, processing=postprocess) else: self.scene = pyassimp.load(path) logger.info("Done.") diff --git a/port/PyAssimp/scripts/sample.py b/port/PyAssimp/scripts/sample.py index 5153a9bab..9012eb374 100755 --- a/port/PyAssimp/scripts/sample.py +++ b/port/PyAssimp/scripts/sample.py @@ -20,7 +20,7 @@ def recur_node(node,level = 0): def main(filename=None): - scene = pyassimp.load(filename, pyassimp.postprocess.aiProcess_Triangulate) + scene = pyassimp.load(filename, processing=pyassimp.postprocess.aiProcess_Triangulate) #the model we load print("MODEL:" + filename) From a408b922792739d552391d7197427396bc7b78c4 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 26 Jun 2017 22:01:15 +0200 Subject: [PATCH 2/6] closes https://github.com/assimp/assimp/issues/1319: fix build without 3DS. --- code/ASELoader.cpp | 4 ++++ code/ASELoader.h | 4 ++++ code/ASEParser.cpp | 3 +++ code/ASEParser.h | 4 ++++ code/CMakeLists.txt | 2 +- code/ImporterRegistry.cpp | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/code/ASELoader.cpp b/code/ASELoader.cpp index 2ea5f7b1c..16b3c4ad9 100644 --- a/code/ASELoader.cpp +++ b/code/ASELoader.cpp @@ -46,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER + // internal headers #include "ASELoader.h" #include "StringComparison.h" @@ -1320,4 +1322,6 @@ bool ASEImporter::GenerateNormals(ASE::Mesh& mesh) { return false; } +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER diff --git a/code/ASELoader.h b/code/ASELoader.h index d1a5769de..3c5048367 100644 --- a/code/ASELoader.h +++ b/code/ASELoader.h @@ -53,6 +53,7 @@ struct aiNode; namespace Assimp { +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // -------------------------------------------------------------------------------- /** Importer class for the 3DS ASE ASCII format. @@ -201,6 +202,9 @@ protected: bool noSkeletonMesh; }; +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + } // end of namespace Assimp + #endif // AI_3DSIMPORTER_H_INC diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index e3ec0fe34..7de80a2d8 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ASSIMP_BUILD_NO_ASE_IMPORTER +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER // internal headers #include "TextureTransform.h" @@ -2151,4 +2152,6 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut) iOut = strtoul10(filePtr,&filePtr); } +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! ASSIMP_BUILD_NO_BASE_IMPORTER diff --git a/code/ASEParser.h b/code/ASEParser.h index cdae4affe..db64f2a16 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -49,6 +49,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER + // for some helper routines like IsSpace() #include "ParsingUtils.h" #include "qnan.h" @@ -662,4 +664,6 @@ public: } // Namespace ASE } // Namespace ASSIMP +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER + #endif // !! include guard diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 82497467a..aa5dffcf3 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -844,7 +844,7 @@ SET( assimp_src ) ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) - +ADD_DEFINITIONS( -DASSIMP_BUILD_NO_3DS_IMPORTER) INCLUDE_DIRECTORIES( ${IRRXML_INCLUDE_DIR} ../contrib/openddlparser/include diff --git a/code/ImporterRegistry.cpp b/code/ImporterRegistry.cpp index 5d04b267e..afc308075 100644 --- a/code/ImporterRegistry.cpp +++ b/code/ImporterRegistry.cpp @@ -231,7 +231,9 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out) out.push_back( new MDLImporter()); #endif #if (!defined ASSIMP_BUILD_NO_ASE_IMPORTER) + #if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER) out.push_back( new ASEImporter()); +# endif #endif #if (!defined ASSIMP_BUILD_NO_HMP_IMPORTER) out.push_back( new HMPImporter()); From 27b7b44c9d9021563351aa4ac6d71e5116dfbb8f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 28 Jun 2017 20:11:13 +0200 Subject: [PATCH 3/6] fix unittests. --- code/CMakeLists.txt | 2 +- test/unit/ut3DSImportExport.cpp | 4 ++++ test/unit/utASEImportExport.cpp | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index aa5dffcf3..82497467a 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -844,7 +844,7 @@ SET( assimp_src ) ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD ) -ADD_DEFINITIONS( -DASSIMP_BUILD_NO_3DS_IMPORTER) + INCLUDE_DIRECTORIES( ${IRRXML_INCLUDE_DIR} ../contrib/openddlparser/include diff --git a/test/unit/ut3DSImportExport.cpp b/test/unit/ut3DSImportExport.cpp index 07e6fc0f1..1e9bfe0d0 100644 --- a/test/unit/ut3DSImportExport.cpp +++ b/test/unit/ut3DSImportExport.cpp @@ -53,7 +53,11 @@ public: virtual bool importerTest() { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/3DS/fels.3ds", 0 ); +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER return nullptr != scene; +#else + return nullptr == scene; +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER } }; diff --git a/test/unit/utASEImportExport.cpp b/test/unit/utASEImportExport.cpp index baf900067..841aff549 100644 --- a/test/unit/utASEImportExport.cpp +++ b/test/unit/utASEImportExport.cpp @@ -53,7 +53,11 @@ public: virtual bool importerTest() { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/ASE/ThreeCubesGreen.ASE", 0 ); +#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER return nullptr != scene; +#else + return nullptr == scene; +#endif // ASSIMP_BUILD_NO_3DS_IMPORTER } }; From f30fd58494ff0b23169acc2fb3bf01976b445f12 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 28 Jun 2017 22:08:20 +0200 Subject: [PATCH 4/6] fix review findings., --- CMakeLists.txt | 2 -- code/ASELoader.h | 3 --- 2 files changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3742eb01a..4660f8aa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,12 +78,10 @@ OPTION ( ASSIMP_COVERALLS "EaƄable this to measure test coverage." OFF ) - option ( SYSTEM_IRRXML "Use system installed Irrlicht/IrrXML library." OFF ) - OPTION ( BUILD_DOCS "Build documentation using Doxygen." OFF diff --git a/code/ASELoader.h b/code/ASELoader.h index 3c5048367..8a8d4faa4 100644 --- a/code/ASELoader.h +++ b/code/ASELoader.h @@ -64,9 +64,6 @@ public: ASEImporter(); ~ASEImporter(); - -public: - // ------------------------------------------------------------------- /** Returns whether the class can handle the format of the given file. * See BaseImporter::CanRead() for details. From ac37e4ddba0936f0d7288782910b7119898861ee Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 28 Jun 2017 22:13:49 +0200 Subject: [PATCH 5/6] closes https://github.com/assimp/assimp/issues/1320: check if all exporters are disabled. --- code/Exporter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/Exporter.cpp b/code/Exporter.cpp index bae4d7f80..f03702869 100644 --- a/code/Exporter.cpp +++ b/code/Exporter.cpp @@ -172,8 +172,10 @@ public: GetPostProcessingStepInstanceList(mPostProcessingSteps); // grab all built-in exporters - mExporters.resize(ASSIMP_NUM_EXPORTERS); - std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin()); + if ( 0 != ( ASSIMP_NUM_EXPORTERS ) ) { + mExporters.resize( ASSIMP_NUM_EXPORTERS ); + std::copy( gExporters, gExporters + ASSIMP_NUM_EXPORTERS, mExporters.begin() ); + } } ~ExporterPimpl() @@ -187,7 +189,6 @@ public: } public: - aiExportDataBlob* blob; std::shared_ptr< Assimp::IOSystem > mIOSystem; bool mIsDefaultIOHandler; @@ -408,6 +409,7 @@ aiReturn Exporter::Export( const aiScene* pScene, const char* pFormatId, const c pimpl->mError = std::string("Found no exporter to handle this file format: ") + pFormatId; ASSIMP_END_EXCEPTION_REGION(aiReturn); + return AI_FAILURE; } @@ -492,7 +494,6 @@ ExportProperties::ExportProperties(const ExportProperties &other) // empty } - // ------------------------------------------------------------------------------------------------ // Set a configuration property bool ExportProperties::SetPropertyInteger(const char* szName, int iValue) { From b38ba233f530fdb103d3ede3df5126121af78b10 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 1 Jul 2017 10:42:47 +0200 Subject: [PATCH 6/6] add missing coverity token. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a78e41bf..661de2279 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ sudo: required language: cpp before_install: - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq && sudo apt-get install cmake && sudo apt-get install cmake python3 && sudo apt-get install -qq freeglut3-dev libxmu-dev libxi-dev ; echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install cmake python3 homebrew/x11/freeglut; fi - echo -e "#ifndef A_R_H_INC\n#define A_R_H_INC\n#define GitVersion ${TRAVIS_JOB_ID}\n#define GitBranch \"${TRAVIS_BRANCH}\"\n#endif // A_R_H_INC" > revision.h # install latest LCOV (1.9 was failing) @@ -17,8 +17,7 @@ osx_image: xcode8.3 env: global: # COVERITY_SCAN_TOKEN - #- secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc=" - - secure: "ZgiIxmLeXn04lGPdP8eU3Q" + - secure: "lZ7pHQvl5dpZWzBQAaIMf0wqrvtcZ4wiZKeIZjf83TEsflW8+z0uTpIuN30ZV6Glth/Sq1OhLnTP5+N57fZU/1ebA5twHdvP4bS5CIUUg71/CXQZNl36xeaqvxsG/xRrdpKOsPdjAOsQ9KPTQulsX43XDLS7CasMiLvYOpqKcPc=" - PV=r8e PLATF=linux-x86_64 NDK_HOME=${TRAVIS_BUILD_DIR}/android-ndk-${PV} PATH=${PATH}:${NDK_HOME} matrix: - LINUX=1 TRAVIS_NO_EXPORT=YES ENABLE_COVERALLS=ON