Three.js: ColladaLoader fails to parse dae file

Created on 11 Dec 2017  路  6Comments  路  Source: mrdoob/three.js

Hello,

ColladaLoader.js fails to parse these dae files. I got these stack trace.

shoulder_pan_link.dae

http://localhost:8888/fetch_description/meshes/shoulder_pan_link.dae
ColladaLoader.js:3350 THREE.ColladaLoader: DOMParser: 6.8740234375ms
ColladaLoader.js:3357 THREE.ColladaLoader: File version 1.4.1
ColladaLoader.js:3403 THREE.ColladaLoader: Parse: 64.591064453125ms
ColladaLoader.js:202 Uncaught TypeError: Cannot read property 'build' of undefined
    at getBuild (ColladaLoader.js:202)
    at getCamera (ColladaLoader.js:1622)
    at buildNode (ColladaLoader.js:3032)
    at getBuild (ColladaLoader.js:204)
    at getNode (ColladaLoader.js:3227)
    at buildVisualScene (ColladaLoader.js:3273)
    at buildLibrary (ColladaLoader.js:192)
    at THREE.ColladaLoader.parse (ColladaLoader.js:3416)
    at Object.onLoad (ColladaLoader.js:28)
    at XMLHttpRequest.<anonymous> (three.js:30483)
Three.js version
  • [x] Dev
  • [x] r88
  • [ ] ...
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)

Most helpful comment

Okay, the change is actually easy. I'll provide a PR 馃憤

All 6 comments

I have investigated base_link.dae and found the following problem: The file contains nodes in its visual scene that or not defined within their respected <library*> tags. So the visual scene of base_link.dae contains a camera and a light node:

<node id="Camera" name="Camera" type="NODE">
    <matrix sid="transform">0.6858805 -0.3173701 0.6548619 7.481132 0.7276338 0.3124686 -0.6106656 -6.50764 -0.01081678 0.8953432 0.4452454 5.343665 0 0 0 1</matrix>
    <instance_camera url="#Camera-camera"/>
</node>
<node id="Lamp" name="Lamp" type="NODE">
    <matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
    <instance_light url="#Lamp-light"/>
</node>

But there are no definitions of the elements within <library_cameras> and <library_lights>. These elements/tags are just missing. For ColladaLoader such dae files are not valid right now.

@mrdoob I'm not sure how we should handle this situation. Should we make ColladaLoader more "tolerant"?

I'm just annoyed that exporters produce such crap at all :triumph:. I don't like the idea to provide fixes for all these special cases that shall actually not occur.

According to the spec, the structure of the mentioned dae file is not compliant (at least to my understanding).

@jihoonl Just one hint: If you delete the faulty nodes in the visual scene, ColladaLoader is able to load your file.

@mrdoob I'm not sure how we should handle this situation. Should we make ColladaLoader more "tolerant"?

I don't know... The obj loader has similar issues...
I guess for these cases I would first check how Blender handles the files.

Well, the Blender exporter produced the mentioned file :laughing:. Blender is also able to load it.

Okay, the change is actually easy. I'll provide a PR 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DefinitelyMaybe picture DefinitelyMaybe  路  88Comments

Mugen87 picture Mugen87  路  68Comments

mrdoob picture mrdoob  路  66Comments

jonobr1 picture jonobr1  路  95Comments

sunag picture sunag  路  161Comments