Merge pull request #3226 from M4T1A5/gltf2_fix_skin_recursion

[GLTF2] Fix infinite recursion in skin/node parsing
pull/3235/head
Kim Kulling 2020-05-18 11:12:49 +02:00 committed by GitHub
commit 3b15eca099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1188,9 +1188,11 @@ inline void Node::Read(Value &obj, Asset &r) {
}
}
// Do not retrieve a skin here, just take a reference, to avoid infinite recursion
// Skins will be properly loaded later
Value *curSkin = FindUInt(obj, "skin");
if (nullptr != curSkin) {
this->skin = r.skins.Retrieve(curSkin->GetUint());
this->skin = r.skins.Get(curSkin->GetUint());
}
Value *curCamera = FindUInt(obj, "camera");
@ -1481,7 +1483,7 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
}
}
// Force reading of skins since they're not always directly referenced
// Read skins after nodes have been loaded to avoid infinite recursion
if (Value *skinsArray = FindArray(doc, "skins")) {
for (unsigned int i = 0; i < skinsArray->Size(); ++i) {
skins.Retrieve(i);