如何在Blender Python中为ShapeKey设置一个值?

时间:2010-06-23 19:34:52

标签: python 3d blender bpython bpy

我设法使用以下方法从Python插入Shape Keys:

ob = Scene.GetCurrent().object.active;
if(ob.activeShape == 0):
   ob.insertShapeKey()
   ob.insertShapeKey()

现在我该如何更改键值?

1 个答案:

答案 0 :(得分:0)

好的,我是这样做的:

#get the key
k = ob.getData().getKey()
#create a new Ipo
ni = Ipo.New('Key','ni')
#if there check if there already a key by that name, otherwise add key
if(k.ipo['Key 1'] == None):   k.ipo.addCurve('Key 1')
#add a point to the 'Key 1' ipo curve
k.ipo['Key 1'].append(BezTriple.New(6.0,0.8,0.1))

就是这样。 插入的第一个ShapeKey创建'Basis',然后添加键, 'Key 1'是默认名称