OBJLoader appears to corrupt JS object

I’m having trouble loading one particular OBJ file with Three’s OBJ loader. Here is the error:

three.min.js:524 Uncaught TypeError: Cannot read property 'traverse' of undefined at Pb.traverse (three.min.js:524)

Looking in the JS inspector it appears that the summary of the JS object at the top thinks there are 3 objects in the OBJ file (which is true), but when you expand to see the details the children array contains only two children. Somehow, Three JS is trying to traverse the third child and finding nothing because it isn’t there. Or it is. Or should be. I can’t tell anymore. (In the screenshot below, note the “children: Array(3)” at the very top, and then “children: Array(2)” in the dropdown.) This appears to only happen with this particular file, but I can’t figure out why.

Screenshot_20190405_191830

Has anyone else had this issue before?

Can you please share the OBJ in this thread?

The logs of the browser console can sometimes be misleading. From MDN:

Please be warned that if you log objects in the latest versions of Chrome and Firefox what you get logged on the console is a reference to the object , which is not necessarily the ‘value’ of the object at the moment in time you call console.log(), but it is the value of the object at the moment you click it open.

Absolutely. Take a look at it here: platform.mtl (441 Bytes)
platform.obj (2.5 KB)

There should be three objects - Blender imports them perfectly for me. It’s possible it’s not exporting properly, but having someone doublecheck would be great.

The dev tools in Chrome seems to correctly show the object hierarchy. A THREE.Group object with two children.

image

When I import the OBJ in Blender, I see two objects in the outline menu, too:

image

The OBJ itself does only contain two object definitions. So the overall result looks right.

Ah, crud. Turns out I gave you the wrong file. That OBJ works as expected because I reverted to an older one so I could continue working. Try this one?

platform_problem.obj (4.2 KB)
platform_problem.mtl (668 Bytes)

No inconsistency even with this model:

image

Blender:

image

Traversing works fine…

Hm. I guess I’ll clear my cache and try again later this afternoon. I have no idea why it’s giving me grief. I’ll post an update when I do to let you know if it helped.