Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTFLoader.js:2145 TypeError: Cannot read property 'children' of undefined #11460

Closed
2 of 13 tasks
densetsughem opened this issue Jun 7, 2017 · 10 comments
Closed
2 of 13 tasks

Comments

@densetsughem
Copy link

densetsughem commented Jun 7, 2017

Description of the problem

Please help. I got below error when I tried to load a .gltf file. I used the sample code: https://threejs.org/examples/#webgl_loader_gltf2

Also, here is the link of the files I used:
http://densetsughem.com/Dog.zip

THREE.Object3D.add: object not an instance of THREE.Object3D. undefined
GLTFLoader.js:2145 Uncaught (in promise) TypeError: Cannot read property 'children' of undefined
    at buildNodeHierachy (GLTFLoader.js:2145)
    at buildNodeHierachy (GLTFLoader.js:2152)
    at GLTFLoader.js:2178
    at _each (GLTFLoader.js:604)
    at GLTFLoader.js:2166
    at <anonymous>
buildNodeHierachy @ GLTFLoader.js:2145
buildNodeHierachy @ GLTFLoader.js:2152
(anonymous) @ GLTFLoader.js:2178
_each @ GLTFLoader.js:u
(anonymous) @ GLTFLoader.js:2166

Thank you in advance.

Three.js version
  • Dev
  • r85
  • ...
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)

image

@donmccurdy
Copy link
Collaborator

donmccurdy commented Jun 7, 2017

Hi @densetsughem — thanks for the details! You have a glTF1.0 model here, and we're not supporting that much longer. Rather than try to debug what might be wrong with GLTFLoader or with the model, could you try making a glTF2.0 version?

There is a new glTF Blender exporter that should help: https://github.com/KhronosGroup/glTF-Blender-Exporter

To test glTF2.0 files in THREE.GLTF2Loader, you can drag-and-drop them here: https://gltf-viewer.donmccurdy.com/

@mrdoob mrdoob closed this as completed Jun 7, 2017
@densetsughem
Copy link
Author

Still having problem. When I update to gltf2 when I tried to export it from blender -> gltf2 i encountered following errors:

error1
error2

But when I tried to uncheck skinning I successfully exported the file to .gltf But animation failed to be exported even though I checked it.
error3

Models:
densetsughem.com/GLTF2-Blend-fIle.rar

Thank You. :)

@donmccurdy
Copy link
Collaborator

Most likely there is a bug with skinning, either with the Blender exporter or with THREE.GLTF2Loader. I'll look into that more in the next few days.

If you're in a hurry, you may also want to try an alternative workflow here. Depending on which version of COLLADA2GLTF you use, that might give you a glTF1.0 or glTF2.0 model.

@donmccurdy
Copy link
Collaborator

@densetsughem it looks like there are some issues in the Blender exporter (it is a work in progress), so I've opened a new issue here: KhronosGroup/glTF-Blender-Exporter#8

I briefly tried the other workflow suggested, and didn't have much luck with that, so getting the issue fixed in the blender exporter may be the best option for now.

@donmccurdy
Copy link
Collaborator

With the changes in #11485, and fixes already made to the Blender exporter, we're getting close. There will be a couple more small fixes needed for animation, but here's the result in three.js:

22ea4c42-c473-45ab-b25b-5eaa7f7002fe-48734-0001e27c9dc5e111

@donmccurdy
Copy link
Collaborator

There's still an issue with the Alena model:

b460a58a-4c7d-4f4c-b841-d9e7d00a3e78-52448-0001f3c9f995b5d2

I'm not sure what to make of that; I can't tell if the .gltf asset is correct or not.

@densetsughem
Copy link
Author

@donmccurdy hi. Can i get a running dog script? So that I can study how it works? when I update my copy of threejs I encountered a KH_material error.

thanks.

@donmccurdy
Copy link
Collaborator

Hi @densetsughem — you can find the working Dog.gltf model, and the changes needed to create it (after updating your version of the blender exporter) here: KhronosGroup/glTF-Blender-Exporter#8 (comment)

Usage is the same as this sample: https://threejs.org/examples/#webgl_loader_gltf2

You'll also be able to test models in a drag-and-drop viewer (https://gltf-viewer.donmccurdy.com/), although I haven't yet updated it with these fixes.

@WestLangley
Copy link
Collaborator

@donmccurdy Any chance you can help some more on SO? :)

@donmccurdy
Copy link
Collaborator

Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants