From: Guy K. K. <g....@ma...> - 2009-06-28 06:38:38
|
On Sun, 28 Jun 2009 17:51:47 Jamie Riotto wrote: > I believe setting scene.visible to false just makes the scene invisible, it > doesn't delete it, unlike objects. If you'd like to reinitialize the scene > then just delete all visible objects: > > for obj in scene.objects: > obj.visible = false That ought to be "False". But that also doesn't work, as visual.scene is the object that complains about re-initialised, and that one is a module level variable, so it can only be initialised once per running Python process. Iterating over the objects and setting their visibility to False should (A) just hide them, but not delete them, and (B) still leave the current scene's instance in the state it's in. So that's not helpful, either. I did help myself by checking whether visible.scene.title has been changed, and if so then to hide all objects and not re-initialise the scene. But that's more of a dirty hack, rather than a real solution. It just targets this *one* case, and cannot be generally used for other modules using visual as it would be expectable from Python code. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Pūtaiao o Mōhiohio me Pāngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 G....@ma... http://www.massey.ac.nz/~gkloss |