Linking 2 scenes

I wanna know how to created 2 different scenes. Inside one of this is a buttom, which being pushed shows the other scene.

Simply create two branches in your scene.
Under render parent a node “scene1”, and another “scene2”. Parent all of your models under one of these depending where it belongs.
Hide one of them. When you click the button un-hide it and hide the other one.

Can you show me an example (code font), I mean I don´t know how to create a branch. The example can be very simple, I will watch it and I´ll make a little changes.

Making a branch in the scene is just simple reparenting using the reparentTo command. You should read through the manual, specifically http://www.panda3d.org/manual/index.php/Scene_Graph_Manipulations.

Very simple example:

import direct.directbase.DirectStart
from panda3d.core import NodePath, PandaNode

# first move the camera out so we see everything
base.cam.setY(-10)


# create two branches, one for each scene. for learning purposes we use two different ways
scene_a = render.attachNewNode(PandaNode("branch a"))
scene_b = NodePath("branch b")
scene_b.reparentTo(render)

# load something into scene a
smiley = loader.loadModel("smiley")
smiley.reparentTo(scene_a)

# load something into scene b
for i in range(-1, 2):
    frowney = loader.loadModel("frowney")
    frowney.reparentTo(scene_b)
    frowney.setX(i*2)
    frowney.setScale(0.5)
    frowney.flattenLight()

# hide one scene and remark that in a variable.
# we also could use NP.isHidden(), but we want to go sure.
scene_b.hide()
selected = scene_a

def toggleScenes():
    """toggle between scenes a and b."""
    global selected
    if selected == scene_a:
        scene_a.hide()
        scene_b.show()
        selected = scene_b
    elif selected == scene_b:
        scene_b.hide()
        scene_a.show()
        selected = scene_a

# listen to a key for toggling the scenes
base.accept("space", toggleScenes)

run()

Press space to toggle…

Thanks… That was exactly what I needed, Already I have changed the .egg archives to do it with my own files.

Now I have this question. Where can I get a list of key names of the key board? I mean that if I want the “space” key, now I know I have to put “base.accept(“space”, toggleScenes)”, but if I want to use another key?

Example: A buttom from the mouse. How can I spell it in the code font?

And if I want to toogle to other scene because clicking over a specify object from the program?

Example: Clicking over the smily.egg

How can I get it?

This should give you an overview:
panda3d.org/manual/index.php … rd_Support
panda3d.org/manual/index.php/Mouse_Support

Thanks, now I know how to toggle into other scene using my mouse buttons. But I continue serching for the code to do this but only working on a specify object.

Can somebody to settle this code font, to do what I wanna do?:

import direct.directbase.DirectStart
from panda3d.core import NodePath, PandaNode

first move the camera out so we see everything

base.cam.setY(-10)

create two branches, one for each scene. for learning purposes we use two different ways

scene_a = render.attachNewNode(PandaNode(“branch a”))
scene_b = NodePath(“branch b”)
scene_b.reparentTo(render)

load something into scene a

smiley = loader.loadModel(“smiley”)
smiley.reparentTo(scene_a)

load something into scene b

for i in range(-1, 2):
frowney = loader.loadModel(“frowney”)
frowney.reparentTo(scene_b)
frowney.setX(i*2)
frowney.setScale(0.5)
frowney.flattenLight()

hide one scene and remark that in a variable.

we also could use NP.isHidden(), but we want to go sure.

scene_b.hide()
selected = scene_a

def toggleScenes():
“”“toggle between scenes a and b.”""
global selected
if selected == scene_a:
scene_a.hide()
scene_b.show()
selected = scene_b
elif selected == scene_b:
scene_b.hide()
scene_a.show()
selected = scene_a

listen to a key for toggling the scenes

base.accept(“space”, toggleScenes)

run()

You should really read through the manual and examine the sample programs in order to get a good understanding of how to use Panda3D.
If you do so you will find that there is one example called Music Box which shows how to perform an action when clicking a 2D button, and another called Chessboard which shows how to pick 3D objects with the mouse.

As you can see, barely I am learning to speak english, and it´s too difficult for me to can understand very good the pandas3d´s manual because they have so much information and at final the manuals confuse me. Despite When I ask to you, ya answer me what really I need to know.

I just regard the manuals from panda´s installer, but I cannot get it. No spanish.

Sorry if I sound rude now, but why don’t you learn english before trying at Python and Panda3D?

Understanding of english and the ability of conversation are absolutely fundamental here.

Well, I don’t think Panda is meant to be an English-only tool. However, it is true that all of the documentation is written in English, and this is unfortunate.

Still, we can’t really walk you through the process of learning fundamentals of programming here. You will have to do a lot of studying on your own to gain an understanding of these fundamentals before you will get very far.

David

I understand you, plus I study Python every day and
looking back, I have got a lot of progress, as an example it was too hard to can create an .egg file but I got it on my own. And now you help me to toggle to other scene. Seriously I don´t think I will have a lot of problems asking for help now, because I understand all that you answer to me(about the english).

By the way I am making a panda´s manual in spanish, made with all what I had learnt here in this forums, because I think it´s too important share this to everybody.

taringa.net/posts/info/11930 … rtual.html

Thanks for your attention!
I´ll try to make it out on my own(to click over an object to got an event), but if I finally do not understand, I ´ll ask for help again!

Thanks!