WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-21-2008, 10:11 AM
utepbereed utepbereed is offline
Member
 
Join Date: Nov 2008
Location: El Paso
Posts: 1
Arranging Scenes in Correct Order

I am a relative newbie to Python and Vizard despite being more familiar with other programming languages. I am sure this question has been asked over a thousand times, but here goes again!
I have taken over a project at my University that was abandoned by a previous employee. We are trying to simulate various events on our Campus and have several scenes that should take place in a specific order. I have modified the scripts left by the previous employee so that they work individually, but now I discover when combined, all scenes try start at once resulting in errors. The program is rather large and complex, so I have broken my code into object classes and various support modules that I won’t post here. Instead, I have written a pseudocode example of the problem I am having, namely that all functions run at once instead of in series as we intended (We are not using threads). Any help you can offer is greatly appreciated!
Attached Files
File Type: txt pseudocode.txt (725 Bytes, 1653 views)

Last edited by utepbereed; 11-21-2008 at 10:12 AM. Reason: About threads
Reply With Quote
  #2  
Old 11-21-2008, 10:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I would highly recommend using the viztask module to control the flow of your program. Each stage would be implemented as a task and the main function would just yield each stage one after the other:
Code:
def stage1():
    while SomeCondition:
        
        #Do something each frame here

        #Wait for next frame
        yield None

def stage2():
    while SomeCondition:
        
        #Do something each frame here

        #Wait for next frame
        yield None

def main():
    #Execute stage 1 and wait for it to finish
    yield stage1()
    #Execute stage 2 and wait for it to finish
    yield stage2()

viztask.schedule(main())
There are a lot of examples in the docs showing how to use the viztask module. You can also ask here on the forum if you have more specific questions about it.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
switching between scenes david Vizard 4 07-01-2003 07:05 PM


All times are GMT -7. The time now is 07:43 PM.


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