I’m currently working on refactoring the constraints system for blender loader.
The current version has some errors and is not good enough for many models.
But because blender is a huge issue and (at least now) has more features than jme allows, I will have to skip some of them
just because the implementation is not possible or would now be too complex to implement.
So my question is: how to constraint the constraints :). In other words what features could be skipped (at least for now).
Lest have a quick look at what blender offers.
- Constraints can be applied to: object node (containing mesh, ligh or camera, armature) and to bones.
- Constraints work for static objects (all kinds mentioned above).
- Constraints work for moving objects (bones and object nodes).
How the things look like in jme3.
- Objects are imported as follows:
a) object nodes: mesh → Spatial, Lamp → Light (different kinds), camera → Camera, armature → Skeleton
b) bone → Bone
In JME3 the classes: Spatial, Camera and Bone can have constraints applied, but the Skeleton cannot because it has no ‘Transform’. The same goes for some of the Lights (but not all).
So here are my first questions:
1. What should I do with Light constraints ?? Apply only to some of the Light descendant classes? Not apply to any? Wrap light into a Node an then apply transforms ? (the worst move in my opinion)
2. Should I apply constraint to camera ? Is it necessary ? Or maybe I should create an empty class for camera constraint logic that will not do anything and will be ready for future implementation (this is a nice way to prevent crashes when someone applies constraints to camera so I would prefer this one)?
- This one is not very troublesome. The only problems with this are mentioned above (not all classes can have constraints).
- Here is the difficult part. Blender loader creates two types of animation: spatial and bone animations.
Many of the constraints have target object specified. It means that the constraint uses the current transform of the taget object to modify the animation.
With static objects there is no big problem. Troubles begin when target objects are moving.
If the constraint’s owner have tracks I can try to modify them. If it hasn’t I create him non modifying tracks and then apply the constraint.
And this gives us the new bunch of questions.
1. Should I apply constraints for a bone that targets bone in a different skeleton ??
2. Imagine we have two cubes. The owner of the constraint is not moving and the target have tracks and can be animated (object animation). This will force me to add tracks to the owner and then apply constrains. But in blender when I play animation of the target object the owner is also moving (because it has been constrained). In JME3 when I play the target animation the owner will remain still unless I play his animation too.
Should I not support such situation ? Or maybe I should give a warning that to get the required result is to play both animations ?
If I have more questions I will definitely ask. If something is unclear (hopefully not everything ) please ask I will try to explain it in a different words.