Just updated the code. Old version:
Code:
def playback():
def subTask():
for bones in boneObjList:
bones.lock()
currentBone = 0
for mat in boneMatList:
boneObjList[currentBone].setMatrix(mat, viz.ABS_PARENT)
yield None
if currentBone+1 == len(boneObjList):
currentBone = 0
else:
currentBone += 1
for bones in boneObjList:
bones.unlock()
viztask.schedule( subTask() )
# Press the space key for playing back the blink animation
vizact.onkeydown(' ', playback)
A little more pyhtonic:
Code:
def playback():
def subTask():
for bones in boneObjList:
bones.lock()
for i, mat in enumerate(boneMatList):
boneObjList[i % len(boneObjList)].setMatrix(mat, viz.ABS_PARENT)
yield viztask.waitDraw()
for bones in boneObjList:
bones.unlock()
viztask.schedule( subTask() )
# Press the space key for playing back the blink animation
vizact.onkeydown(' ', playback)