[ADDON] Shape Keys Presets

[U][B]Latest version Blender 2.71 : 0.8.0 - 03/08/14
Latest version Blender 2.69 : 0.6.5 - 25/03/14

Download :

For Blender 2.71 and above : SKPresets_0_8_0_03_08_14.zip (13.1 KB)
For Blender 2.69 : SKPresets_0_6_5_25_03_14.zip (28.8 KB)[/B][/U]

pic for blender 2.71

0.8.0 : Some category bugs fixed
------ Rename your presets directly by double-clicking on presets names

0.7.2 : Apply error solved
0.7.1 : Export bug solved
Hey guys, so here’s the 0.7 version of the addon, ready for 2.7 tabs !
I wasn’t sure if I had to put the addon under the “Animation” tab, so just tell me what you think about it.
The intproperty numbers (the number “6” on the picture) behave weird (alignment to the right), don’t know if this can be changed.

Anyway, no big functionality changes in this update, I’ve just removed the ‘various’ category thingy, you should export then import back your presets to get the things go right (this will automatically update your presets, but to be sure just backup your blendfile).
The readability on the export .txt file was improved a little bit again.
As usual, I could’nt test all the situations, so just report any bugs here!

Thanks! :yes:

PS: this post got really messy, I think I’ll clean it up soon and just put a video explaining the whole thing.


Version : 0.6c - 08/09/13

Bug Fixes & Tweaks :

  • Presets not displayed within chosen category got automatically unapplied.
  • “Invert selection” / “Select all” functions little tweaks
  • Various code optimizations

Update 0.6b Features :

New Features :

  • Categories implementation to manage your presets
  • Possibility to set category for multiple preset at one time

Bug Fixes & Tweaks :

  • ‘Update’ function in the small menu to make your previous presets compatible with the new version
  • Current influences and checkbox states are saved during export
  • In the export .txt file, don’t change variables starting with underscore ‘_’.
  • 0.6b fixes : if name category is empty, name category is set to ‘<empty>’. A new preset has now ‘<empty>’ as category by default. All properties are effectively unregistered when addon deactivated.

How to set categories :
-If you’re using a file with old versions of the addon, you first need to use the ‘Update’ tool in the small menu to make the existing presets compatible.
-Set a new category name in the middle field; when validated, the category is assigned to highlighted preset only.
-The button at right applies the name for checked presets. Combine both methods to manage your presets.


Update 0.5b Features :

  • Export .txt files readability improved, corrected in 0.5b
  • Single Row/Gentle and Multi Row/Gentle respectively for only active / multi checked presets
    (Multi buttons appear only when 2 presets at least are checked, otherwise, with single buttons, only the highlighted preset is applied, even if a checkbox is checked somewhere in preset list)

Bug Fixes & Tweaks :

  • When ‘Sort’ function for presets was used, all checkboxes got unchecked and all presets influences were set to 1. This is now corrected.
  • ‘Select all presets’ checkbox didn’t update when all presets were selected/deselected manually
  • Error message when shape keys sorted in edit mode (the icon is now simply desabled while editing mesh)
  • Addon wasn’t unregistered fully when unchecked (some properties remained)

Update 0.4 Features :

  • you can adjust the level of the group mode (set the number of letters you want for a group)
  • Invert selection of presets in the small menu
  • A “Sort” button to sort shape keys - minus the first shape (Basis); the “Sort” function in the menu is for presets.
  • Various layout optimizations

You’ll find all shape keys quick tools at the bottom of the panel!


Update 0.3b Features :

  • possibility to check multiple presets and insert keyframes for all selected presets simultaneously.
  • you can add a preset with all shape keys at value 0, named “All_to_0”.
  • by checking “Use Group Mode” you can now create presets using shape keys “of the same group”, no matter what their values are. The script uses the 3 first letters of the shape key name to recognize a group.

Example :

EYE_wide_open_L
EYE_wide_open_R
MTH _o
MTH_ai
MTH_u
MTH_bmp

If you set MTH_o to 1 and create a new preset with “Use Group Mode” checked, the preset registers :

MTH _o to 1
MTH_ai to 0
MTH_u to 0
MTH_bmp to 0


Update 0.2 Features :
-preset influence values : you can adjust the influence of the presets for even more combinations
-“insert keyframes” button : the shape keys current values of selected preset are registered in keyframes for animation purpose.

/!\ Please don’t use the right click menu option “insert keyframe” for now - still need to be modified
/!\ Different presets can influence the same shape key value. Please consider this before clicking on “Insert Keyframes”. Shouldn’t be much problematic since you still register what you see on screen.

Adjustments :
-“Apply Raw” button : Set automatically the influence of selected preset to 1, and set other presets to 0.
-“Apply Gentle” button : Set only the influence of selected preset to 1.
-“Reset button” : Set all preset influences to 0.


If you just need the basic version (without keyframes and preset influence values):
Version 0.1 : [ATTACH]240515[/ATTACH]

