Home | Trees | Indices | Help |
|
---|
|
See release notes for updates, changes and new functionality in the Game Engine Python API.
See update notes for bugfixes and changes released since 2.49.
See Blender/Python API if your not looking for GameEngine docs.
Modules that include methods for accessing GameEngine data and functions.
These modules have no GameEngine specific functionality but are useful in many cases.
This reference documents the Blender Python API, a growing collection of Python modules (libraries) that give access to part of the program's internal data and functions.
Through scripting Blender can be extended in real-time via Python, an impressive high level, multi-paradigm, open source language. Newcomers are recommended to start with the tutorial that comes with it.
This opens many interesting possibilities not available with logic bricks.
When writing python scripts there are a number of situations you should avoid to prevent crashes or unstable behavior. While the API tries to prevent problems there are some situations where error checking would be too time consuming.
Known cases:
There is nothing stopping you from filling a list or making a string so big that that causes blender to run out of memory, in this case python should rasie a MemoryError, but its likely blender will crash before this point.
For instance accessing a KX_GameObject after its End Object actuator runs. This will cause a SystemError, however for KX_MeshProxy, KX_VertexProxy and KX_VertexProxy it will crash the blender game engine.
See: GameTypes.PyObjectPlus.invalid which many types inherit.
For instance tracking/parenting an KX_GameObject object to an object from other scene.
Since 2.49 support for importing modules has been added.
This allows you to import any blender textblock with a .py extension.
External python scripts may be imported as modules when the script is in the same directory as the blend file.
The current blend files path is included in the sys.path for loading modules. All linked libraries will also be included so you can be sure when linking in assets from another blend file the scripts will load too.
Interpreted languages are known to be much slower than compiled
code, but for many applications the difference is negligible or
acceptable. Also, with profiling (or even simple direct timing with
Blender.sys.time
) to identify slow areas
and well thought optimizations, the speed can be considerably
improved in many cases. Try some of the best BPython scripts to get
an idea of what can be done, you may be surprised.
Author: The Blender Python Team
Requires: Blender 2.49 or newer.
Version: 2.49
Note: the official version of this reference guide is only updated for each new Blender release. But you can build the current SVN version yourself: install epydoc, grab all files in the source/gameengine/PyDoc/ folder of Blender's SVN and use the epy_docgen.sh script also found there to generate the html docs. Naturally you will also need a recent Blender binary to try the new features. If you prefer not to compile it yourself, there is a testing builds forum at blender.org.
Variables | |
__package__ = None
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Mon Aug 31 23:12:30 2009 | http://epydoc.sourceforge.net |