Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for importing library animation clips #565

Closed
gaiaclary opened this issue Mar 2, 2018 · 10 comments · Fixed by #596
Closed

Support for importing library animation clips #565

gaiaclary opened this issue Mar 2, 2018 · 10 comments · Fixed by #596

Comments

@gaiaclary
Copy link
Contributor

gaiaclary commented Mar 2, 2018

Hi;
I am trying to add support for library animation clips to the Blender Collada Importer. The problem is that according to the specification animations shall only be applied to the scene animation playback when they are not referenced by any library animation clip:

From the Collada 1.4 Spec document:

animations that are referred to and used in animation_clips should not be applied to the
scene at playback time; instead, apply only unreferenced animations to the scene (used for
playback).
Note: Plug-in implementors must support this strategy even if they do not fully support
animation_clip. For example, DCC tools can store the contents of library_animations and
library_animation_clips in banks or palettes. Any unreferenced animation is left to be
processed according to the application run-time; these are the ones to load and play.

However during import i just get the defined instance_animations one after the other and i can not figure out which of them i shall import as library animation and which of them i shall import directly to the scene playback.

Any Help? Any example function where i can look at?
btw: Exporting libary animation clips was no problem with OpenCollada.

@RemiArnaud
Copy link
Contributor

is it possible to take a look at your importer code ?

@gaiaclary
Copy link
Contributor Author

gaiaclary commented Mar 3, 2018

yes of course. However it is a bit of a large blob and it took me quiet a while to find my way through it ;/

https://developer.blender.org/diffusion/B/browse/master/source/blender/collada/DocumentImporter.cpp
https://developer.blender.org/diffusion/B/browse/master/source/blender/collada/AnimationImporter.cpp

Here is a bit of a roadmap in the hope it helps to quickly identify what we are doing wrong here:

First of all check the parameter mImportStage in the DocumentImporter. That parameter is preset to General when the importer is created. So when we get to the point of interest further down you can expect this is true:

mImportStage==General

Ok... As far as i can see the main entries of interest in DocumentImporter are:

writeAnimation() in line 1324

The method writeAnimation() seems to be called for Animation entries, but only if the animations contain sources, channel and sampler. Organizational animation nodes seem to be not reported to the importer?

writeAnimationList() in line 1334

From the method name writeAnimationList() i expected to get the animation clips here. But the bindings in the animationlists that i get here actually point to the same animations that i already have imported before when writeAnimation() was called.

The animation clips still hide somewhere... So i need to understand where and how animationclips are imported.

For clarity i also uploaded a small testfile suzanne.dae to our Blog

There you find 3 library animations and one animation_clip that refers to 2 of the library animations.

I expect that the animation "Suzanne_SuzanneAction_location" is passed to writeAnimation() so i can import it to the scene for direct playback.

And i expect the animation clip "SuzanneAction" is passed to writeAnimationList() so i can add the animations mentioned in the clip to the animation library in Blender.

Since i get all animations in both methods and no information about the animation clips at all, i believe that i misunderstand something here.

@RemiArnaud
Copy link
Contributor

From our investigation it does not look like openCollada has support to read clips :-(

@RemiArnaud
Copy link
Contributor

So changes to openCollada are required.

@gaiaclary
Copy link
Contributor Author

Do you think this can be done easily?
I am still working on the Blender exporter for doing a bit of cleanup and making the export faster and more complete.

I am also not sure if i can be helpful on the OpenCollada side, but if it is doable without knowing the entire collada sources, then i can give it a try later. However i would appreciate if someone more familiar with the library could take care of this if possible ?

thanks :)

@gaiaclary
Copy link
Contributor Author

Ideally someone who is familiar with the OpenCollada sources should do this. But if nobody is available, then i can give it a try.

In that case can i expect to get some help from here? At least some hints or pointers to something that i can look at as an example for how to add this feature?

Thanks for any response on that :)
-gaia-

@gaiaclary
Copy link
Contributor Author

I just had the idea if there is a more direct access to the collada file. So that i can for example get a list of all "library_animation_clips" nodes.

Then i can step into this node list and figure out which instance_animations are listed. This gives me the information which animations are meant to be imported to the scene, and which are meant to be imported into the animation library.

If this is possible then its ok for the begin :)

@lasalvavida
Copy link
Contributor

Bump, we need this for COLLADA2GLTF also: KhronosGroup/COLLADA2GLTF#130

@lasalvavida
Copy link
Contributor

lasalvavida commented Oct 3, 2018

@gaiaclary, I have opened up #592 which adds support for animation clips to OpenCOLLADA. If you could try it and see if it has any issues for you, I would appreciate that.

@gaiaclary
Copy link
Contributor Author

gaiaclary commented Nov 26, 2018

@lasalvavida Sorry, i must have overlooked your post from october. But i am glad to see that this issue has been resolved now. So i will add it to the Blender 2.8 development branch in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants