Blender loader constraints refactoring

Hello to all blender loader users :slight_smile:

I’ve just made quite large constraint system refactoring. I made it because constraints were breaking the loading too often.

The computations might yet not be perfect, but I prefer to improve them with small steps rather than in one large.

If someone comes accross problems with loading models that has constraints please post here your blend file. The more examples I have the better.

And just a short summary of the changes if someone is interested:

  1. Constraint type separated from constraint logic.

    By constraint type I mean: bone constraint, node constraint, lamp constraint, armature constraint and light constraint.

    By logic I mean the type of calculations: LocLimit, RotLimit, LocLike etc.

    This shoud make the implementation more easy to develop since one computations are made for every kind of object they apply for.
  2. Support added for Light and Camera constraints. (they use SpatialConstraint just like Meshes).
  3. Armature constraint is now noticed …

    … but not applied because the Skeleton class has no transform that could be constrained.

    Noticing this constraint prevents loader from crashing when used applies constraint for an armature.
  4. Animations are added for static objects whose constraints target the moving ones.

    If you apply a constraint on an object without animation and it targets the object that moves, then blender automatically animates

    the constrained object even if it has no traces. Such situation caused loader to crash so now the static objects are given animation

    that simulates their constrained movement.

    Take note that when you want get the result working for objects you will need to play all objects’ animations and not only the one that

    has it applied in blender.

    As I said above the computations might not yet be fully errorfree but this is not the point of these changes.

    Submit any problems you get:)

    I’ll now focus on bugfixing.



This is pretty awesome :open_mouth:

I’ve been trying to load some of my old models again and actually encountered some issues with this one:

This is a very glitchy/buggy model so its always good to test against it when you change stuff, maybe some new part of it will start working xD

As recently, I’ve done a lot of facial animation which involve StretchTo constraints. Now I have to export to Ogre and it a painful and unstable progress. So , is that supported yet? Still wait for it to show up


I have fixed the problem with the exception: “IllegalStateException: The given texture must be triangulated!” .

And I am familiar with this model. I saw the mispositioned vertices before. Try removing the hair from the model, it helps :smiley:

It is not the solution of course. I’ll let you know when the problem is solved :wink:


StretchTo is not yet supported. I think I could implement it by modifying scales of the object, bone or other stuff. I’ll let you know if I add support for this one :wink:


Next step IKContraint? :smiley:

that’s not trivial though…you’re gonna need the same IK solver than blender…