PDA

View Full Version : waittime


cade_mccall
04-29-2005, 12:44 PM
Hey guys-

We're having trouble with using a waittime command within a director function. No matter where the waittime commands are within the sequence, the pause always occurs at the beginning of the sequence of events. Here's some example code:

def viewPic():
label.visible(viz.OFF)
viz.waittime(2)
quad.texture(pics[0])
quad.visible(viz.ON)

In this code, the label disappears after 2 seconds and then the quad immediately appears. What are we doing wrong?

farshizzo
04-29-2005, 02:34 PM
Hi Cade,

Can you try the following code. I tried it here and it works fine. Also, make sure that you aren't changing the visiblity of the objects somewhere else in your code. Just press the spacebar. The label should disappear and a quad should show up 2 seconds later.import viz
viz.go()

label = viz.add(viz.TEXT3D,'Label',viz.SCREEN)
label.translate(0.5,0.5)
label.alignment(viz.TEXT_CENTER_CENTER)

quad = viz.add(viz.TEXQUAD,viz.SCREEN)
quad.translate(0.5,0.2)
quad.visible(viz.OFF)

def viewPic():
label.visible(viz.OFF)
viz.waittime(2)
#quad.texture(pics[0])
quad.visible(viz.ON)

def onkeydown(key):
if key == ' ':
viz.director(viewPic)

viz.callback(viz.KEYDOWN_EVENT,onkeydown)

cade_mccall
04-29-2005, 03:00 PM
Thanks Farshid. That script works so I put the texture command outside of the director thread in my original script and now it works as well. What was my problem there? Was it that I was tinkering with a 3D object within the director sequence?

farshizzo
04-29-2005, 03:06 PM
I'm not sure what the problem is. I tried adding the texture command within the director function and it still works for me. Are any error messages being printed out?

cade_mccall
04-29-2005, 03:39 PM
I figured out what I did wrong when the waittimes were all going off at the beginning of the sequence. When I called the director function I used an extra set of parentheses: viz.director(viewPic()).