PDA

View Full Version : Droplist for different scenes


Daniel
06-20-2013, 02:19 PM
Hello

It is possible to create a droplist to visualize different scenes, like in the i-SpaceDemo.exe.

This mean that when i select Scene1 in the droplist the Scene1.osgb loads, and when I select Scene2 in the droplist the Scene2.osgb loads.

I am a little bit lost with this problem

Jeff
06-24-2013, 02:17 PM
You could add the environment models to different scenes when the script loads and swap scenes in the droplist callback function:

import viz
import vizact
viz.go()

gallery = viz.addChild('gallery.osgb', scene=1)
dojo = viz.addChild('dojo.osgb',scene=2)

dropList = viz.addDropList(parent=viz.ORTHO,scale=[0.75]*3)
dropList.addItems(['Gallery','Dojo'])
viz.link(viz.MainWindow.RightTop, dropList, offset=[-150,-50,0])

def changeScene(e):
if e.object.getItem(e.newSel) == 'Gallery':
viz.scene(1)
if e.object.getItem(e.newSel) == 'Dojo':
viz.scene(2)

vizact.onlist(dropList,changeScene)

Daniel
06-26-2013, 02:41 PM
It works great but is there a limit in the number of scenes/droplist? Because only let me put around 6 or 7 scenes. The other 3 or 4 (I want to put 10 scenes) appear in the droplist but don't change the scene when i select it the droplist

Jeff
06-27-2013, 09:54 AM
You can use up to six scenes at one time. If you need more environments you can remove what's in one of those scenes and load a new environment there.

farshizzo
07-10-2013, 10:05 AM
There is no limit to the number of scenes you can use. For historical reasons, Vizard creates six scenes at startup. However, you can create more scenes using the viz.addScene() command.