浏览代码

Merge branch 'master' into ColladaSubmeshFix

Kim Kulling 4 年之前
父节点
当前提交
f2543ee608

+ 1 - 1
.github/FUNDING.yml

@@ -1,2 +1,2 @@
 patreon: assimp
-custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4
+open_collective: assimp

+ 1 - 1
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)

+ 0 - 6
Readme.md

@@ -105,12 +105,6 @@ Become a financial contributor and help us sustain our community. [[Contribute](
 Monthly donations via Patreon:
 <br>[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/assimp)
 
-<br>
-
-One-off donations via PayPal:
-<br>[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JRJVPXC4QJM4)
-
-<br>
 
 #### Organizations
 

+ 0 - 81
appveyor.yml

@@ -1,81 +0,0 @@
-# AppVeyor file
-# http://www.appveyor.com/docs/appveyor-yml
-
-# clone directory
-clone_folder: c:\projects\assimp
-
-clone_depth: 1
-
-# branches to build
-branches:
-  # whitelist
-  only:
-    - master
-
-matrix:
-  fast_finish: true
-    
-image:
-  - Visual Studio 2013
-  #- Visual Studio 2015
-  #- Visual Studio 2017
-  - Visual Studio 2019
-  #- MinGW  
-    
-platform:
-  - Win32
-  - x64
-  
-configuration: Release
-
-install:
-  - set PATH=C:\Ruby24-x64\bin;%PATH%
-  - set CMAKE_DEFINES -DASSIMP_WERROR=ON
-  - if [%COMPILER%]==[MinGW] set PATH=C:\MinGW\bin;%PATH%
-  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" set CMAKE_GENERATOR_NAME=Visual Studio 12 2013
-  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
-  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
-  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set CMAKE_GENERATOR_NAME=Visual Studio 16 2019
-  - cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" -A %platform% .
-  # Rename sh.exe as sh.exe in PATH interferes with MinGW  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
-
-  - rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
-  - set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
-  - ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
-  - ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
-  
-cache:
-  - code\assimp.dir\%CONFIGURATION%
-  - contrib\zlib\zlibstatic.dir\%CONFIGURATION%
-  - contrib\zlib\zlib.dir\%CONFIGURATION%
-  - tools\assimp_cmd\assimp_cmd.dir\%CONFIGURATION%
-  - tools\assimp_view\assimp_viewer.dir\%CONFIGURATION%
-  - test\unit.dir\%CONFIGURATION%
-  - bin\.mtime_cache
-  
-before_build:
-  - echo NUMBER_OF_PROCESSORS=%NUMBER_OF_PROCESSORS%
-  - ruby scripts\AppVeyor\mtime_cache -g scripts\AppVeyor\cacheglobs.txt -c bin\.mtime_cache\cache.json
-  
-build_script:
-  cmake --build . --config Release -- /maxcpucount:2
-  
-after_build:
-  - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" (
-        if "%platform%"=="x64" (
-            iscc packaging\windows-innosetup\script_x64.iss
-        ) else (
-            iscc packaging\windows-innosetup\script_x86.iss
-        )
-    )
-  - 7z a assimp.7z bin\%CONFIGURATION%\* lib\%CONFIGURATION%\*
-
-test_script:
-  - cmd: bin\%CONFIGURATION%\unit.exe --gtest_output=xml:testout.xml
-
-on_finish:
-  - ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\testout.xml))
-  
-artifacts:
-  - path: assimp.7z
-    name: assimp_lib

+ 2 - 2
code/AssetLib/AMF/AMFImporter_Postprocess.cpp

@@ -329,8 +329,8 @@ void AMFImporter::Postprocess_AddMetadata(const AMFMetaDataArray &metadataList,
     sceneNode.mMetaData = aiMetadata::Alloc(static_cast<unsigned int>(metadataList.size()));
     size_t meta_idx(0);
 
-    for (const AMFMetadata &metadata : metadataList) {
-        sceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx++), metadata.Type, aiString(metadata.Value));
+    for (const AMFMetadata *metadata : metadataList) {
+        sceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx++), metadata->Type, aiString(metadata->Value));
     }
 }
 

+ 52 - 86
code/AssetLib/FBX/FBXMaterial.cpp

@@ -54,18 +54,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/ByteSwapper.h>
 #include <assimp/ParsingUtils.h>
 
