Merge pull request #1978 from gstanlo/master

glTF/2.0: Pick scene 0 as scene to load if no "scene" property is specified
pull/1980/head
Kim Kulling 2018-05-24 15:38:49 +02:00 committed by GitHub
commit 604b56b96f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -1216,12 +1216,15 @@ inline void Asset::Load(const std::string& pFile, bool isBinary)
// Read the "scene" property, which specifies which scene to load // Read the "scene" property, which specifies which scene to load
// and recursively load everything referenced by it // and recursively load everything referenced by it
unsigned int sceneIndex = 0;
if (Value* scene = FindUInt(doc, "scene")) { if (Value* scene = FindUInt(doc, "scene")) {
unsigned int sceneIndex = scene->GetUint(); sceneIndex = scene->GetUint();
}
Ref<Scene> s = scenes.Retrieve(sceneIndex); if (Value* scenesArray = FindArray(doc, "scenes")) {
if (sceneIndex < scenesArray->Size()) {
this->scene = s; this->scene = scenes.Retrieve(sceneIndex);
}
} }
// Clean up // Clean up