Hi all.
I am busy implementing an animation import feature into my editor and want to do the following.
I am trying to add the ability to import fbx file, with its skeleton and then give the user the ability to import each animation seperate because that is how these type of models normally get distributed.
These there the steps I do:
Import base model with the FBXImporter, which will contain the old AnimControl and Skeleton.
Convert the AnimControl to the new AnimComposer using the utility class: AnimMigrationUtils.migrate(spatial);
Select the fbx file that contains the real animation.
Convert the AnimControl to the new AnimComposer using the utility class: AnimMigrationUtils.migrate(spatial);
Now I have 2 AnimComposer’s. How can I add the actions/animations of the second one to the first one?
Note, a TransformTrack keeps a reference to the joint, so for copying it from one rig to another rig, all those references must be updated to the target rig joints.
So @ndebruyn should retarget each clip by invoking AnimationUtils.retargetAnimation(AnimClip, Armature, Armature, SkeletonMapping, String) with a very straightforward SkeletonMapping.
It does not work, or maybe I do not understand how the SkeletonMapping is suppose to work.
What is the SkeletonMapping and how do I get hold of a reference to it?
In this case, you construct an empty SkeletonMapping using the no-arg constructor:
import com.jme3.scene.plugins.bvh.SkeletonMapping;
SkeletonMapping map = new SkeletonMapping();
and then you populate it with bone mappings that describe how the bones (armature joints) in the target model relate to those in the source model. In this case, the mapping is one-to-one:
for (Joint joint : armature.getJointList()) {
String name = joint.getName();
BoneMapping boneMapping = new BoneMapping(name, name);
map.addMapping(boneMapping);
}