-#include <algorithm> // std::transform
 #include "FBXUtil.h"
 
 namespace Assimp {
 namespace FBX {
 
-    using namespace Util;
+using namespace Util;
 
 // ------------------------------------------------------------------------------------------------
-Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-{
+Material::Material(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+        Object(id,element,name) {
     const Scope& sc = GetRequiredScope(element);
 
     const Element* const ShadingModel = sc["ShadingModel"];
@@ -77,23 +75,21 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
 
     if(ShadingModel) {
         shading = ParseTokenAsString(GetRequiredToken(*ShadingModel,0));
-    }
-    else {
+    } else {
         DOMWarning("shading mode not specified, assuming phong",&element);
         shading = "phong";
     }
 
-    std::string templateName;
-
     // lower-case shading because Blender (for example) writes "Phong"
-    std::transform(shading.data(), shading.data() + shading.size(), std::addressof(shading[0]), Assimp::ToLower<char>);
+    for (size_t i = 0; i < shading.length(); ++i) {
+        shading[i] = static_cast<char>(tolower(shading[i]));
+    }
+    std::string templateName;
     if(shading == "phong") {
         templateName = "Material.FbxSurfacePhong";
-    }
-    else if(shading == "lambert") {
+    } else if(shading == "lambert") {
         templateName = "Material.FbxSurfaceLambert";
-    }
-    else {
+    } else {
         DOMWarning("shading mode not recognized: " + shading,&element);
     }
 
@@ -102,20 +98,19 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
     // resolve texture links
     const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
     for(const Connection* con : conns) {
-
         // texture link to properties, not objects
-        if (!con->PropertyName().length()) {
+        if ( 0 == con->PropertyName().length()) {
             continue;
         }
 
         const Object* const ob = con->SourceObject();
-        if(!ob) {
+        if(nullptr == ob) {
             DOMWarning("failed to read source object for texture link, ignoring",&element);
             continue;
         }
 
         const Texture* const tex = dynamic_cast<const Texture*>(ob);
-        if(!tex) {
+        if(nullptr == tex) {
             const LayeredTexture* const layeredTexture = dynamic_cast<const LayeredTexture*>(ob);
             if(!layeredTexture) {
                 DOMWarning("source object for texture link is not a texture or layered texture, ignoring",&element);
@@ -128,9 +123,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
 
             layeredTextures[prop] = layeredTexture;
             ((LayeredTexture*)layeredTexture)->fillTexture(doc);
-        }
-        else
-        {
+        } else {
             const std::string& prop = con->PropertyName();
             if (textures.find(prop) != textures.end()) {
                 DOMWarning("duplicate texture link: " + prop,&element);
@@ -138,23 +131,20 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
 
             textures[prop] = tex;
         }
-
     }
 }
 
 
 // ------------------------------------------------------------------------------------------------
-Material::~Material()
-{
+Material::~Material() {
+    // empty
 }
 
-
 // ------------------------------------------------------------------------------------------------
-Texture::Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-, uvScaling(1.0f,1.0f)
-, media(0)
-{
+Texture::Texture(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+        Object(id,element,name), 
+        uvScaling(1.0f,1.0f), 
+        media(0) {
     const Scope& sc = GetRequiredScope(element);
 
     const Element* const Type = sc["Type"];
@@ -194,8 +184,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
         crop[1] = ParseTokenAsInt(GetRequiredToken(*Cropping,1));
         crop[2] = ParseTokenAsInt(GetRequiredToken(*Cropping,2));
         crop[3] = ParseTokenAsInt(GetRequiredToken(*Cropping,3));
-    }
-    else {
+    } else {
         // vc8 doesn't support the crop() syntax in initialization lists
         // (and vc9 WARNS about the new (i.e. compliant) behaviour).
         crop[0] = crop[1] = crop[2] = crop[3] = 0;
@@ -226,7 +215,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
         const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
         for(const Connection* con : conns) {
             const Object* const ob = con->SourceObject();
-            if(!ob) {
+            if (nullptr == ob) {
                 DOMWarning("failed to read source object for texture link, ignoring",&element);
                 continue;
             }
@@ -240,46 +229,38 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
 }
 
 
-Texture::~Texture()
-{
-
+Texture::~Texture() {
+    // empty
 }
 
-LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name)
-: Object(id,element,name)
-,blendMode(BlendMode_Modulate)
-,alpha(1)
-{
+LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name) :
+        Object(id,element,name),
+        blendMode(BlendMode_Modulate),
+        alpha(1) {
     const Scope& sc = GetRequiredScope(element);
 
     const Element* const BlendModes = sc["BlendModes"];
     const Element* const Alphas = sc["Alphas"];
 
-
-    if(BlendModes!=0)
-    {
+    if (nullptr != BlendModes) {
         blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0));
     }
-    if(Alphas!=0)
-    {
+    if (nullptr != Alphas) {
         alpha = ParseTokenAsFloat(GetRequiredToken(*Alphas,0));
     }
 }
 
-LayeredTexture::~LayeredTexture()
-{
-    
+LayeredTexture::~LayeredTexture() {
+    // empty
 }
 
-void LayeredTexture::fillTexture(const Document& doc)
-{
+void LayeredTexture::fillTexture(const Document& doc) {
     const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
-    for(size_t i = 0; i < conns.size();++i)
-    {
+    for(size_t i = 0; i < conns.size();++i) {
         const Connection* con = conns.at(i);
 
         const Object* const ob = con->SourceObject();
-        if(!ob) {
+        if (nullptr == ob) {
             DOMWarning("failed to read source object for texture link, ignoring",&element);
             continue;
         }
@@ -290,13 +271,11 @@ void LayeredTexture::fillTexture(const Document& doc)
     }
 }
 
-
 // ------------------------------------------------------------------------------------------------
-Video::Video(uint64_t id, const Element& element, const Document& doc, const std::string& name)
-: Object(id,element,name)
-, contentLength(0)
-, content(0)
-{
+Video::Video(uint64_t id, const Element& element, const Document& doc, const std::string& name) :
+        Object(id,element,name), 
+        contentLength(0), 
+        content(0) {
     const Scope& sc = GetRequiredScope(element);
 
     const Element* const Type = sc["Type"];
@@ -324,52 +303,43 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
             if (!token.IsBinary()) {
                 if (*data != '"') {
                     DOMError("embedded content is not surrounded by quotation marks", &element);
-                }
-                else {
+                } else {
                     size_t targetLength = 0;
                     auto numTokens = Content->Tokens().size();
                     // First time compute size (it could be large like 64Gb and it is good to allocate it once)
-                    for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx)
-                    {
+                    for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx) {
                         const Token& dataToken = GetRequiredToken(*Content, tokenIdx);
                         size_t tokenLength = dataToken.end() - dataToken.begin() - 2; // ignore double quotes
                         const char* base64data = dataToken.begin() + 1;
                         const size_t outLength = Util::ComputeDecodedSizeBase64(base64data, tokenLength);
-                        if (outLength == 0)
-                        {
+                        if (outLength == 0) {
                             DOMError("Corrupted embedded content found", &element);
                         }
                         targetLength += outLength;
                     }
-                    if (targetLength == 0)
-                    {
+                    if (targetLength == 0) {
                         DOMError("Corrupted embedded content found", &element);
                     }
                     content = new uint8_t[targetLength];
                     contentLength = static_cast<uint64_t>(targetLength);
                     size_t dst_offset = 0;
-                    for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx)
-                    {
+                    for (uint32_t tokenIdx = 0; tokenIdx < numTokens; ++tokenIdx) {
                         const Token& dataToken = GetRequiredToken(*Content, tokenIdx);
                         size_t tokenLength = dataToken.end() - dataToken.begin() - 2; // ignore double quotes
                         const char* base64data = dataToken.begin() + 1;
                         dst_offset += Util::DecodeBase64(base64data, tokenLength, content + dst_offset, targetLength - dst_offset);
                     }
-                    if (targetLength != dst_offset)
-                    {
+                    if (targetLength != dst_offset) {
                         delete[] content;
                         contentLength = 0;
                         DOMError("Corrupted embedded content found", &element);
                     }
                 }
-            }
-            else if (static_cast<size_t>(token.end() - data) < 5) {
+            } else if (static_cast<size_t>(token.end() - data) < 5) {
                 DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);
-            }
-            else if (*data != 'R') {
+            } else if (*data != 'R') {
                 DOMWarning("video content is not raw binary data, ignoring", &element);
-            }
-            else {
+            } else {
                 // read number of elements
                 uint32_t len = 0;
                 ::memcpy(&len, data + 1, sizeof(len));
@@ -380,8 +350,7 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
                 content = new uint8_t[len];
                 ::memcpy(content, data + 5, len);
             }
-        } catch (const runtime_error& runtimeError)
-        {
+        } catch (const runtime_error& runtimeError) {
             //we don't need the content data for contents that has already been loaded
             ASSIMP_LOG_VERBOSE_DEBUG_F("Caught exception in FBXMaterial (likely because content was already loaded): ",
                     runtimeError.what());
@@ -392,14 +361,11 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
 }
 
 
-Video::~Video()
-{
-    if(content) {
-        delete[] content;
-    }
+Video::~Video() {
+    delete[] content;
 }
 
 } //!FBX
 } //!Assimp
 
-#endif
+#endif // ASSIMP_BUILD_NO_FBX_IMPORTER

+ 1 - 1
code/AssetLib/glTF2/glTF2Exporter.cpp

@@ -1229,7 +1229,7 @@ unsigned int glTF2Exporter::ExportNode(const aiNode* n, Ref<Node>& 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<aiVector3D *>(&node->scale.value), quaternion, *reinterpret_cast<aiVector3D *>(&node->translation.value));
 

+ 1 - 1
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)

+ 1 - 0
code/Common/Importer.cpp

@@ -78,6 +78,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/Profiler.h>
 #include <assimp/commonMetaData.h>
 
+#include <exception>
 #include <set>
 #include <memory>
 #include <cctype>

+ 1 - 0
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 <exception>
 #include <map>
 #include <vector>
 #include <string>

+ 2 - 1
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

+ 1 - 1
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()

+ 1 - 1
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 )

+ 1 - 1
contrib/pugixml/CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.10)
 
 project(pugixml)
 

+ 1 - 1
contrib/zip/CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
 
 project(zip
   LANGUAGES C

+ 1 - 1
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)

+ 2 - 0
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 <assimp/types.h>
 
+#include <exception>
+
 namespace Assimp {
 // =======================================================================
 // Public interface to Assimp

+ 2 - 2
include/assimp/defs.h

@@ -247,14 +247,14 @@ typedef double ai_real;
 typedef signed long long int ai_int;
 typedef unsigned long long int ai_uint;
 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
-#define ASSIMP_AI_REAL_TEXT_PRECISION 16
+#define ASSIMP_AI_REAL_TEXT_PRECISION 17
 #endif // ASSIMP_AI_REAL_TEXT_PRECISION
 #else // ASSIMP_DOUBLE_PRECISION
 typedef float ai_real;
 typedef signed int ai_int;
 typedef unsigned int ai_uint;
 #ifndef ASSIMP_AI_REAL_TEXT_PRECISION
-#define ASSIMP_AI_REAL_TEXT_PRECISION 8
+#define ASSIMP_AI_REAL_TEXT_PRECISION 9
 #endif // ASSIMP_AI_REAL_TEXT_PRECISION
 #endif // ASSIMP_DOUBLE_PRECISION
 

+ 4 - 0
include/assimp/metadata.h

@@ -350,6 +350,10 @@ struct aiMetadata {
         } else if (nullptr != mValues[index].mData && AI_AIMETADATA == mValues[index].mType) {
             *static_cast<T *>(mValues[index].mData) = value;
         } else {
+            if (nullptr != mValues[index].mData) {
+                delete mValues[index].mData;
+                mValues[index].mData = nullptr;
+            }
             mValues[index].mData = new T(value);
         }
 

+ 1 - 1
port/AndroidJNI/CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.10)
 
 include_directories(./)
 include_directories(./../../)

+ 0 - 4
scripts/AppVeyor/cacheglobs.txt

@@ -1,4 +0,0 @@
-code/*.{%{cpp}}
-contrib/**/*.{%{cpp}}
-include/**/*.{%{cpp}}
-test/**/*.{%{cpp}}

+ 0 - 177
scripts/AppVeyor/mtime_cache

@@ -1,177 +0,0 @@
-#!/usr/bin/env ruby
-
-#
-# mtime_cache
-# Copyright (c) 2016 Borislav Stanimirov
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-
-require 'digest/md5'
-require 'json'
-require 'fileutils'
-
-VERSION = "1.0.2"
-
-VERSION_TEXT = "mtime_cache v#{VERSION}"
-
-USAGE = <<ENDUSAGE
-
-Usage:
-    mtime_cache [<globs>] [-g globfile] [-d] [-q|V] [-c cache]
-ENDUSAGE
-
-HELP = <<ENDHELP
-
-    Traverse through globbed files, making a json cache based on their mtime.
-    If a cache exists, changes the mtime of existing unchanged (based on MD5
-    hash) files to the one in the cache.
-
-    Options:
-
-    globs           Ruby-compatible glob strings (ex some/path/**/*.java)
-                    A extension pattern is allowd in the form %{pattern}
-                    (ex some/path/*.{%{pattern1},%{pattern2}})
-                    The globs support the following patterns:
-                     %{cpp} - common C++ extensions
-
-    -g, --globfile  A file with list of globs to perform (one per line)
-
-    -?, -h, --help  Show this help message.
-    -v, --version   Show the version number (#{VERSION})
-    -q, --quiet     Don't log anything to stdout
-    -V, --verbose   Show extra logging
-    -d, --dryrun    Don't change any files on the filesystem
-    -c, --cache     Specify the cache file for input and output.
-                    [Default is .mtime_cache.json]
-
-ENDHELP
-
-param_arg = nil
-ARGS = { :cache => '.mtime_cache.json', :globs => [] }
-
-ARGV.each do |arg|
-  case arg
-    when '-g', '--globfile'   then param_arg = :globfile
-    when '-h', '-?', '--help' then ARGS[:help] = true
-    when '-v', '--version'    then ARGS[:ver] = true
-    when '-q', '--quiet'      then ARGS[:quiet] = true
-    when '-V', '--verbose'    then ARGS[:verbose] = true
-    when '-d', '--dryrun'     then ARGS[:dry] = true
-    when '-c', '--cache'      then param_arg = :cache
-    else
-      if param_arg
-        ARGS[param_arg] = arg
-        param_arg = nil
-      else
-        ARGS[:globs] << arg
-      end
-  end
-end
-
-def log(text, level = 0)
-  return if ARGS[:quiet]
-  return if level > 0 && !ARGS[:verbose]
-  puts text
-end
-
-if ARGS[:ver] || ARGS[:help]
-  log VERSION_TEXT
-  exit if ARGS[:ver]
-  log USAGE
-  log HELP
-  exit
-end
-
-if ARGS[:globs].empty? && !ARGS[:globfile]
-  log 'Error: Missing globs'
-  log USAGE
-  exit 1
-end
-
-EXTENSION_PATTERNS = {
-  :cpp => "c,cc,cpp,cxx,h,hpp,hxx,inl,ipp,inc,ixx"
-}
-
-cache_file = ARGS[:cache]
-
-cache = {}
-
-if File.file?(cache_file)
-  log "Found #{cache_file}"
-  cache = JSON.parse(File.read(cache_file))
-  log "Read #{cache.length} entries"
-else
-  log "#{cache_file} not found. A new one will be created"
-end
-
-globs = ARGS[:globs].map { |g| g % EXTENSION_PATTERNS }
-
-globfile = ARGS[:globfile]
-if globfile
-  File.open(globfile, 'r').each_line do |line|
-    line.strip!
-    next if line.empty?
-    globs << line % EXTENSION_PATTERNS
-  end
-end
-
-if globs.empty?
-  log 'Error: No globs in globfile'
-  log USAGE
-  exit 1
-end
-
-files = {}
-num_changed = 0
-
-globs.each do |glob|
-  Dir[glob].each do |file|
-    next if !File.file?(file)
-
-    mtime = File.mtime(file).to_i
-    hash = Digest::MD5.hexdigest(File.read(file))
-
-    cached = cache[file]
-
-    if cached && cached['hash'] == hash && cached['mtime'] < mtime
-      mtime = cached['mtime']
-
-      log "mtime_cache: changing mtime of #{file} to #{mtime}", 1
-
-      File.utime(File.atime(file), Time.at(mtime), file) if !ARGS[:dry]
-      num_changed += 1
-    else
-      log "mtime_cache: NOT changing mtime of #{file}", 1
-    end
-
-    files[file] = { 'mtime' => mtime, 'hash' => hash }
-  end
-end
-
-log "Changed mtime of #{num_changed} of #{files.length} files"
-log "Writing #{cache_file}"
-
-if !ARGS[:dry]
-  dirname = File.dirname(cache_file)
-  unless File.directory?(dirname)
-    FileUtils.mkdir_p(dirname)
-  end
-  File.open(cache_file, 'w').write(JSON.pretty_generate(files))
-end

+ 1 - 1
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

+ 11 - 2
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);
+}

+ 1 - 1
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

+ 1 - 1
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)