Main List :
1 - Set your shape key values as you want.
2 - In Shape Key Presets Panel, click on “+”. A new preset is registered with the shape keys you used.
Note that shape keys at 0 or muted are not registered in preset.
In the pic above, the preset “chair” contains data for “pyramid”, “spiral” and “waves” shape keys.
3 - Rename the preset with the name field above.
4 - Click on “-” to delete selected preset.

In the small menu :
5 - You can export your presets and import them in text files. Note that importing presets erases all your current presets.
6 - The “Clean” option allows you to automatically delete registered values in preset that don’t exist anymore (if original shape key has been deleted or renamed). Totally empty presets are deleted too.

Apply buttons :

7 - You have 2 ways to apply your preset :
RAW - Your preset values are applied to shape keys, and shape keys that are not concerned by the preset are set to 0.
GENTLE - You preset values are applied without changing other shape key values.

Shape Key Quick tools :
8 - a few quick tools to manage your shape keys more efficiently.
Reset : Set all shape key values to 0.
Mute : Mute all shape keys except the first one.
Unmute : Unmute all your shape keys.

Limitations :
If a shape key has its name changed, the name in presets doesn’t update - I even don’t know if it’s possible without changing the original shape keys behaviour… (?)
If you really need to change the names in your presets, the only way atm is to export the presets and edit the .txt file manually, and import them back.
It can be very tricky if you need to switch names between shape keys.
The best recommendation is to do your presets with definitive names for your shape keys.

Of course, if you have suggestions, corrections, ideas or bugs (:(!!!) I would do my best to improve this script.
All your remarks are welcome.

1 Like

Can you give a practical example of usage?

Sure :slight_smile:

Example :

You have a character and you want to animate its face with the use shape keys.
Ideally, you have one shape key for each part of the face, so you can combine them to get the expression you want.
-Eyebrow_up_L
-Eyebrow_up_R
-Eye_close_L
-Eye_close_R
-Eye_wide_open_L
-Eye_wide_open_R

If you want to create an expression of surprise, for example, you’ll set the following shape keys

-Eyebrow_up_L
-Eyebrow_up_R
-Eye_wide_open_L
-Eye_wide_open_R

to value 1 and set other shapes to 0 or either mute them.

If you don’t want to create a new shape key from mix, considering you’ll need these settings as a basis for more detailed expressions later, you can register the current values in a preset to get your “surprise” expression back quicker than changing values again manually.

So basically, using the preset will automatically set the shape keys to the right values and :

  • if you choose APPLY RAW : set other shape keys -not used by your preset- to 0
  • if you choose APPLY GENTLE : unused shape keys are unchanged, with the idea of combining different presets (for face, legs…)

Hope it helped a bit. :yes:

Hey, this will come in handy, thanks! I was using the “create new shape key from mix” till now, but this is definitely a better solution.

I’m glad this script can help someone :slight_smile:
Feel free to report any bug or suggest any improvement.

Thank you! Very helpful script.:yes:

You’re welcome. :slight_smile:

Maybe I am wrong, but animation do not work ( auto keyframe)

You’re right, the tool wasn’t created to be used directly for animation.
It’s basically a shortcut to store and test many shape keys combinations.

But it could be an interesting improvement, i’ll try to implement that :slight_smile:
Thanks for your feedack !

Yes, Shape keys presets will be very good solution for animation. One click and everything is done. Thnx!

Hi, here’s version 0.2 with some improvements -check 1rst post for update.
Couldn’t test new stuff in all situations, so I’m waiting for bug reports -I’m prepared lol- and for usability suggestions !

Nice work! Insert keyframes are working.

I tested it with three presets and here are some results:

A - Insert keyframe create key for selected preset only ( value 1). Others are ignored. ( keys are created for every shape keys, which are in custom preset)
It is ok, but here is a little problem, for good animation you must select other presets or shape keys also and insert keyframes (value 0) again, again… It is time consuming way. System should set keys for every presets at once, not for selected preset only(?). Value 1 for selected preset, 0 value for not selected presets ( or shape keys, which are not in selected preset). I hope it is possible. If you have lipsync presets - ai, o, u, bmp… you need value 1 for ai and value 0 for o, u, bmp.
( check box - insert keyframes for all shape keys ? If not checked, insert keyframes for selected preset only)
note - if you have lipsync presets from various shape keys, it is possible to export and import it in the next time. Very helpfull. Blender Shape Keys have not this ability. (Groups of shape keys are missing also).

B - if I created base preset with zero value of all shape keys ( it is the same as Basic shape key) - insert keyframes do not work. Nothing happend. It is not necessary, we have reset button. But if you want keyframes with zero values, you must select other preset not base preset. ( zero key is created for selected preset only)

C - auto keyframes do not work. It is not problem, we have insert keyframes button.

D - If you want bring preset 01 and preset 02 together - apply gentle button - you must insert keyframe for first and second preset both. It is not possible set “apply raw” for first and “apply gentle” for second preset and “insert keyframes” at the end. Keys are created for last selected preset (gentle) only.

Have nice day!

Thank you for all your observations :slight_smile: This helps me a lot.

A - I’ve thought about this so I’ve implemented a checkbox “Use Group Mode”. Basically, when checked, the preset registers all shape key values of the same group. Groups are established by the script if the name of shape keys begin with the same 3 letters.

For exemple, the following shape keys:

EYE_wide_open_L
EYE_wide_open_R
MTH _o
MTH_ai
MTH_u
MTH_bmp

will belong to 2 groups, EYE and MTH.

So if you set MTH_o to 1 and create a new preset with “Use Group Mode” checked, the preset registers :
MTH _o to 1
MTH_ai to 0
MTH_u to 0
MTH_bmp to 0

Other example : setting only EYE_wide_open_L to 1 and MTH_ai to 1 will register all 6 shape keys values, as each one belongs either to group EYE or to group MTH.

With “Use Group Mode” unchecked, you go back to the original behaviour where only shape keys with values different from 0 are registered, so in our first example only MTH_o to 1, and in second example only EYE_wide_open_L to 1 and MTH_ai to 1.

I’m not sure if this method will help you but I’m waiting for some feedback :slight_smile:

B – Yes it was impossible to create a preset with all shape keys set to 0, since, as mentioned just above, we needed some shape keys with values different from 0 to get something in preset.
This is corrected in 0.3 update, the preset with all shape keys at 0 is now created with the default name « All_to_0 ». This preset is unique, and is automatically overwritten by a new one of same type.

C – context menu still needs some tweaks ^^’

D – You can now check presets that you need and insert them in keyframes at the same time. Hope this will work fine :wink:

The checkbox « select all presets » helps you select/deselect all.
Note that it doesn’t select the “All_to_0” preset.

You’ll find all files in first post.
I’m waiting for your feedback guys, and thanks again krokodil for all your precious observations !

Sorry guys, there’s a little bug in the 0.3 script, updating the corrected version 0.3b in a few seconds.

[EDIT] : Done ! :slight_smile:

Nice work! All blender people love you… :-))

