question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parsing the animations in ColladaLoader

See original GitHub issue
Description of the problem

Hello,

The following is a solution to a problem I have just faced with the animations parsed by the new ColladaLoader.

I use Autodesk Maya 2017, and when exporting the 3D model containing animations, an extra <animation> tag has been added under the “real” <animation> tag.

<animation id=​"xxx-anim" name=​"xxx">
    ​<animation>
        ​<source id=​"xxx-Matrix-animation-input">​</source>​
        <source id=​"xxx-Matrix-animation-output-transform"></source>
        ​<source id=​"xxx-Interpolations">​​</source>​
        <sampler id=​"xxx-Matrix-animation-transform">​</sampler>
        ​<channel source=​"#xxx-Matrix-animation-transform" target=​"xxx/​matrix">​</channel>​
    </animation>
​</animation>

I digged into the source code of the ColladaLoader and I added the following lines into the parseAnimation( xml ) function in order to handle this extra tag:

switch ( child.nodeName )
{
    /* Handling 'source', 'sampler' and 'channel' */

    case 'animation':
        child.setAttribute( 'id', xml.getAttribute( 'id' ) );
        child.setAttribute( 'name', xml.getAttribute( 'name' ) );
        parseAnimation( child );
        return;
}
Three.js version
  • Dev
  • r92
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Mugen87commented, Aug 27, 2018

According to page 46 of https://www.khronos.org/files/collada_spec_1_4.pdf, it’s valid to nest animation tags. So I don’t think it’s a bug in the exporter. Besides, overwriting attribute properties seems to be invalid, even it works for your case.

And yes, return is actually the better choice 👍

1reaction
Mugen87commented, May 3, 2018

Thanks for sharing this! I think it’s actually conform to the standard to create such animations trees. Why not creating a PR with your code?

BTW: We should use break instead of return.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Skeletal animation using parsed data from COLLADA file in ...
The loader seems to parse and store the skeleton structure and some skeletal animation data either in collada.animations or collada.dae.animations. The problem ...
Read more >
…/ColladaLoader.cpp · Gerrit Code Review
// the workaround is only enabled when the first attempt to resolve the node has failed .
Read more >
dae animation won't work - Questions - three.js forum
It seems your DAE file contains no animation data. The parsed animation clip has definitely no keyframes (the tracks array is empty):.
Read more >
collada-dae-parser - npm
collada-dae-parser parses a collada file and outputs JSON. This is useful for displaying skeletal animations in the browser.
Read more >
why would THREE.ColladaLoader halt all activity on the site?
The only way out of it, is to split the parse and creation task into multiple smaller ones, which can be executed one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found