如何在Blender Python中为ShapeKey设置值?
我已经成功通过Python插入了形状键,代码如下:
ob = Scene.GetCurrent().object.active;
if(ob.activeShape == 0):
ob.insertShapeKey()
ob.insertShapeKey()
现在我该如何修改这个键的值呢?
1 个回答
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))
就这样。 第一个插入的形状关键帧叫做'Basis',然后再添加其他关键帧, 'Key 1'是默认的名称。