From BlenderWiki

Jump to: navigation, search

Shape Key Drivers

Shape Key Drivers
Generate generic shape key drivers for the active pose bone
UI location 3D View > Pose Mode > Properties > Shape Key Drivers
Usage Rigging, Shape Keys, Drivers
Version 1.5 Author(s) Koilz
Blender 2.70.0 License GPL
Category Rigging Distribution Extern
Note(s) _


Executable information
File name shape_key_drivers_15.py
Current version download shape_key_drivers_15.py
Python modules bpy, math
External Python Modules or dependencies _


Warning _
Links T41944
Known Issues Tested on 2.70a, 2.72tb1.


Description

The addon adds shape keys with drivers to the selected mesh + active pose bone, saves time rigging.
The addon can add shape key drivers for basic pose bone transformations.
Also, the addon can generate 'node based drivers' for corrective shape keys.
These type of shape keys are usually used to correct bad deformations on mesh objects when rotating pose bones.

Transform Workflow

3D View > Pose Mode > Properties > Shape Key Drivers

Workflow for transform shape key drivers.

  1. Select an armature bone in Pose Mode.
  2. Go to 3D View > Properties > Shape Key Drivers.
  3. Select the mesh to add shape keys to.
  4. Select the desired transformation.
  5. Press Generate Transform.
  6. Modify the shape key.

Nodes Workflow

Workflow for node based shape key drivers.

Generate Nodes

  1. Select an armature bone in Pose Mode.
  2. Go to 3D View > Properties > Shape Key Drivers.
  3. Select the mesh to add shape keys to.
  4. Press Generate Nodes.

This should generate a sphere of 25 nodes and 25 shape keys each with driver. When you point the pose bone to the node, this should set the corresponding shape key value to 1.00.

After pressing Generate Nodes, if you switch to Object Mode, the selected nodes can moved to a different layer by pressing M.

Note that the transition between shape keys work best when the bones Y rotation is locked. Rotation can be locked in the Transform panel. If using an IK chain, check the IK panel in Properties > Bone.

Modify Shape Key

  1. If using an Armature Modifier on the target mesh, enable the settings for the Armature Modifier, Show in edit mode, Apply modifier cage during edit mode.
  2. Enable Apply shape keys in edit mode, this setting is useful for when multiple shape key values are > 0.0.
  1. First pose the bone so it point towards the node you want to make corrective shape key for.
  2. Select the corresponding shape key (The value should be near 1.0).
  3. In the 3D view, switch to edit mode, move the mesh vertices to a better position.
  4. When done, switch to object mode.
Repeat the second set of steps for each corrective shape key.
When finished, to save memory, you can remove unused shape keys, though this is not required.
3D View > Pose Mode > Properties > Shape Key Drivers - (Picture from 1.0)

Nodes Examples

Addon not required to test.

File:SKD example.blend File:SKD example2.blend

Note, only some of the shape keys have been modified.

Versions

1.0 - shape_key_drivers.py - File download.
Generate Nodes
1.1 - shape_key_drivers_11.py - Right click, save target as.
Generate Transform
Mesh object ID was not being used, works now.
1.2 - shape_key_drivers_12.py - Right click, save target as.
Generate Nodes operator stopped working, works now.
1.3 - shape_key_drivers_13.py - File download.
Fix - Some classes were being registered on unregister.
Fix - Use mesh object from scene not data.
Mod - Driver variable uses space enum return string.
Mod - Rewrote node reparent code.
Upd - Transform value is added to the end transform shape key.
Upd - Mode is restored back to pose mode.
1.4 - shape_key_drivers_14.py - File download.
Fix - Gen nodes, error if pose bone had no parent bone, added warning.
Fix - Error when no mesh object selected, added warning.
Fix - Active shape key error when selected mesh was on hidden 3d view layer, fixed.
1.5 - shape_key_drivers_15.py - File download.
Fix - Removed node _0, its not required.
Mod - Moved properties to pointer property.
Upg - Scaled nodes based on bone length.
Upg - Show node names by default.