Copy and paste animation keys between objects?

Hey guys,

I feel like a total noob for asking this but I can’t work out how to do it:

I simply want to copy the shape keys from OBJECT-A into the shape key channels of OBJECT-B. I’m using the latest 2.55 build and i’m only able to copy and paste keys within the same shape key channel.

Is there something i’m not doing correctly or is this no possible in Blender?

Cheers,

Simon

Not sure if this is what you want but you can copy shape keys from one object to another. They have to have the same vertex count/order or it won’t work or you get weird results. This was using a recent build, not the old official 2.55beta
http://www.screencast.com/users/blenderwho/folders/Jing/media/7118d8a6-5079-4b0d-a433-ec1bd69f5f40

Hey Richard,

Thanks for your reply, very cool trick you’ve supplied there but it’s not exactly what i’m after.

To go into a little more detail I have modeled and animated a piano keyboard using shape keys for each piano key. Now the intial model I animated is very low poly so I built a higher resolution model and created identical shape keys to the low poly version.

So what I want to do is copy the animated keys (while in the dope sheet or graph editor) from the low poly piano to the high poly piano. I’ve tried everything I can think of but it doesn’t seem to work.

I can easily copy and paste the location, rotation or scale from one object to another but shape keys don’t want to copy and paste between different objects.

Has anyone encountered this problem or has a working solution?

Cheers :slight_smile:

Hi, first create the tracks by inserting a keyframe for each shapekey, also make sure the key names are the same as in the other object… then you can try the copy / paste icons instead of the keyboard, or go to the f-curve editor where pasting should work too…

In theory (cannot try it right now) if the shapekeys are exactly the same names i would expect that you can simply set the second mesh to use the same action as the first mesh… doesn’t that work?

Hmm help me get my head around this . you have a keyboard object with shape keys for each depressed key? Hmmm interesting think i would have gone armature anyway…I’m thinking you have put some work into animating your low poly … Mozart, Liberace?.. hence your desire to get this going. That’s what we are looking at isn’t it shapekey value curves as opposed to shapekey shapes??

In a previous post I showed you how to drive this with drivers and a controller object which drives all the shapekeys with custom properties. Your request for a script got me thinking.

Sooo… Here is a script that adds a shape key driver on a destination object using the shape key values from a source object… It assumes you have shapekeys of the same name on each object… otherwise it’ll prob throw an error…


import bpy

source = bpy.data.objects["Cube"].data.shape_keys
dest = bpy.data.objects['Cube.001'].data.shape_keys
for x in dest.keys :
    key = source.keys[x.name]
    x.driver_remove("value")
    if key.relative_key :
        fcurve = x.driver_add("value")
        print(x.name+":"+source.name)
        driver = fcurve.driver
        driver.type = 'SCRIPTED'
        var = driver.variables.new()
        var.targets[0].id_type = 'KEY'
        var.targets[0].id = source
        var.targets[0].data_path = 'keys["'+x.name+'"].value'  
        driver.expression = "var"

This script seems to do the trick. I added a blend with it in action. I set up a cube with shapekeys and then copied it. Keyframed in some wobble on the Cube and ran the script. Didn’[t bother with any active/selected object stuff and just hard coded in the names. Change the source and destination from Cube and Cube.001 to match your objects… I’m assuming you have the same names for shapekeys on both pianos. Was hoping i could just change the keyset between objects but not sure if that can be done. Any chance of you posting a demo animation?

Hope this helps.

PS… Loolarge, Not sure how to do this with action editor and after trying couldn’t get back to the animation. The yellow and green for the keyed values also dimmed? … does it have something to do with keysets?? . Almost signed up to your slave post…

PPS… Finally noticed my “compress files” checkbox… sorry about the filesize

Hey batFINGER,

Sorry it’s taken me so long to check out, been very busy at work. That script is absolutely awesome! Thank you very much!

Gotta say I really love the Blender community for such excellent and friendly beginner support.

I will clean up my scene and post it for you to have a look at. It’s quite messy at the moment :wink:

Thank you again for your help batFINGER, I really appreciate it!

Cheers,

Simon

Pleasure mate, thought it would do the trick.

Applying it to my properties and driver principle…Now I can use one object to keyframe my whole scene, armatures shapes whatever can be driven. I like the convenience of having all the sliders in one spot

I think by 2.6 they’ll have sorted it out so you can interchange keysets. I think that is where the problem lies in copy paste with shape key fcurves.