Suggestion: saving place
Maybe it will be better (?) to put checkbox “sellect all presets” after checkbox “use group mode”. Two checkboxes together.
Text should be “Group Mode” + “All presets” or “Group Mode” + “All”… (for instance).
But it is not necessary, it is idea only, actual version is ok. Thnx!

I tested it and it works very good. Animation with this tool is very comfortable. Again: nice work!
What will be your next script, Mominou?

more conpact version of UI - old - new

:slight_smile:

Hey that seems good :slight_smile:
First thank you for all your compliments, I’m very glad this addon could improve some blender workflow.
I’m preparing a version 0.4 with some adjustments in layout and a few usability tweaks such as :

  • no need to check the preset checkbox if you only need to insert keyframe for active preset (only if no other checkboxes are checked)
  • possibility to adjust the group mode (choose the number of letters to set a group) - that’s too bad I put the value just next to ‘Group Mode’ :frowning:
  • lighten the layout
  • some code optimizations

Keeping only the ‘All’ check box is a good idea, but now I have some space to fill with another option, and atm I have no idea of what to do… an “invert selection” check box ? I’m not sure if this will be very helpful… If you have an idea I’ll consider it ! :slight_smile:

Concerning a next script, I don’t know yet, I started this one because I really needed to manage all my shape keys.
'Till I get a new inspiring idea, I think I’ll try to keep this one working and up to date with new blender versions :slight_smile:

A
put “invert selection” to black triangel menu (import, export…)
It is not problem, If the function is not very frequent.
please, keep Ui clear for daily work.

B
Or use ( instead checkboxes) small buttons with short text ( G = group, A = all, I = Inverse…) like buttons in the menu header (snap, manipulator…) ? Icon buttons is good way.

Icon tools has icons buttons. (Image)

C
Inspiration:

Problem of Blender is TEXT. We are hunting functions with scrollbars.
Maybe we will switch to icons in the future. ( or combinations text+icons)
Maya has script POSELIB. It is for animation poses. But shape keys should by organize by this way also.
http://seithcg.com/wordpress/?page_id=19
Images of shape keys for quicker work. ( poselib for armature animation also )
You can study python script and mel script of Poselib. It is free for downloading.

Description:

PoseLib is being used in production throughout the world by feature animation studios and video-game companies.

It allows you to record a pose for any object in Maya (more precisely anything that has keyable channel attributes). Whether it is the hyper complex character rig you just created or a simple Nurbs sphere or a basic Lambert shader: You just have to select the object(s), hit the “Create New Pose” button, and a pose file is created in the relevant directory, along with the corresponding icon (a .bmp file).

Features:

  • Works on anything at anytime (no “character map” or specific rig layout or particular naming required).
  • You can blend between the current pose and the clicked one by holding down the ALT or CTRL key and clicking on a pose.
  • Lets you choose the icon size you like (from 32x32 to any custom size/ratio up to 512x512).
  • Works with referenced/unreferenced characters (you can even edit the namespace).
  • Lets you organize your poses by characters (e.g.: Babar, Tintin…) and categories (e.g.: Face, Body…).
  • You can rename, delete, replace or move any pose from any character or category.
  • You can quickly select the objects/controls that are part of a specific pose.
  • You can also remove, add or replace specific objects/controls in a pose.
  • You can apply a pose specifically to the channels selected in the channel box.

Some images of Maya Poselib