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/AssetLib/Collada/ColladaLoader.cpp b/code/AssetLib/Collada/ColladaLoader.cpp index 99cb8c305..96599f22f 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 subMatIt = mMaterialIndexByName.find(submesh.mMaterial); + if (subMatIt != mMaterialIndexByName.end()) { + dstMesh->mMaterialIndex = static_cast(subMatIt->second); + } else { + dstMesh->mMaterialIndex = matIdx; + } if (dstMesh->mName.length == 0) { dstMesh->mName = mid.mMeshOrController; } 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/code/PostProcessing/ValidateDataStructure.cpp b/code/PostProcessing/ValidateDataStructure.cpp index e7392d9e5..3e0224eac 100644 --- a/code/PostProcessing/ValidateDataStructure.cpp +++ b/code/PostProcessing/ValidateDataStructure.cpp @@ -844,7 +844,8 @@ void ValidateDSProcess::Validate(const aiAnimation *pAnimation, Validate(&pMeshMorphAnim->mName); if (!pMeshMorphAnim->mNumKeys) { - ReportError("Empty mesh morph animation channel"); + ReportWarning("Empty mesh morph animation channel"); + return; } // otherwise check whether one of the keys exceeds the total duration of the animation 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/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/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/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); +} 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)