Blender Plugin for Weighting and Shape Keys

MakeHuman python API, python plugins, etc

Moderator: joepal

Blender Plugin for Weighting and Shape Keys

Postby punkduck » Sun Sep 22, 2019 5:14 pm

Hi

In the last time I often tried to improve my characters by adding some shape keys, or doing better weights in Blender etc.

When I had a better solution for weights in Blender, I had no way to export them. Or a way to equip my other characters with the new features etc.

Of course Blender offers ways to do that without an additional plugin, as long as you do all this on a character which can be perfectly mirrored. So maybe the base mesh or an proxy (using the Wavefront .obj file).

But when your character was changed by MakeHuman itself this often does not work. What you do on the left side could not be easily mirrored to the other side, because the character is somehow not symmetric. I typical did some changes on my existing character in Blender and was quite unhappy, that I cannot export it to be used as an own weight file for an existing proxy mesh. Of course I have to do an mirrored version of the same change on the other side manually, because my character is not 100% symmetric, but that's not really possible, the change always differs then.

So should I redo this change on the base-mesh or proxy? Ehm ... no :cry:

So I implemented this idea: basemesh or proxy have one thing in common with your exported character: the vertex order does not change. So I can create a table of which vertices are right, left or in the middle. Btw.: You will find these values hardcoded in maketarget, where for each vertex a mirrored "partner" is assigned, but for me this was no option, because it was only available for the basemesh.

I also don't know, if the vertex is left or right side, when the mesh is used on a character produced by MakeHuman, as long as the table only consists of two numbers.
The advantage of the mirror table is: we can create these mirror tables from our base mesh and all proxies and can use them for further operations with all characters derived from that. Of course this only makes sense for symmetric meshes.

So I started to write python shell scripts in the beginning, they were used to create e.g. the weights for the bento-skeleton but also for Elvs Proxies. Meanwhile I learnt a lot about the blender API and re-implemented some of the functions in a plugin.

You can download the plugins from github, if you need it, there is a 2.79 and 2.80 version. I will support both for a while.

The plugin(s) for blender 2.79 wil be found here:

https://github.com/black-punkduck/MakeHuman-Helpers/tree/master/blender2_7

and for 2.80 here:

https://github.com/black-punkduck/MakeHuman-Helpers/tree/master/blender2_8

There is also a documentation in the wiki using the demo images from blender 2.79

https://github.com/black-punkduck/MakeHuman-Helpers/wiki/blender279weightplugin.md

Image

At the moment there are functions for
  • creating a mirror table
  • assigning a mirror table
  • using selection based on a mirror table
  • mirroring vertex groups
  • mirroring shape keys
  • saving MHW files
  • loading MHW files (e.g. for overwriting existing weights with those from the file)

maybe there will be more (like e.g. exporting and assigning shape keys only) in the future. Consider this as an alpha version, and yes, it is more for the advanced users.
User avatar
punkduck
 
Posts: 771
Joined: Mon Oct 17, 2016 7:24 pm
Location: Nuremberg, Germany

Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest