From f8c512acd73abda82360102484f06dd2603bb278 Mon Sep 17 00:00:00 2001 From: Bart Sekura Date: Sat, 23 Jan 2021 09:52:46 +0900 Subject: [PATCH 1/7] changed morph anim error to warning when validating --- code/PostProcessing/ValidateDataStructure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index e7392d9e5..c39578d43 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -844,7 +844,7 @@ void ValidateDSProcess::Validate(const aiAnimation *pAnimation, Validate(&pMeshMorphAnim->mName); if (!pMeshMorphAnim->mNumKeys) { - ReportError("Empty mesh morph animation channel"); + ReportWarning("Empty mesh morph animation channel"); } // otherwise check whether one of the keys exceeds the total duration of the animation From 5f50e42535e6e8b10345ee8dd25f86b1875df94e Mon Sep 17 00:00:00 2001 From: Bart Sekura Date: Sat, 23 Jan 2021 09:56:35 +0900 Subject: [PATCH 2/7] added missing return --- code/PostProcessing/ValidateDataStructure.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index c39578d43..3e0224eac 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -845,6 +845,7 @@ void ValidateDSProcess::Validate(const aiAnimation *pAnimation, if (!pMeshMorphAnim->mNumKeys) { ReportWarning("Empty mesh morph animation channel"); + return; } // otherwise check whether one of the keys exceeds the total duration of the animation From 338abded1284b4390a14e179722fc89639fc72bf Mon Sep 17 00:00:00 2001 From: contriteobserver Date: Sat, 23 Jan 2021 02:20:58 -0800 Subject: [PATCH 3/7] ColladaLoader now assigns individual materials to submeshes as needed Optional assignment of individual materials to submeshes, addresses #3606 --- code/AssetLib/Collada/ColladaLoader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 99cb8c305..3bd2a7d02 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -557,7 +557,12 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser &pParser, const Colla faceStart += submesh.mNumFaces; // assign the material index - dstMesh->mMaterialIndex = matIdx; + std::map::const_iterator matIt = mMaterialIndexByName.find(submesh.mMaterial); + if (matIt != mMaterialIndexByName.end()) { + dstMesh->mMaterialIndex = matIt->second; + } else { + dstMesh->mMaterialIndex = matIdx; + } if (dstMesh->mName.length == 0) { dstMesh->mName = mid.mMeshOrController; } From 69fc809307878601557053381617b6aad942783c Mon Sep 17 00:00:00 2001 From: contriteobserver Date: Tue, 26 Jan 2021 01:01:59 -0800 Subject: [PATCH 4/7] size_t is not the same as unsigned int on some systems --- code/AssetLib/Collada/ColladaLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 3bd2a7d02..297616b4e 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -559,7 +559,7 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser &pParser, const Colla // assign the material index std::map::const_iterator matIt = mMaterialIndexByName.find(submesh.mMaterial); if (matIt != mMaterialIndexByName.end()) { - dstMesh->mMaterialIndex = matIt->second; + dstMesh->mMaterialIndex = static_cast(matIt->second); } else { dstMesh->mMaterialIndex = matIdx; } From d7bf5132500d7f568bb9c0ce31f83e86548cd230 Mon Sep 17 00:00:00 2001 From: contriteobserver Date: Tue, 26 Jan 2021 01:36:12 -0800 Subject: [PATCH 5/7] renaming iterator to avoid any possibility of scop collisions --- code/AssetLib/Collada/ColladaLoader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 297616b4e..96599f22f 100644 --- a/code/AssetLib/Collada/ColladaLoader.cpp +++ b/code/AssetLib/Collada/ColladaLoader.cpp @@ -557,9 +557,9 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser &pParser, const Colla faceStart += submesh.mNumFaces; // assign the material index - std::map::const_iterator matIt = mMaterialIndexByName.find(submesh.mMaterial); - if (matIt != mMaterialIndexByName.end()) { - dstMesh->mMaterialIndex = static_cast(matIt->second); + std::map::const_iterator subMatIt = mMaterialIndexByName.find(submesh.mMaterial); + if (subMatIt != mMaterialIndexByName.end()) { + dstMesh->mMaterialIndex = static_cast(subMatIt->second); } else { dstMesh->mMaterialIndex = matIdx; } From 79a442f95ddc1be4828bd6c34f63d6369418e883 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 Jan 2021 20:25:02 +0100 Subject: [PATCH 6/7] Fixes a mem leak in aiMetadata::Set --- include/assimp/metadata.h | 4 ++++ test/unit/utMetadata.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index 52121fbf1..e44b97bf3 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -350,6 +350,10 @@ struct aiMetadata { } else if (nullptr != mValues[index].mData && AI_AIMETADATA == mValues[index].mType) { *static_cast(mValues[index].mData) = value; } else { + if (nullptr != mValues[index].mData) { + delete mValues[index].mData; + mValues[index].mData = nullptr; + } mValues[index].mData = new T(value); } diff --git a/test/unit/utMetadata.cpp b/test/unit/utMetadata.cpp index 81ab61435..d4b0b158f 100644 --- a/test/unit/utMetadata.cpp +++ b/test/unit/utMetadata.cpp @@ -51,11 +51,11 @@ class utMetadata: public ::testing::Test { protected: aiMetadata *m_data; - virtual void SetUp() { + void SetUp() override { m_data = nullptr; } - virtual void TearDown() { + void TearDown() override { aiMetadata::Dealloc( m_data ); } @@ -261,3 +261,12 @@ TEST_F( utMetadata, copy_test ) { EXPECT_EQ( metaVal, v ); } } + +TEST_F( utMetadata, set_test ) { + aiMetadata v; + const std::string key_bool = "test_bool"; + v.Set(1, key_bool, true); + v.Set(1, key_bool, true); + v.Set(1, key_bool, true); + v.Set(1, key_bool, true); +} From 79eb9ecc86dc88e457d20cebb05636fec66f8b3c Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 29 Jan 2021 21:05:46 +0100 Subject: [PATCH 7/7] Update all minimum cmake req to 3.10 --- CMakeLists.txt | 2 +- code/CMakeLists.txt | 2 +- contrib/gtest/CMakeLists.txt | 2 +- contrib/openddlparser/CMakeLists.txt | 2 +- contrib/pugixml/CMakeLists.txt | 2 +- contrib/zip/CMakeLists.txt | 2 +- contrib/zip/test/CMakeLists.txt | 2 +- port/AndroidJNI/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- tools/assimp_cmd/CMakeLists.txt | 2 +- tools/assimp_view/CMakeLists.txt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f8f96948..1a02a1bdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW) SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW) SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW) -CMAKE_MINIMUM_REQUIRED( VERSION 3.0 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.10 ) # Toggles the use of the hunter package manager option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 74ae837ef..8381b0247 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -43,7 +43,7 @@ # 3) Add libassimp using the file lists (eliminates duplication of file names between # source groups and library command) # -cmake_minimum_required( VERSION 3.0 ) +cmake_minimum_required( VERSION 3.10 ) SET( HEADER_PATH ../include/assimp ) if(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM) diff --git a/contrib/gtest/CMakeLists.txt b/contrib/gtest/CMakeLists.txt index 621d0f042..1d8362797 100644 --- a/contrib/gtest/CMakeLists.txt +++ b/contrib/gtest/CMakeLists.txt @@ -45,7 +45,7 @@ endif() # ${gtest_BINARY_DIR}. # Language "C" is required for find_package(Threads). project(gtest CXX C) -cmake_minimum_required(VERSION 2.6.2) +cmake_minimum_required(VERSION 3.10) if (COMMAND set_up_hermetic_build) set_up_hermetic_build() diff --git a/contrib/openddlparser/CMakeLists.txt b/contrib/openddlparser/CMakeLists.txt index 6a38acf5f..407f0847e 100644 --- a/contrib/openddlparser/CMakeLists.txt +++ b/contrib/openddlparser/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED( VERSION 2.6 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.10 ) PROJECT( OpenDDL-Parser ) SET ( OPENDDL_PARSER_VERSION_MAJOR 0 ) SET ( OPENDDL_PARSER_VERSION_MINOR 1 ) diff --git a/contrib/pugixml/CMakeLists.txt b/contrib/pugixml/CMakeLists.txt index 94541f6da..af6b577e6 100644 --- a/contrib/pugixml/CMakeLists.txt +++ b/contrib/pugixml/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10) project(pugixml) diff --git a/contrib/zip/CMakeLists.txt b/contrib/zip/CMakeLists.txt index f194649ed..cdfa94b3b 100644 --- a/contrib/zip/CMakeLists.txt +++ b/contrib/zip/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.10) project(zip LANGUAGES C diff --git a/contrib/zip/test/CMakeLists.txt b/contrib/zip/test/CMakeLists.txt index 122411585..a7c3650f7 100644 --- a/contrib/zip/test/CMakeLists.txt +++ b/contrib/zip/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) # test set(test_out test.out) diff --git a/port/AndroidJNI/CMakeLists.txt b/port/AndroidJNI/CMakeLists.txt index ddc718850..8f034db8b 100644 --- a/port/AndroidJNI/CMakeLists.txt +++ b/port/AndroidJNI/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) include_directories(./) include_directories(./../../) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9005a5ec4..15eeced5f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,7 +36,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #---------------------------------------------------------------------- -cmake_minimum_required( VERSION 3.0 ) +cmake_minimum_required( VERSION 3.10 ) INCLUDE_DIRECTORIES( ${Assimp_SOURCE_DIR}/test/unit diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt index a0eb98a89..afbb13f77 100644 --- a/tools/assimp_cmd/CMakeLists.txt +++ b/tools/assimp_cmd/CMakeLists.txt @@ -37,7 +37,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #---------------------------------------------------------------------- -cmake_minimum_required( VERSION 3.0 ) +cmake_minimum_required( VERSION 3.10 ) INCLUDE_DIRECTORIES( ${Assimp_SOURCE_DIR}/include diff --git a/tools/assimp_view/CMakeLists.txt b/tools/assimp_view/CMakeLists.txt index 222722388..abb901214 100644 --- a/tools/assimp_view/CMakeLists.txt +++ b/tools/assimp_view/CMakeLists.txt @@ -37,7 +37,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #---------------------------------------------------------------------- -cmake_minimum_required( VERSION 3.0 ) +cmake_minimum_required( VERSION 3.10 ) FIND_PACKAGE(DirectX REQUIRED)