Assimp guarantees in its docs that mRootNode is never NULL.
glTF2Importer::ImportNodes therefore must always create a root node, or throw an exception. A GLTF2 file is invalid without a scene, so the importer should throw in that case. For GLTF2 files with a scene without nodes, it should create an empty root node.pull/3069/head
parent
7e23773776
commit
3f75ef68ae
|
@ -953,8 +953,8 @@ aiNode *ImportNode(aiScene *pScene, glTF2::Asset &r, std::vector<unsigned int> &
|
|||
|
||||
void glTF2Importer::ImportNodes(glTF2::Asset &r) {
|
||||
if (!r.scene) {
|
||||
return;
|
||||
}
|
||||
throw DeadlyImportError("GLTF: No scene");
|
||||
}
|
||||
|
||||
std::vector<Ref<Node>> rootNodes = r.scene->nodes;
|
||||
|
||||
|
@ -971,6 +971,8 @@ void glTF2Importer::ImportNodes(glTF2::Asset &r) {
|
|||
root->mChildren[root->mNumChildren++] = node;
|
||||
}
|
||||
mScene->mRootNode = root;
|
||||
} else {
|
||||
mScene->mRootNode = new aiNode("ROOT");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue