Blender Git Commit Log

Git Commits -> Revision b5b24ee

Revision b5b24ee by Campbell Barton (master)
April 30, 2009, 08:01 (GMT)
BGE Python sys.path for the blenderplayer and blender
sys.path is the search path for python modules. This is useful so people making games can put all their scripts in a folder and be sure they will always load into the BGE.

for each blend file a scripts directory is added to the path
/home/me/foo.blend
will look for modules in...
/home/me/scripts/*.py

It could also default to look for modules in the same directory as the blend file but I think this is messy.
Added a note in the tooltip about //scripts so its not such a hidden feature.

This works by storing the original sys.path, then adding the paths for the blendfile and all its libs,
when a new blendfile is loaded, the original sys.path is restored before adding the blendfiles paths again so the sys.path wont get junk in it.

One problem with this - when using linked libs the module names must be unique else it will load the wrong module for one of the controllers.

also fixed 2 bugs
- sys.path in the blenderplayer was growing by 1 for every file load in blenderplayer
- the relative path (gp_GamePythonPath), wasnt being set when loading files in the blenderlayer (as I wrongly said in the last commit).

Commit Details:

Full Hash: b5b24ee521866637871e7555d4294c0936a0664d
SVN Revision: 19999
Parent Commit: 939290b
Lines Changed: +123, -5

3 Modified Paths:

/source/blender/src/buttons_logic.c (+3, -3) (Diff)
/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp (+1, -1) (Diff)
/source/gameengine/Ketsji/KX_PythonInit.cpp (+119, -1) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021