[SOLVED] Merging AnimComposer's is it possible and how?

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:

  1. Import base model with the FBXImporter, which will contain the old AnimControl and Skeleton.
  2. Convert the AnimControl to the new AnimComposer using the utility class: AnimMigrationUtils.migrate(spatial);
  3. Select the fbx file that contains the real animation.
  4. Convert the AnimControl to the new AnimComposer using the utility class: AnimMigrationUtils.migrate(spatial);
  5. Now I have 2 AnimComposer’s. How can I add the actions/animations of the second one to the first one?

Any help will be appreciated.


From my past experience with animated FBX in JME, I would recommend avoiding FBX if possible, and use Gltf instead.

Regarding step 5, IIRC Wes Library already has a utility method for that.

Thanks. Do you have a repo url or example for me?

1 Like

Here it is

1 Like

Thanks you.


Wes is great for editing tracks and clips.

Copying clips from one AnimComposer to another, however, is trivial and doesn’t require Wes:

for (AnimClip clip : composer1.getAnimClips()) {

The only caveat is, you need to ensure the names of the clips don’t conflict.

1 Like

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.

1 Like

Good point.

So @ndebruyn should retarget each clip by invoking AnimationUtils.retargetAnimation(AnimClip, Armature, Armature, SkeletonMapping, String) with a very straightforward SkeletonMapping.

And Wes is useful here after all!

1 Like

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?

1 Like

No worries.

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);

So if the bone names differ for some or other reason this is where I set it up and map it?

1 Like


1 Like

Thanks @sgold this worked for me.

1 Like