利用者:Phabtar/Lights Parameters Animations

提供: wiki
移動先: 案内検索

COLLADA Object Parameter Animation support

This is the procedure which is currently used to improve COLLADA support for Light parameter animations.

Export

  1. Set the sid of the parameter that is exported, if it's not already set. For example, when exporting color animations set color sid to "color". ( light->setColor( COLLADASWcolor, false, "color" ).
  2. Id if there are f-curves in the parameter in Blender. For example for color animations :
    1. If object is Lamp
    2. Get Lamp from object->data
    3. Get lamp->animdata->action->curves. Curves not empty object has animations.
  3. Get the curves from above validation technique. For each curve get animation name from fcurve rna_path.
  4. If the animation name equals the parameter to be exported call dae_animation() on the object.
  5. Within dae animations must assign param names and anim_ids according to the parameter a list of animation classes with parameters will be listed below. Also COLLADASaxFWL::LibraryAnimationsLoader.cpp in Opencollada framework can be referred too.
  6. Setting the channel->target is important. It should be set to the <id of the exported object>\<parameter sid(set in 1)>

That's it for export.

Import

  1. If the sid addressing and channel->target is set correctly, then Opencollada SAX FrameworkLoader will identify and make animation lists, which have a list of Animation Bindings which binds Animatable parameters to their respective animations.
  2. writeAnimations will make f-curves using Animation tags and write to curveMap. No additional work there.
  3. writeAnimationList will assign AnimationLists to Anim_list_uid, animList map.
  4. In transformAnimationsNEW() ( Name must be changed ) each node is checked if they have animations.
    1. Transform Animations were already checked by checking node->transforms.
    2. For other objects, the object is taken by referencing FW_object_map, which maps object uid's with COLLADAFW objects. The uid is taken from instanceUrl in node.
    3. Each animatable parameter of Object is checked if it points to AnimationsList, written in by writeAnimationList() before.
    4. If so set the respective parameter animation flag in animType to 1.
  5. Check each parameter animation flag bit in animType variable to see if the object parameter is animated.
  6. if animated get the animation list->animation Binding-> animation id and get the set of f-curves for that animation id from curve map.
  7. Assign f-curves to object according to the animation binding -> animation class.
  8. Thats it! If all goes well, the exported parameter animation will be recreated when imported.