corrective shape key script for 2.5

Hi all,

i merged and converted two old scripts, to let you make corrective shape keys. The first script was created by Tal Trachtman ( and the second one i believe was done by brecht. That one works with any combination of modifiers, but it is very slow (like 3 minutes for a char with 4000 points). The other one works only with objects that have no more than one amarture.

Here is the script:

I made a quick youtube demo (sorry for the bad quality) Link
And an example blend: Download (install the script and hit alt+p to see if it works correctly)

The script is now in the blender wiki repository: Link

How to use:

  1. In the user preferences click “Install Extension” and select the downloaded file. It will be copied to you scripts folder. You can also simply create the “extensions” folder in your scripts directory and copy your file to it if you want.
2. Select a posed character object and click on “Duplicate and apply all” in the modifiers panel. This will create a copy of the mesh that you can edit/sculpt.
3. Select your sculpted copy and then the character object. Click on the little black arrow in the shape keys panel and choose one of the options shown in the image above. If you are using no more than one armature choose the faster method.

If all went right, your character (or whatever) should have the new shape key for your pose.


Just updated the script again.
Fixed a bug that eats lots of your memory
Now the active shape key will be replaced/updated. If you want to create a new one, select the first key (“Basis”)

Hmmm… something isn’t working right here.

When I follow the steps and try to transfer a quick sculpt, this is what I get:

Any ideas what i might be doing wrong? (I can send you the blend file if you want to take a look)

EDIT: Fixed now, so gross and ugly picture of bad deformation is removed)

oh well… :eek:

I had a similar problem before when i had removed an armature, but the vertex groups remained. After removing them it was working. And maybe you have to normalize all groups. Other than that i don’t know. Does it at least work if you clear all weights and use automatic skinning? (Select all verts, Ctrl G, Remove from All, Remove from All Groups)

Can you also test this example file, you only neet to hit alt+p: Link

edit: yes, please send me the blend via pm, i will figure out the problem

Does this work if I edit a mesh in other aplications, like ZBrush?


I think so, but have not tried. As long the vertex count and order stay the same, it should work.

It should, as long as you don’t change the geometry. In the 2.49 script of becht, I can do that… which is part of what makes this oh so cool!

LooLarge: Sent you PM

The problem in that case what that the armature had translation other than zero. The armature needs to have zero transforms. You can just hit Ctrl+A to apply the translation, i made a test and afterwards it worked fine :slight_smile:

YES! That worked. Hmmm… .wonder how the translation happened?

Anyway, this is a Godsend, thanks.

BTW, as I mentioned, these shapes were modified in Silo. So, that opens up the workflow quite a bit.

Here’s what I did:

  1. Added poses to move arms into extreme positions. Copied mesh in extreme position and exported as an OBJ.

  2. Opened OBJ in Silo. Made my corrective blend shapes in Silo (using soft selection tools, etc.).

  3. Saved modified OBJ back out.

  4. Imported modified OBJ back into Blender.

  5. Applied the object as a Shape Key using your script.

So, no reason you couldn’t go into Modo, LightWave, 3DCoat… whatever. As long as you don’t change the mesh geometry (ie, add a subdividion, create a new edge loop, etc) this should work with any app.

Very cool!

[PS: A caveat, my experience in 2.5 Object import/export has been spotty. Sometimes I need to use 2.49 to export it out, and then import in and create a .blend file that 2.5 can append from… But this should get better with new builds]

I’ve always felt that Blender needs a way to choose and blend shapekeys in a much more intuitive way.

It struck me the other day that you should be able to have a set of shapekeys where the name of the shapekey locates it in a 2 or even 3 dimensional matrix of shapekeys. For example, if you had a bone called ‘mouth’, then you could have perhaps a set of keys called mouth_rotx0_roty0, mouth_rotx30_roty0, mouth_rotx_0_roty45, mouth_rotx30_roty45. Blender would then interpolate as the mouth bone rotates from 0 to 30 degrees in the x direction, and 0-45 degrees in the y direction. Ideally it should be possible to add extra shapes in between these to correct for odd deforms.

Being able to do this would solve all the nasty shoulder deforms and facial deform problems that occur as things are bent and twisted simultaneously. Obviously, to work, you would need to be able to use translation, rotation, and scaling for any of up to three things, and the program/script would then have to find the nearest shapekeys in a 3d space and interpolate them. Missing shapekeys would have to be interpolated from their nearest neighbours, so you wouldn’t have to model every possible shapekey in a matrix, only those that had meaning.

This differs from the current ‘additive’ process, which really cannot work for complex translations. In the exmple above, you would currently have a ‘base’ equivalent to mouth_rotx0_roty0, and two for the two rotations, but no way to force Blender to use the mouth_rotx30_roty45 shape, which would be created by simply adding the other two together, which may cause more of a distortion than you were trying to correct for in the first place.

Anyone think this is possible and would like to try it?


WHOA!!! anisulp in 2.5!?! AniSculp is one of the tools I’ve been waiting to have added to 2.5 before I move my modeling work to it. Thanks for updating the code, I’ll be checking this thread more often :slight_smile:

Thank you LooLarge!!! I hope the un-finished PyApi isnt going too hard on you :wink:

I installed the script, enabled the gear, then clicked the “duplicate and apply all” button after my modifier, but nothing happens and I get the following console error:

"[0x0-0x789789].org.blenderfoundation.blender[37923] Error, region type missing in - name:“Node”, id:16 "
the following error prints 12 times in a row in the console

OSX build #27211 - 64bit

Just updated the file, there was a small syntax change in the python API. This should fix the error.

Thanks a lot Loolarge! it’s so usefull for me :slight_smile:


:slight_smile: testing time, thanks Loolarge

Thanks, Loolarge!!!

It was broken again, because posebone “channel_matrix” was renamed to “matrix_channel”. I updated the script again, so now it will work only with the latest svn ( r27966-ish and up)

thank you for the update. this script is an often used tool in my workflow :slight_smile:

Was broken and fixed again :slight_smile: Link (same as on first page)

Just updated the script again.

Fixed a bug that eats lots of your memory
Now the active shape key will be replaced/updated. If you want to create a new one, select the first key (“Basis”)