利用者:Phabtar/Lights Parameters Animations
COLLADA Object Parameter Animation support
This is the procedure which is currently used to improve COLLADA support for Light parameter animations.
Export
- 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" ).
- Id if there are f-curves in the parameter in Blender. For example for color animations :
- If object is Lamp
- Get Lamp from object->data
- Get lamp->animdata->action->curves. Curves not empty object has animations.
- Get the curves from above validation technique. For each curve get animation name from fcurve rna_path.
- If the animation name equals the parameter to be exported call dae_animation() on the object.
- 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.
- 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
- 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.
- writeAnimations will make f-curves using Animation tags and write to curveMap. No additional work there.
- writeAnimationList will assign AnimationLists to Anim_list_uid, animList map.
- In transformAnimationsNEW() ( Name must be changed ) each node is checked if they have animations.
- Transform Animations were already checked by checking node->transforms.
- 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.
- Each animatable parameter of Object is checked if it points to AnimationsList, written in by writeAnimationList() before.
- If so set the respective parameter animation flag in animType to 1.
- Check each parameter animation flag bit in animType variable to see if the object parameter is animated.
- if animated get the animation list->animation Binding-> animation id and get the set of f-curves for that animation id from curve map.
- Assign f-curves to object according to the animation binding -> animation class.
- Thats it! If all goes well, the exported parameter animation will be recreated when imported.