diff --git a/CMakeLists.txt b/CMakeLists.txt index d25d1d897..087010b60 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/AMF/AMFImporter_Postprocess.cpp b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp index 98151d1c0..0236ab557 100644 --- a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp +++ b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp @@ -329,8 +329,8 @@ void AMFImporter::Postprocess_AddMetadata(const AMFMetaDataArray &metadataList, sceneNode.mMetaData = aiMetadata::Alloc(static_cast(metadataList.size())); size_t meta_idx(0); - for (const AMFMetadata &metadata : metadataList) { - sceneNode.mMetaData->Set(static_cast(meta_idx++), metadata.Type, aiString(metadata.Value)); + for (const AMFMetadata *metadata : metadataList) { + sceneNode.mMetaData->Set(static_cast(meta_idx++), metadata->Type, aiString(metadata->Value)); } } 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/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 565117ddb..9bc670cb2 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -1229,7 +1229,7 @@ unsigned int glTF2Exporter::ExportNode(const aiNode* n, Ref& parent) node->name = name; if (!n->mTransformation.IsIdentity()) { - if (mScene->mNumAnimations > 0) { + if (mScene->mNumAnimations > 0 || (mProperties && mProperties->HasPropertyBool("GLTF2_NODE_IN_TRS"))) { aiQuaternion quaternion; n->mTransformation.Decompose(*reinterpret_cast(&node->scale.value), quaternion, *reinterpret_cast(&node->translation.value)); diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 8bc43f015..7e521bf61 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/Common/Importer.cpp b/code/Common/Importer.cpp index 38eb63f40..ccd664d91 100644 --- a/code/Common/Importer.cpp +++ b/code/Common/Importer.cpp @@ -78,6 +78,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include #include #include diff --git a/code/Common/Importer.h b/code/Common/Importer.h index eb70bc38f..d07a67030 100644 --- a/code/Common/Importer.h +++ b/code/Common/Importer.h @@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef INCLUDED_AI_IMPORTER_H #define INCLUDED_AI_IMPORTER_H +#include #include #include #include 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/Importer.hpp b/include/assimp/Importer.hpp index 9078fbfe6..07ffe26f9 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -59,6 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Public ASSIMP data structures #include +#include + namespace Assimp { // ======================================================================= // Public interface to Assimp 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 6d41ee543..4d6733fdf 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)