Here's what I was thinking for Multiple Animations on a Single Model. The Ogre Exporter (at least for Blender) writes only the bones that are changed in an animation. So if I have a skeleton like with a bone hierarchy like this:
<bonehierarchy>
<boneparent bone="Hip_R" parent="Hips" />
<boneparent bone="Hip_L" parent="Hips" />
<boneparent bone="Chest" parent="Spine" />
<boneparent bone="Thigh_R" parent="Hip_R" />
<boneparent bone="Thigh_L" parent="Hip_L" />
<boneparent bone="Neck" parent="Chest" />
<boneparent bone="Shoulder_R" parent="Chest" />
<boneparent bone="Shoulder_L" parent="Chest" />
<boneparent bone="Shin_R" parent="Thigh_R" />
<boneparent bone="Shin_L" parent="Thigh_L" />
<boneparent bone="Head" parent="Neck" />
<boneparent bone="Bicep_R" parent="Shoulder_R" />
<boneparent bone="Bicep_L" parent="Shoulder_L" />
<boneparent bone="FootBase_R" parent="Shin_R" />
<boneparent bone="FootBase_L" parent="Shin_L" />
<boneparent bone="Jaw" parent="Head" />
<boneparent bone="ForeArm_R" parent="Bicep_R" />
<boneparent bone="ForeArm_L" parent="Bicep_L" />
<boneparent bone="Toe_R" parent="FootBase_R" />
<boneparent bone="Toe_L" parent="FootBase_L" />
<boneparent bone="Hand2_R" parent="ForeArm_R" />
<boneparent bone="Hand0_R" parent="ForeArm_R" />
<boneparent bone="Hand0_L" parent="ForeArm_L" />
<boneparent bone="Hand2_L" parent="ForeArm_L" />
<boneparent bone="Fin2-1_R" parent="Hand2_R" />
<boneparent bone="Thumb1_R" parent="Hand0_R" />
<boneparent bone="Thumb1_L" parent="Hand0_L" />
<boneparent bone="Fin2-1_L" parent="Hand2_L" />
<boneparent bone="Fin2-2_R" parent="Fin2-1_R" />
<boneparent bone="Thumb2_R" parent="Thumb1_R" />
<boneparent bone="Thumb2_L" parent="Thumb1_L" />
<boneparent bone="Fin2-2_L" parent="Fin2-1_L" />
<boneparent bone="Fin2-3_R" parent="Fin2-2_R" />
<boneparent bone="Fin2-3_L" parent="Fin2-2_L" />
</bonehierarchy>
And I'm doing a running animation that only affects the legs, then the exporter only exports animations with the bone it affects:
<animations>
<animation name="RunForward" length="0.640000">
<tracks>
<track bone="Hips">
<keyframes>
<keyframe time="0.000000">
<translate x="0.366474" y="-0.000000" z="1.050500" />
<rotate angle="0.273869">
<axis x="-0.000001" y="0.317320" z="0.948318" />
</rotate>
<scale x="1.000000" y="1.000000" z="1.000000" />
</keyframe>
<keyframe time="0.040000">
<translate x="0.271614" y="0.000006" z="0.713493" />
<rotate angle="0.201833">
<axis x="-0.000001" y="0.317522" z="0.948251" />
</rotate>
<scale x="1.000000" y="1.000000" z="1.000000" />
</keyframe>
More Keyframes…
</keyframes>
</track>
<track bone="Spine">
Blah blah blah…
</track>
<track bone="Thigh_R">
<track bone="Thigh_L">
<track bone="Shoulder_L">
<track bone="Shin_L">
<track bone="FootBase_R">
<track bone="FootBase_L">
<track bone="Toe_R">
<track bone="Toe_L">
</tracks>
</animation>
</animations>
Same for firing a gun, or throwing a grenade.
Then you set multiple animations that only animate specific bones by calling MeshAnimationController.setAnimation(); for each animation, like so:
animControl.setAnimation("RunForward");
animControl.setAnimation("ThrowGrenade");
If multiple animations transform a bone, say the root bone, interpolate the locations and rotations of the bones. The only problem with making multiple calls to MeshAnimationController.setAnimation(); is what if you want to cycle one animation, but not the other? Or if you want that IAnimationListener foreach animation you can't get it on a specific call to an animation. My suggestion is the setAnimation() method should return a new Animation object, such as:
Animation runForward = animControl.setAnimation("RunForward");
Animation throwGrenade = animControl.setAnimation("ThrowGrenade");
This way you could have callbacks for IAnimationListener, also set whether the animation should cycle or not, etc. It would be relatively easy to combine animations with code like:
Animation punchAndThrow = new Animation();
punchAndThrow.combineAnimations(punchLeft, throwGrenade); // Or maybe even put it in the constructor!
This is how I envision it. I sorta understand the basics of OgreXML importer and am guessing it really similar to other animation importers. What do you guys think?