Set property of object in different scene?

Hey guys, I’m working on my game menu and I’ve run into a problem. I need to be able to set the property value of an object in a different scene. Is there any easy way to do this? I’ve been digging through the python API and I can’t find anything on accessing different scene data.

In a nutshell, I have a fade scene setup that will rely on it’s properties (fadein and fadeout) to determine which IPO animations it should run. A separate scene has a “next” button that will set the fade object properties.

I’m no stranger to python, so lay it on me :wink:

In the first scene, set the property to a global variable. When the seconds scene starts, run a script which takes the global variable and then sets the property equal to it.

by Global variable I think he means for exemple
GameLogic.exemple = 10
there you have a global variable named GameLogic.exemple which equals to an int of the value of 10

by Global variable I think he means for example GameLogic.example = 10

That is correct.

Ok, this is fine for anything that is initially started in the scene, but I need to be able to set the property of the fade object to fadeout once the scene’s behind the fade object switch. This won’t work for any changes needed after the scene has already loaded.

What do you mean “behind”? Is this an overlay you’re using? Other than that I really don’t see why you would need constant access to a scene that’s not running.

Either way, you should be able to work around pretty much anything with global variables. Just set some logic in the scene you need to control that does: own.ipoprop = GameLogic.control. So as soon as you change the global var in your main scene, the prop in the other scene will reflect those changes during runtime.

Or, maybe I misunderstood problem…well, it was worth a shot.

Ah, nevermind, I fixed it. I must have been really tired last night.

import GameLogic as gl
while GameLogic.fader == 1:
    fader = gl.getCurrentController().getOwner()
    fader.fadein = 1
    print fader.fadein
    GameLogic.fader = 0
print "done"

print fader.fadein and print “done” are only there for debugging purposes. The IPO for the fadein property is now properly triggered too. Only thing left is to setup the fadeout, which will be easy now, and I’m done. Well, done with that part :wink:

Thanks for the help guys.

Ok, that didn’t work out quite as planned. The while loop sets blender into a lock and the only way to terminate it is to kill the process. I have another idea, which is to use an if loop with the script’s Always sensor on TRUE level triggering, but it’s not working either:

 import GameLogic as gl

if GameLogic.fader == 1:
    fader = gl.getCurrentController().getOwner()
    fader.fadein = 1
    fader.fadeout = 0

if GameLogic.fader == 0:
    fader = gl.getCurrentController().getOwner()
    fader.fadeout = 1
    fader.fadein = 0

A button in a different scene uses a timer property to trigger a script which sets:

GameLogic.fader = 0

Any thoughts?

Eurika! I fixed it. The scene change works flawless now. I finally broke down, grabbed my notebook and wrote out some sudo code and UML, compared it to the heck of a mess I had, made some changes and . . . viola!

I made a screencap so you can see what I did:

That’s spiffy looking. Are you going to share how you did that?:eyebrowlift2:

Yes, this is part of my networking demo. I will release the .blend file along with some very nice documentation when it’s ready. It will cover creating a basic chat server in Blender. I may also include some 3rd person 3D interaction to make it more interesting.