View Single Post
  #2  
Old 02-21-2006, 12:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Which version of Vizard are you using? There was a bug that would cause a crash when adding a certain amount of viewpoints, but it should be fixed in the latest version.

I've modified your script to update the viewpoint of each window when the corresponding key is pressed. The only "sloppy" thing about your script is that you are adding a new viewpoint each time a key is pressed. The the script below creates a viewpoint for each window during startup, and just modifies the existing viewpoint in the keyboard callback. Let me know if this doesn't help:
Code:
import viz
viz.go()

###############################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Keyboard
################################################

def mykeyboard(key):
	if key == 'a':
		view1.translate(mainView.get(viz.HEAD_POS))
		view1.rotatequat(mainView.get(viz.HEAD_QUAT))
	elif key == 's':
		view2.translate(mainView.get(viz.HEAD_POS))
		view2.rotatequat(mainView.get(viz.HEAD_QUAT))
	elif key == 'd':
		view3.translate(mainView.get(viz.HEAD_POS))
		view3.rotatequat(mainView.get(viz.HEAD_QUAT))
		
		
		
################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Objects
################################################

viz.add('outersphere.IVE')
viz.add('innersphere.IVE')
viz.add('plane.IVE')

window1 = viz.add(viz.WINDOW)
window1.position(0,1)
view1 = viz.add(viz.VIEWPOINT)
window1.viewpoint(view1)

window2 = viz.add(viz.WINDOW)
window2.position(0,0.25)
view2 = viz.add(viz.VIEWPOINT)
window2.viewpoint(view2)

window3 = viz.add(viz.WINDOW)
window3.position(1,0.25)
view3 = viz.add(viz.VIEWPOINT)
window3.viewpoint(view3)

mainView = viz.get(viz.MAIN_VIEWPOINT)
################################################
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Callback
################################################


viz.callback(viz.KEYBOARD_EVENT,mykeyboard)
Reply With Quote