0
$\begingroup$

Like the title says, I've been learning how to use shape keys, and need to change the value differently based on my animation. But when I make one shape key animation it applies to all of my actions. Would appreciate any ideas on how to have separate shape key animations for each action

$\endgroup$
3
  • $\begingroup$ Alternatively to accepted answer: If two or more objects share the same mesh, they will share the same shape key animation. Go to the mesh properties, where mesh name is click the number to make the mesh a single user copy. $\endgroup$ – batFINGER Jul 23 '20 at 16:30
  • $\begingroup$ Thats not really the issue though, it's the same object in each animation. I just need different shape keys on the same object based on it's animation. Would that be possible? $\endgroup$ – Bobby B Jul 23 '20 at 17:51
  • $\begingroup$ Ok, think I'm with you now. One way is to drive a shapekey value with something on the object, eg a custom property or a pose bone. This way even the shape key animations will belong to the one object action. blender.stackexchange.com/a/164834/15543 Or use the NLA. $\endgroup$ – batFINGER Jul 23 '20 at 18:17
0
$\begingroup$

Drive the shape keys

Instead of keyframing shapekeys can drive them with a custom property on the object you are animating. Change and keyframe the custom property. Keeping you to a single action.

Example image, Basis and five keys on the Cube Mesh. Five custom properties with matching name are added to Cube object. These can be keyframed, and for default scene example will become part of the "Cube" objects "CubeAction" along with transforms etc.

enter image description here

From Python: drive a shape key with scripting

There is a script to set up the custom properties and drivers for you.

Converting Shapekey Action to Object Action

If you already have a shape key animation, this will transfer it to object action as custom properties.

Eg the cube has an action "CubeAction" The shapekeys are part of action "Key.001Action"]

The datapath keyframed for the value of shapekey "Key 4" is

key_blocks["Key 4"].value

will convert to a fcurve on "CubeAction" with data path to custom property "Key 4"

["Key 4"]

and copy over the keyframes.

Conversion script, change name of shapekey and object animation to suit.

import bpy

context = bpy.context

sk_action = bpy.data.actions["Key.001Action"]
ob_action = bpy.data.actions["CubeAction"]

for fc in sk_action.fcurves:
    data = [0.0] * 2 * len(fc.keyframe_points)
    fc.keyframe_points.foreach_get("co", data)
    dp = fc.data_path[len('key_blocks'):-len('.value')]
    ofc = ob_action.fcurves.find(dp)
    if ofc:
        ob_action.fcurves.remove(ofc)
    ofc = ob_action.fcurves.new(dp)
    ofc.keyframe_points.add(len(fc.keyframe_points))
    ofc.keyframe_points.foreach_set("co", data)
$\endgroup$
1
  • $\begingroup$ This is fantastic thank you. $\endgroup$ – Bobby B Jul 23 '20 at 22:05
0
$\begingroup$

I think you will need a different shape key animation for every action. To simplify this you can copy the shape key you already have.

It's sometimes hard to notice but you have to click the little downward pointing ">" icon. Make sure you have only the correct shape key activated by having its checkbox checked, and having the other shape keys unchecked (since the new shape key will be a combination of all the activated shape keys). Then have the Value set to the correct value (in this case 1), and then choose New Shape From Mix.

enter image description here

$\endgroup$
1
  • $\begingroup$ That's unfortunate but I guess I don't have much of a choice. At least I'll still be able to make modifications now, thank you for this. $\endgroup$ – Bobby B Jul 23 '20 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.