「利用者:Phabtar/Animation Importing」の版間の差分

提供: wiki
移動先: 案内検索
(相違点なし)

2011年6月19日 (日) 19:52時点における版

Animation Importer

This is the summary of my findings on the Animation Importing procedure prior to my project. Before I dive into the Blender implementation I'll try to explain my understanding on the opencollada animation parsing procedure.

  • First when parsing animation tags on the .dae the writeAnimation() method gets called. The method is overridden in DocumentImporter.
  • In post processing stage, writeAnimationList is called for each animationList. This is also overridden in DocumentImporter.
    • Animation lists hold the animation bindings which has animation class and animation id. Each Animatable ( FW classes derived from Animatable class) has an Animation list id.
    • When parsing channel tags in an animation, the animation info is mapped with the sid on channel->target attribute. This mapped is used in the post process stage to create animation lists. The sid target in the map is used to refer the relevant animatable and the animlist binding is made from the animation info in the map. Then the animlist id is assigned to the referred animatable->animListId property.
    • The animation class is determined in the SaxFWLLibraryAnimationsLoader. The class is assigned to the animation info according to the parameters in the animation. The classes are declared in COLLADAFWAnimationList.h

The blender implementation

  • In writeAnimations each fcurves are made with the info taken from the animation and the curves are mapped with the animid in curve_map.
  • In witeAnimationList the list id is mapped with the animationList objects in animlistmap.
  • Those maps are used with the nodemap and objectmaps to write animation curves
    • In the finish() method in DocumentImporter translate_anim_recursive() is called on each Node four times. Once for each transformation type.
    • The animation list is taken for each transformation if the node->transformation matches with the transformation in the iteration.
    • The curves related to the current transformation is taken from the map. Those curves are used to find the key-frames available for the current animation of the transform
    • new fcurves are made according to the transformation type of the iteration.
    • Transformations are evaluated at each key frame and relative tranform matrices are made, and those matrices are used to calculate the beztriples of the the new curves.
    • The curves are assigned to objects and bones.

The joint or bone animation importing scenario is still a little bit misty. But as I understand it basically does the same thing, which is assign fcurves to joints.

In my honest opinion making new fcurves by referring only the input schemantic data imported from the COLLADA document is somewhat inefficient considering all the necessary data is already in the fcurves made in the writeAnimations() method. Still have to discuss with COLLADA developers why that approach is implemented.