blend shape from python

Hi,

I am sure this question has been answered before but I could not find it.

I have created 2 blend shapes and the Basis shape and now I want to add Bezier
Curves from a python script to animate them. I have an old script that did something similar.

Basically I just got the curves from:

dico_key[key.name]Blender.Object.GetSelected()[0].getData().getKey().getIpo().getCurves()[n]

and then added Beziers with
dico_key[name].addBezier(1,-1)

for some reason this has stopped working with the new releases. I have written this pre 2.3.

this is there error it gives me:
‘NoneType’ object has no attribute ‘getCurves’

I have added keyframes for each shape key but it still doesn’t work.

Does anyone have any ideas?

thanks.

I add curves to shape keys all the time.

Looks like the mesh key doesn’t have an Ipo object associated to it and you are not checking whether it really exists.

Before attempting to add curves I always use something like this:

if not mesh.key.ipo: # is None
    mesh.key.ipo = Blender.Ipo.New('Key','KeyIpo')

By the way, getKey(), getIpo() and addBezier() are all deprecated methods.