TypeError: Cannot read property 'array' of undefined
See original GitHub issueHey there, absolutely love the work that’s being done with this project and react-three-fiber. Thank you so much!
I’m trying to convert a gltf file but I always run into the same error.
THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().
THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).
...
...
THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().
THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).
TypeError: Cannot read property 'array' of undefined
at /Users/simonhales/.npm/_npx/10218/lib/node_modules/gltfjsx/bin/GLTFLoader.js:1171:57
at async Promise.all (index 0)
at async Promise.all (index 1)
loader failed
The command I’m running is npx gltfjsx Banana.gltf Banana.js --animation
I’ve uploaded my files here https://drive.google.com/drive/folders/1pE7XhITz5oE-WrQKoRPva6bQ24Mmacx8?usp=sharing
Banana.gltf is exported straight from Blender.
bananaDraco.gltf has been converted via gltf-pipeline
I’ve also included the original Blender file.
I verified that the files could be viewed via https://gltf-viewer.donmccurdy.com/
I’m not the most experienced dev (especially when it comes to this kind of stuff), but I have some time off at the moment so I shall clone this repo and see if I’m able to make any progress with determining the issue.
Note: I tested using the example .glb file in this repo, which had no issues.
Edit:
Just to add, I’m able to load Banana.gltf
just fine via the example from the react-three-fiber readme.
import { useLoader } from 'react-three-fiber'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
...
const gltf = useLoader(GLTFLoader, url)
...
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top GitHub Comments
should be fixed! at least banana.gltf goes through. the draco thing for some reason still doesn’t. but you can at least keep on working, the output structure between the two would be the same.
i think it would need to be the object hierarchy. i think relying on pure gltf would be the easiest when it comes to reading out, but emulating a basic threejs structure is probably going to be very hard.
the current workflow is based on the /bin directory in this repo, a fork of the loader and everything that ever wants to fetch requests for assets or create things that node can’t is removed little by little. i think i oriented myself around the gist you posted, i saw it in the threejs discourse forum i believe. unfortunately i must have minimized it in the very beginning, very clever … 🤭