Animation mapping in blender importer

Hey guys,

I have had thoughts about animation mapping in blender importer.
Some time ago I added a mapping between object and action to BlenderKey, to properly link actions with skeletons.
Unfortunately Blender does not map this directly because you might attach one action to several skeletons.
These actions will move every bone they have included - recognized by name.

This mapping added to BlenderKey is pretty awful and I do not like it.
So I think I could do it automatically - just tell me what would you prefer.

  1. Attach an action to every skeleton/object that has at least one name of the bone specified in its channels.

  2. Attach only exact matches - when the amount of action channels is exactly equal to bones in the skeleton.

  3. Attach the action to the skeleton that best maches the channel names.
    It means, for example, if the importer finds a perfect match it will not attach the action to skeleton that has less bones with the name equal to the action’s channel name.

We could then get rid of the action mappings and replace it with a single enum that could allow us to choose one of the options mentioned above.
And one option would be selected by default. I would choose the first one if you ask me :wink:

The rest will depend on the artist. He or she can, for example, use different bone names to ensure the actions match.

Give me your opinion about the issue. And write your own ideas of how to match action to skeleton/object.

I am aware that this is the third time I change the approach to the subject. And I am sorry about it.

What kind of mappings are you talking about? There should be only one AnimControl and one list of animations really, any function in Blender is none of our business and the importer should just create this one list from any available data. Theres enough confusion as is about animations not importing one way or the other, theres no need to add to this confusion by having different kinds of animations and controls.

OK, maybe I wasn’t clear enough :slight_smile:

I never said anything about functions in blender nor about different animations and controls.

I will try to explain it on an example.
Lets say you have a model of a person in blender. The model has armature. The artist prepared three different actions for the armature: walk, jump, sit.

What we would like to see in jme, is a model with skeleton that has 3 animations available named: walk, jump, sit.

The only problem is that blender does not keep the link between the armature and all 3 actions. One action, attached to the armature at the moment of saving the blend file, can be read directly. But the rest is not linked. They are in the blend file ready for use.

Now imagine you create a unit for the game. The unit is two goblins carrying a barrel with explosive powder (I have seen something like that in one game). So you will (for example) prepare a model in blender that has two objects and each of them will have separate armature.
And every armature will have actions: walk, sit, jump.

And here we have a problem because we cannot say which action is to be applied to which armature, because blender does not store this data.
That is why I added an explicit mapping to the BlenderKey, to give a hint how to combine aniamtion with skeleton.

What I would like to try, is to make it automatic. To simplify the job of preparing the BlenderKey, without the need of explicitly defining the links.

If that is yet unclear - please ask and I will try to explain.

Cheers :slight_smile:

I have tested the solution and it looks like working :slight_smile:

It would really make the using the importer much easier. The animations were imported automatically with no need to point them directly in blender key.
The only question is whether I should remove the animation mapping entries from blender key or mark them as @Deprecated ??

Tell me what you think about it guys.

1 Like
@Kaelthas said: I have tested the solution and it looks like working :)

It would really make the using the importer much easier. The animations were imported automatically with no need to point them directly in blender key.
The only question is whether I should remove the animation mapping entries from blender key or mark them as @Deprecated ??

Tell me what you think about it guys.

Did they go into a stable release or have they only existed on trunk?

If they are in 3.0.x then deprecate them. If they are only in trunk then just remove them.

@pspeed
I have downloaded the latest SDK and updated it today.
Blender key did not have the animation lists so I guess I can delete those.

The mapping entries in BlenderKey were added on the 13’th January 2014.
The only thing that is strange is that the latest stable release of the SDK was made on the 15’th of February 2014 and those changes are not visible there.

Did I mischeck something or does the SDK not use the latest library version available ???

@Kaelthas said: @pspeed I have downloaded the latest SDK and updated it today. Blender key did not have the animation lists so I guess I can delete those.

The mapping entries in BlenderKey were added on the 13’th January 2014.
The only thing that is strange is that the latest stable release of the SDK was made on the 15’th of February 2014 and those changes are not visible there.

Did I mischeck something or does the SDK not use the latest library version available ???

There are two branches. Trunk is where new development is done. The 3.0.x branch is where ONLY bug fixes go. Since this was not a bug fix, I would not have expected it to go there.

OK,
I pushed the changes.
Checkout and tell me if there are no problems with it :slight_smile:

I have deleted the animation mapping methods from BlenderKey as it indeed was not in the 3.0 branch.