User skeletons (which is what the GUI draws) are updated lazily, because they are only used for visualization and export.
Access the skeleton through
- Code: Select all
human.getSkeleton()
instead of simply accessing the skeleton member, this will update the user skeleton (fit the rest pose to fit that of the base skeleton).
Furthermore, after changing bone.matPose (which is what setRotation does), you will have to call bone.update() (or skeleton.update() after changing a bunch of bone poses) to get the skeleton to actually update. Anyway, from your screenshot it appears like you might have already done that.
Note that skeleton management in MakeHuman is not that straightforward anymore since we have implemented the two-skeleton approach. You basically have human.getBaseSkeleton() and human.getSkeleton(), the base skeleton is the only one that's used internally, it's used for all posing. getBaseSkeleton() will always give you the default skeleton, getSkeleton() returns whatever you have chosen in the skeleton library (can be None if nothing was selected). This allows us to pose the mesh, even if no skeleton was chosen, and guarantees that the basemesh is optimally posed in its rest pose, regardless of the chosen skeleton.
It is only the base skeleton that has a pose in MH (its rest pose is always the A pose), whatever other skeleton you have chosen from the skeleton library is simply fitted inside the joint locations of the posed mesh (thus, contrary to human.getBaseSkeleton(), human.getSkeleton() will always be in rest pose, unless you manually add a pose to it).
You can change the pose of user skeleton, though. After updating the skeleton, its pose should be drawn (note, GUI tabs like skeleton library or skeleton debug -- the second one is in utilities and is a developer tool that can be enabled through Settings > Plugins and a restart of MH, you might like it -- only update the skeleton drawing when they get an onShow() event, of course you can invoke that event yourself, or have a look at the drawing code that is linked to it)
The skeleton drawing in skeleton library renders the user skeleton, though (however everytime you update the user skeleton its rest pose is fitted to that of the base skeleton, so visually there will be no difference as long as you select that same default skeleton as user skeleton). But you can easily create a plugin that renders the base skeleton.
Note though that changing the pose of the user skeleton will not modify the pose of the human, as it is skinned by the base skeleton only.
Depending on what you want to do, you might want to change the pose of the base skeleton instead.
If you are looking to skin the human by posing the user skeleton, then I recommend you clone the human mesh, grab the vertex weights of the user skeleton, and create a new AnimatedMesh object that links the user skeleton (or a copy of it) to the clone of the human mesh. Cloning to a separate object that you have full control of is easier and you don't run the risk of interfering with other MakeHuman mechanisms.
To see how you can clone the mesh and grab the user skeleton vertex weights for it, have a look at the Ogre3D exporter, it is the most straightforward implemented of the exporters and a good example of how the API works.
You can read more details about this implementation here
http://bugtracker.makehuman.org/issues/817Have a look at the commits and the commit messages linked to this issue for details.