View Single Post
  #6  
Old 09-25-2007, 09:41 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The blink name must be a string, and you must apply the action to the face object. Here is a sample script:
Code:
import viz
viz.go()

face = viz.add('biohead_all_morph.vzf')
avatar = viz.add('female.cfg', pos=(0,0,1), euler=(180,0,0))
avatar.setFace(face)

#Blink morph ID of avatar
BLINK_MORPHL = 'blinkL'
BLINK_MORPHR = 'blinkR'

#Action that will animate blink closing
close_eyeL = vizact.morph(BLINK_MORPHL,1,0.1)
close_eyeR = vizact.morph(BLINK_MORPHR,1,0.1)

#Action that will animate blink opening
open_eyeL = vizact.morph(BLINK_MORPHL,0,0.1)
open_eyeR = vizact.morph(BLINK_MORPHR,0,0.1)

#Action that will wait 1-5 seconds
wait_blink = vizact.waittime(vizact.randfloat(1,5))

#Action to close/open both eyes
close_eyes = vizact.parallel(close_eyeL,close_eyeR)
open_eyes = vizact.parallel(open_eyeL,open_eyeR)

#Action that will blink indefinitely
blinkAction = vizact.sequence( wait_blink, close_eyes, open_eyes, viz.FOREVER )

#Add blink action to face
face.addAction(blinkAction)
Reply With Quote