开发者

How can I switch between multible scenes in Blender?

I made four scenes in a single .blend file and I want to to build a GUI using Python that mainly contains four operations names. Then when a user press on his choice I want to make the current scene the scene correlated to the user's choice.

This is my code until now. I am using Blender v. 2.49.

import Blender
import bpy

def draw():
    Blender.BGL.glClear(Blender.BGL.GL_COLOR_BUFFER_BIT)
    Blender.Draw.Toggle("Restart The Surgery",1,10,2开发者_Python百科0,200,20,0,"Tooltip")
    Blender.Draw.Toggle("Learning The Surgery",1,220,20,200,20,0,"Tooltip")
    Blender.Draw.Toggle("Examine The Surgery",1,430,20,200,20,0,"Tooltip")
    Blender.Draw.Toggle("Exit",1,640,20,200,20,0,"Tooltip")

def event(evt,val):
     if evt == Blender.Draw.ESCKEY:
        Blender.Draw.Exit()
        return

scn_list = bpy.data.scenes

for i in scn_list:
    print (i)

def button(evt):
     if evt == 1:
        bpy.data.screens['Default'].scene = bpy.data.scenes['L_Scene']
        bpy.context.screen.scene=bpy.data.scenes['L_Scene']
        #Blender.Scene.GetCurrent().getActiveObject().loc = (0,0,0)
        #Blender.Window.Redraw()
Blender.Draw.Register(draw,event,button)

Now when I press Alt + P then the interface with four buttons appears correctly, but when I press 1 why don't the current scene change to the L_Scene? So, what is the problem?

And also when I press on any button I get an error saying:

AttributeError : module object has o attribute screen ..

How do I fix these problems?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