From 6848a18999be2acf31791cf17624d7601d7f0e7c Mon Sep 17 00:00:00 2001 From: Jukka Maatta Date: Tue, 13 Oct 2020 21:56:43 +0300 Subject: [PATCH 1/2] Fix for issue #3445 Add const to avoid creating a temporary copy. This should fix the cmake compilation error on XGLLoader.cpp shown in bug #3445 The fix is similar to commit bbe6f7f213b5e2ee689146df5c068dc1a55ea919 --- code/AssetLib/XGL/XGLLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/XGL/XGLLoader.cpp b/code/AssetLib/XGL/XGLLoader.cpp index 0ef5943c0..3590b9441 100644 --- a/code/AssetLib/XGL/XGLLoader.cpp +++ b/code/AssetLib/XGL/XGLLoader.cpp @@ -598,7 +598,7 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) { } // finally extract output meshes and add them to the scope - typedef std::pair pairt; + typedef std::pair pairt; for (const pairt &p : bymat) { aiMesh *const m = ToOutputMesh(p.second); scope.meshes_linear.push_back(m); From 857f62cde0689cfdbb165bc80d7113d51d666c22 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 14 Oct 2020 20:34:46 +0200 Subject: [PATCH 2/2] closes pParam.mReference = source; --- code/AssetLib/Collada/ColladaParser.cpp | 13 ++++++++++--- code/Common/BaseImporter.cpp | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/code/AssetLib/Collada/ColladaParser.cpp b/code/AssetLib/Collada/ColladaParser.cpp index 42aebdb6d..c5ca97b89 100644 --- a/code/AssetLib/Collada/ColladaParser.cpp +++ b/code/AssetLib/Collada/ColladaParser.cpp @@ -137,10 +137,12 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) : // ------------------------------------------------------------------------------------------------ // Destructor, private as well ColladaParser::~ColladaParser() { - for (NodeLibrary::iterator it = mNodeLibrary.begin(); it != mNodeLibrary.end(); ++it) + for (NodeLibrary::iterator it = mNodeLibrary.begin(); it != mNodeLibrary.end(); ++it) { delete it->second; - for (MeshLibrary::iterator it = mMeshLibrary.begin(); it != mMeshLibrary.end(); ++it) + } + for (MeshLibrary::iterator it = mMeshLibrary.begin(); it != mMeshLibrary.end(); ++it) { delete it->second; + } } // ------------------------------------------------------------------------------------------------ @@ -1284,10 +1286,10 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam) if (node.empty()) { return; } + XmlNodeIterator xmlIt(node); xmlIt.collectChildrenPreOrder(node); XmlNode currentNode; - while (xmlIt.getNext(currentNode)) { const std::string ¤tName = currentNode.name(); if (currentName == "surface") { @@ -1313,6 +1315,11 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam) } pParam.mType = Param_Sampler; pParam.mReference = url.c_str() + 1; + } else if (currentName == "source") { + const char *source = currentNode.child_value(); + if (nullptr != source) { + pParam.mReference = source; + } } } } diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp index efeae03b1..b9c4d2bc3 100644 --- a/code/Common/BaseImporter.cpp +++ b/code/Common/BaseImporter.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2020, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms,