WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-30-2005, 07:20 PM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
vizinfo in multiple scenes

hi, im trying to use the vizinfo module but the boxes only seem to appear in scene 1.
how can I add an info box to a different scene (while in another one)?
or how can I make a box appear after calling viz.scene(#>1) ?

thanks
Reply With Quote
  #2  
Old 01-31-2005, 11:06 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Do you want the same box in different scenes? If so, try the following:
Code:
info = vizinfo.add(....)
#Duplicate the box onto scene 2
info._group.duplicate(2)
If you have an older version then try this instead:
Code:
info.group.duplicate(2)
I think you asked a question a few months ago about adding checkboxes and sliders to the vizinfo box. Version 2.5 of Vizard now allows you to do this, you might want to check it out.
Reply With Quote
  #3  
Old 02-02-2005, 02:10 PM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
how should i do it if I want to add multiple vizinfos into different scenes (at least 2 per scene).

also, is there a way I can check the version number of vizard so i can send an error message if the user tries to run a script in an older version?
Reply With Quote
  #4  
Old 02-02-2005, 02:16 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

To add the vizinfo box to a different scene try the following:
Code:
#Place info box in scene 2
info._group.parent(viz.WORLD,2)
The following command will return a string that specifies the current version of Vizard:
Code:
version = viz.version()
Reply With Quote
  #5  
Old 02-02-2005, 03:11 PM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
so i tried what you suggested, but it doesn't seem to work. i even made a little test script:

Code:
import viz
import vizinfo

viz.go()
viz.clearcolor(.5,.5,.5)

info = vizinfo.add('message')

scene = 1
def onkeydown(key):
	global info, scene
	#The keyboard button 'key' is being pressed
	if key == ' ':
		scene += 1
		viz.scene(scene)
	
	if key == 'd':
		info._group.duplicate(scene)
		
	if key == 'm':
		info._group.parent(viz.WORLD, scene)

viz.callback(viz.KEYDOWN_EVENT,onkeydown)
Reply With Quote
  #6  
Old 02-02-2005, 03:20 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
My bad, it should be:
Code:
info._group.parent(viz.SCREEN, scene)
Reply With Quote
  #7  
Old 02-02-2005, 09:21 PM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
ok, so the parent trick works (maybe this should be added as a feature in future versions?). now i get an error when i try to scale vizinfo. what i have is this:

Code:
INFO_SIZE = [0.5,0.5]
info = vizinfo.add('blah')
info.scale(INFO_SIZE)
what I get is this:
Code:
Traceback (most recent call last):
    File "<string>", line 12, in ?
    File "context_recall_02.py", line 123, in ?
        infoBox.scale(INFO_SIZE)
TypeError: scale() takes exactly 3 arguments (2 given)
Reply With Quote
  #8  
Old 02-03-2005, 11:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The older version of vizinfo didn't support passing lists to the scale function. You will have to pass each value individually:
Code:
info.scale(INFO_SIZE[0],INFO_SIZE[1])
or you could also do the following:
Code:
info.scale(*INFO_SIZE)
Reply With Quote
  #9  
Old 02-03-2005, 11:32 AM
vadrian vadrian is offline
Member
 
Join Date: Sep 2004
Posts: 32
i have both 2.5 and the previous version (2.1?) installed. I was getting that error while using 2.5. Is it possible vizard was grabbing the vizinfo from the older version?

also, random python question. is there a python equivalent to:

x = (isBoolean)? y:z

i have a lot of checks, and i'm tired of repeating the 4 line if/else template
Reply With Quote
  #10  
Old 02-03-2005, 11:49 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It might be possible. Startup 2.5 and check the value of the following in the interactive window:
Code:
viz._WIN_VIZ_PATH
It should point to "C:\Program Files\Vizard25" or wherever you installed 2.5

Python doesn't support the one line if/else. If you can guarentee that the value of the boolean will always be either 0 or 1 you could do the following:
Code:
x = [z,y][isBoolean]
Otherwise you could create your own function:
Code:
def ifelse(boolean,trueVal,falseVal):
	if boolean:
		return trueVal
	return falseVal

x = ifelse(isBoolean,y,z)
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


All times are GMT -7. The time now is 11:17 PM.


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