Associate separate .mesh and .skeleton?

I have two OGRE XML files, a mesh.xml and skeleton.xml, but they were created separately, so the mesh file doesn’t have a <skeletonlink> to the skeleton file. Is there any way, when importing the mesh, to force JME to process the skeleton file as well? Or is the only option to manually include a <skeletonlink> element in the mesh file?

I don’t think you’d be able to combine them anyway. If the mesh has no info about vertex groups that correspond to the skeleton then you cannot assign the animation properly. If the animation wasn’t made for the character it would deform the character strangely anyway. Using e.g. a humanoid “base” animation with some other character always needs retargeting which is not trivial. I the animation was in fact made for the mesh then just export them together properly.

Sorry, I should’ve said - the mesh and the skeleton are meant for each other. The original files I have (coming via Maya) have one model, and about 6 different animation files - any of which can be applied to the mesh. Unfortunately, the converter will only output something like :

Mesh A + skeleton A
Mesh A + skeleton B
Mesh A + skeleton C, etc.

I was hoping, either via the SDK or the API, to able to combine the mesh with any/all of the skeletons.

Edited to add :
To give more detail, all of the original files comprise about 12 meshes and the 6 animations. Each mesh can have any animation file used with it. Ideally, I’d like to export each mesh separately, and each skeleton separately, and then combine them as and when I need to. Is this possible?

@Vroomfondel this is not possible out of the box, but it is not impossible.

I am doing something similar where I have several model meshes using one skeleton, and the animations are shared between all the models.

In the picture below all dwarfs are based on the same skeleton, the elf has a different one. All models play the same animation. That means the dwarfs and the elves are currently using one anim file for the idle animation.

Each component is loaded/stored seperately.

meshes are stored in their own j3o file
animations in their own j3o file
skeletons in their seperate j3o files

By doing this I can use any mesh designed for the base skeleton to be shared with any model I would like, and play any animation for that base skeleton on any model I like.

You will need a coder to do something like that.

The easier way would be to add the skeleton link manually.

If you have a coder and want some details, drop me a line…

do you need 2 seperate files?
What I am currently trying is to link animations from one skeleton to another in blender.
If you link import stuff instead of appending stuff in blender its like a reference. So if you
change the animation in your main file it will automatically be available in your other files.
This way you dont have code anything, it also seems an easier approach.

ah ok,…

Then just merge all animation into one skeleton file, should do the same :slight_smile:

If you do the animation in blender, can you make one blender file containing all animations? Should be removing the need to do anything manually, if you scene has all animations in it. But this is a blender question, which I only use for static models, not having done animations in blender so far.

Perhaps someone with more blender experience could answere your question, or perhaps post it at a blender forum, how to merge animations into one file for export.

@ghoust, that sounds like the sort of thing I’m trying to do. A means of dynamically connecting and disconnecting meshes, skeletons, and animations at runtime would be ideal. I’d be very interested in seeing how you’ve solved that. No code if you don’t want, but the general technique would be useful to a lot of people.

@umask007, I currently have (limited) access to Maya since that’s the only way I can get the source files into a modelling program. I don’t think Maya has a facility to link animations, and besides I’d prefer an API solution since I’m more comfortable in code.

And @ghoust again, I can’t merge all the animations - they export to about 250Mb OGRE .skeleton files, which in turn expand (I have to expand, since I need to fix some of the files; I also had problems with the binary OGRE importer on 3.0RC2) to a horrifying 1.8Gb .xml.skeleton set of files. Bearing in mind that some of the animations are broken, some are duplicated, and some are superfluous, but that’s still a lot of data to attach to each mesh.

(Just noticed which almost has the answers I need).

Anyway, I’ll have a think about this - I haven’t really delved into the API, and I was hoping someone else had encountered and solved it, or if it was a feature of the SDK that I’d overlooked.

What’s the rationale behind the SDK combining mesh+animation? Was there a reason not to keep them separate?

A j3o file simply stores the whole scenegraph, I guess thats the “reason” if you can call it that ^^

@normen said: A j3o file simply stores the whole scenegraph, I guess thats the "reason" if you can call it that ^^

Fair enough. I’m coming from J3D, which did the programmer no such favours!

@Vroomfondel No problem with sharing code, just was not sure if this would help you out. The code can be found in the l2jserver-client repository, there is a patch file for the jme engine revision, which is updated from time to time, so you can apply it to a checkout and see if it gets you going.

Basically have a look at the changes used to the com.jme3.scene.plugins.ogre files (which will create npe when you just load a skeleton file containing animations only) for loading (not all will be relevant, some minor naming, location fixes would not be relevant in your case)

Then have a look at the com.jme3.anmation changes. Basically it extends animations of bonetracks with name storage of the animation names, and later on doing a fix to the bonetracks to “rewire bones” of the anim to the skeleton indices). In addition the code uses an AnimationProvider interface for animations. One imlementation is provided, a hashmap animation provider. The idea here is to have the animations decoupled from the AnimControl to be able to reuse them, which is normally fed by the OgreLoader. So basically the AnimProvider could also be a place where animations are streamed in on demand.

For examples on how to use the stuff you can have a look here for loading and using the model data (compileModel Method):
The compiler is used on my ogre mesh files, skeletons and animations and splits them into seperate j3o files, to get an idea what to do with it.

In your case where you have serveral skeleton files I would load them all, write out one skeleton, and the store each animation as one j3o file.

By the way your anim files seem a bit big :slight_smile: Perhaps you can decrease their size by having smaller sample rates?