Posted: Thu Apr 10, 2003 11:01 pm
Joined: 10 Apr 2003
Posts: 11
hello
I'm using
gameblender in
blender 2.25 to create a game and I'm trying to access the property (created in the F8 menu) of an object in python script but I can find the associated method.
Actually I can find my object:
ob = Object.Get("obj")
and after I don't find his properties. So if someone knows how I can solve my problem...
thank
biČ
Posted: Fri Apr 11, 2003 5:14 pm
Joined: 11 Apr 2003
Posts: 2

I'm also trying to do the same thing, but no luck so far. As far as I can tell, you either can't do it (surely not!) or those properties are hidden away somewhere less-than-obvious (surely not!

)
Although I'm not using any of the interactive game features, I thought these properties would be a good way of assigning arbitrary properties for object's propeties/physics for use by import/export filters for features not supported in blender (but used in my own opengl programs). However, if I can't find out how to access these in Python...
Posted: Mon Apr 14, 2003 9:20 pm
Joined: 06 Nov 2002
Posts: 130
You can't access the game objects with the Blender module, you have to use the GameLogic module instead:
| Code: |
import GameLogic
ow = GameLogic.getCurrentController().getOwner()
print dir(ow)
|
add an always sensor to your object and connect a Python controller, set it to the script containing this code, when you run the game engine it will print out all properties for that object, see the game engine documentation for further info.
Posted: Wed Apr 16, 2003 9:52 am
Joined: 10 Apr 2003
Posts: 11
ok! but the GameLogic module doesn't exist under Blender 2.25. So where can I get ?
thanx biČ
Posted: Wed Apr 16, 2003 9:01 pm
Joined: 06 Nov 2002
Posts: 130
The GameLogic module IS available in 2.25, only 2.26 has a disabled game engine. Did you try to run it by using the alt-p key? This won't work, the GameLogic module is only available while running the game engine.
The elysiun forums are a much better place to ask these kinds of questions btw.
Posted: Thu Apr 17, 2003 12:15 pm
Joined: 10 Apr 2003
Posts: 11
yes!! GameLogic works under 2.25 but not with ALT+p.
But that:
import GameLogic
ow = GameLogic.getCurrentController().getOwner()
print dir(ow)
don't give me an access to my object property.
If someone knows the exact code to access the properties, please send it to me because I'm don't know what to do now.
I've tried to use to documentation but nothing seems to show me how I can do.
thanks for you support.
biČ
Posted: Thu Apr 17, 2003 5:12 pm
Joined: 06 Nov 2002
Posts: 130
That code only prints the functions you can access to change physics properties, mesh data, etc. To print the value of a property you added yourself with logic bricks, you can just use the same code and replace the print statement with something like this:
| Code: |
print ow.propertyname
|
where 'propertyname' is of course whatever name you assigned to the property.
Here is a link to other documentation with examples:
http://oldsite.blender3d.org/gameBlenderDoc/book1.html
While old, lots (if not all) is still applicable to the current GameLogic module.
Once again, I point you to the elysiun forums for these kinds of questions, there are lots of example scripts available, and a very active helpful community.