Animation from file with a different rig

Blitz3D Forums/Blitz3D Programming/Animation from file with a different rig

rgdyman(Posted 2011) [#1]
Hello to all once again.

I was wondering if there is a way to know if a loaded animation from a file belongs to the existing loaded rig.

Premise:
I have a mesh loaded in holding its own rig.
I then am able to press a "Load Animation" button and a window
appears displaying all animations I can load using the .b3d format.
You load it in and I have the new loaded animation appending to the mesh.

All works perfect.

Problem:

If I load in a animation that does not belong to the mesh the animation will not play. ( Naturally)

Is there any way I can do a "check" and make for certain that
the newly loaded animation belongs to the mesh so I can error out and display why this event will not work.

Hmm.. I guess I could check all the bones and if Matched then continue on else error things out ......

This might do the trick. Instead of just deleting this post and moving on I would like to post this question anyhow in hopes
to learn something new. Perhaps a routine I don't know of yet.

Thanks for any pointers/ideas!


Rob the Great(Posted 2011) [#2]
The only simple solution I can think of would be to set up your files in a way that you can check while loading if the animation should belong to the mesh.

For example, if you have your main hero, place that model in a single folder called "hero", and any animation files related to that model will go in the same folder. Then when you go to load the animation, run a routine to find out if the animation is in the same folder as the model itself. If so, then you know that the animation will work, and if it's not in the same folder, debug log it or throw up your own error message and never load the animation.

Another option would be to name the files using a common base name, e.g. the model could be named "hero_model.b3d", and the animation files would all begin with "hero_". When you go to load the file, check if the filename begins with "hero_", and if so, load it, if not, don't load it.

Aside from mesh hierarchy like the bone comparison you were talking about, I don't know if Blitz has a native way to check for problems like that. It might be possible to create a master bone or pivot in the modeling software and then give it a unique name, such as "HERO_MODEL". When loading the model or animations in Blitz, you could check if the file contains that specific name with the FindChild command to see if the animation and model match, but I'm not sure if that would work or not. A lot of that depends on how you actually load the animation. I assume you're using LoadAnimSeq() to do this?


rgdyman(Posted 2011) [#3]
Thanks Rob!

Yes I am using LoadAnimationSeq()

I am going to look into naming things directly associated with each unique
mesh and its animations to see how the pipeline runs.

Sounds smooth. Thanks!

I currently am directed to the folder that the Mesh was loaded from.
I was hoping for a direct return stating the file and mesh's rig are not of the same. :P But I dream a tad to high sometimes.

I'll need to sit back and rethink this and make sure I have all in order.
I do have a Bone type when loaded already. I may just run a function
of the b3d animation loaded and do a compare , If all bones do not match they must be diff rigs..