WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-23-2009, 07:52 AM
omidbrb omidbrb is offline
Member
 
Join Date: Dec 2008
Posts: 27
Calling vizard functions in a loop

Hi,

I noticed that if I call Vizard functions that have a visual effect in a loop, the commands wouldn't be run before the encapsulating function returns (even with delays in between) :

Code:
def callVizFunctionsInALoop():
	for i in range(0, 10):
		moveAvatar(i)
		takeSnapshot()
		#viz.waittime(someDelay)  #Won't help
		#time.sleep(someDelay)    #Won't help
Here, the snapshots will be taken as if the moveAvatar() function hasn't been run.

Is there any Vizard command that will get around this problem?

Thanks
Omid
Reply With Quote
  #2  
Old 09-23-2009, 10:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You should be using the viztask module. There are many examples of it in the docs and on the forum.
Code:
import viztask

def callVizFunctionsInALoop():
	for i in range(0, 10):
		moveAvatar(i)
		takeSnapshot()
		yield viztask.waitTime(someDelay) #Pause function for some time

viztask.schedule( callVizFunctionsInALoop() )
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 11:58 AM
.3DS importing in Vizard and 3D Studio jde Vizard 1 08-28-2009 04:14 PM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 12:13 PM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 10:39 PM
Vizard won't run wouters Vizard 5 02-05-2008 12:12 PM


All times are GMT -7. The time now is 05:24 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC