Parsing the animations in ColladaLoader
See original GitHub issueDescription 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:
- Created 5 years ago
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 👍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 ofreturn
.