From 0bb672c6fa9e2dbdabbcd9d7294caab406d9ea81 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Tue, 27 Nov 2018 11:45:53 +0000 Subject: [PATCH 1/3] Fix scenes not always being loaded --- code/glTF2Asset.inl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index 687e16ce1..ed37937f4 100755 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -1357,6 +1357,13 @@ inline void Asset::Load(const std::string& pFile, bool isBinary) } } + // Force reading of skins since they're not always directly referenced + if (Value* skinsArray = FindArray(doc, "skins")) { + for (unsigned int i = 0; i < skinsArray->Size(); ++i) { + skins.Retrieve(i); + } + } + if (Value* animsArray = FindArray(doc, "animations")) { for (unsigned int i = 0; i < animsArray->Size(); ++i) { animations.Retrieve(i); From 657014dff6a493783b17317031f0ca6fa2e4e1bc Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 27 Nov 2018 20:18:00 +0100 Subject: [PATCH 2/3] Update glTF2Asset.inl Fix possible nullptr-dereferencing. --- code/glTF2Asset.inl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index ed37937f4..f8955d6d2 100755 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -1359,9 +1359,11 @@ inline void Asset::Load(const std::string& pFile, bool isBinary) // Force reading of skins since they're not always directly referenced if (Value* skinsArray = FindArray(doc, "skins")) { - for (unsigned int i = 0; i < skinsArray->Size(); ++i) { - skins.Retrieve(i); - } + if ( nullptr != skinsArray ) { + for (unsigned int i = 0; i < skinsArray->Size(); ++i) { + skins.Retrieve(i); + } + } } if (Value* animsArray = FindArray(doc, "animations")) { From 47e3301c4768de184fc031e18dfcca00dfc9f0c0 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 27 Nov 2018 23:22:09 +0100 Subject: [PATCH 3/3] Update glTF2Asset.inl Remove my nonsense, sorry! --- code/glTF2Asset.inl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index f8955d6d2..ed37937f4 100755 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -1359,11 +1359,9 @@ inline void Asset::Load(const std::string& pFile, bool isBinary) // Force reading of skins since they're not always directly referenced if (Value* skinsArray = FindArray(doc, "skins")) { - if ( nullptr != skinsArray ) { - for (unsigned int i = 0; i < skinsArray->Size(); ++i) { - skins.Retrieve(i); - } - } + for (unsigned int i = 0; i < skinsArray->Size(); ++i) { + skins.Retrieve(i); + } } if (Value* animsArray = FindArray(doc, "animations")) {