View Single Post
  #7  
Old 12-29-2012, 08:47 AM
asdf asdf is offline
Member
 
Join Date: Sep 2012
Posts: 6
Hi,
what is the best way to get the same state after importing a scene?

I made an example similar to "Tutorial: Hierarchical Models".
In the first run the level is exported, after that the EXPORT should be changed to False. The print output differs although I import the same level I just exported.

Additionally I'm not sure how to get a child Node.
I want to access one of the Nodes that are mentioned in the "print scene.getNodeNames()" in the line that is commented out, but don't know how.

Code:
import viz

viz.clearcolor(viz.SKYBLUE)
viz.MainView.setPosition([0,1.8,-10])

EXPORT = True

if(EXPORT):
	scene = viz.addGroup()

	viz.addChild('ground_grass.osgb', parent = scene)
	carousel = viz.addChild('carousel.wrl', parent = scene)
	pole1 = viz.addChild('pole.wrl',parent=carousel)
	pole1.setPosition([2.5,0,0])
	horse1 = viz.addChild('horse.wrl',parent=pole1)

	print scene.getNodeNames()
	print scene.getChildren()
	#print scene.getChild('???')

	scene.save('example.osgb')
else:
	scene = viz.add('example.osgb')

	print scene.getNodeNames()
	print scene.getChildren()

viz.go()
Reply With Quote