View Single Post
  #8  
Old 10-22-2013, 08:11 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
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)
Reply With Quote