Merge pull request #33799 from fire/gltf2-scene

33714 glTF2 scene count change try two.
This commit is contained in:
Rémi Verschelde 2019-11-22 20:55:42 +01:00 committed by GitHub
commit 91b60a74df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,9 +229,16 @@ Error EditorSceneImporterGLTF::_parse_scenes(GLTFState &state) {
ERR_FAIL_COND_V(!state.json.has("scenes"), ERR_FILE_CORRUPT); ERR_FAIL_COND_V(!state.json.has("scenes"), ERR_FILE_CORRUPT);
const Array &scenes = state.json["scenes"]; const Array &scenes = state.json["scenes"];
ERR_FAIL_COND_V(!scenes.size(), ERR_FILE_CORRUPT); int loaded_scene = 0;
for (int i = 0; i < 1; i++) { //only first scene is imported if (state.json.has("scene")) {
const Dictionary &s = scenes[i]; loaded_scene = state.json["scene"];
} else {
WARN_PRINT("The load-time scene is not defined in the glTF2 file. Picking the first scene.")
}
if (scenes.size()) {
ERR_FAIL_COND_V(loaded_scene >= scenes.size(), ERR_FILE_CORRUPT);
const Dictionary &s = scenes[loaded_scene];
ERR_FAIL_COND_V(!s.has("nodes"), ERR_UNAVAILABLE); ERR_FAIL_COND_V(!s.has("nodes"), ERR_UNAVAILABLE);
const Array &nodes = s["nodes"]; const Array &nodes = s["nodes"];
for (int j = 0; j < nodes.size(); j++) { for (int j = 0; j < nodes.size(); j++) {