[Bf-committers] BGE API - was 2.49 release proposal

Campbell Barton ideasman42 at gmail.com
Thu Feb 19 03:05:44 CET 2009

@Ton, The BGE API does not rename objects in blenders database like
the blender/python api, Blenders objects are converted to
KX_GameObjects so there is no need for using blenders library
functions or for exposing the 'OB', 'MA' etc prefix to the python API
(even if C++ api happens to use it)

@Erwin, Im sure we can keep simple demo scripts running with an auto
updater but for more complex scripts you end up relying too many
subtle differences in the api to be able to automatically account for
See how Blengine uses eval() in his scripts and you'll go crazy trying
to make an updater for that! ;)

About Object name prefix "OB".
We have gameObject.name and gameObject.getName() which return the OB
prefix, adding another attribute to return the name without the 'OB'
prefix is messy, with an obscure function which is doing what you
actually want....
gameObject.shortName, gameObject.Name? (ack in BPython we have
object.layers and object.Layers, one is a flag the other is a list but
I still cant remember which)

IMHO API's breaking existing scripts is not so much a problem, when
functions change in obvious ways you just go through and update the
Its when obscure things change in an API with no warning (or
documentation) that an take hours to get to figure out - eg
Python 3.0's print "" -> print("") will break existing scripts but its
fairly straightforward to update.
Whereas Python3.0 ignoring tp_compare and only using tp_richcompare
took me over 3 hours to work out it was the C api that changed and not
my own mistake.

At some point Blender will probably use python 3.0, maybe Blender 2.5
will, at any rate - this will break scripts too.

With Ben's proposal, books scripts/docs will need updating after version 2.49.
If breaking scripts is that bad then we better just not change the API at all.
Or only add attributes without removing the get/set functions.

On the other hand people who buy books can learn with the blender
version that comes with the book, the books can be updated too.

@Alex, good for spotting this one, might be a blocker for using
Mathutils matrices. depends on the breaking scripts issue too.

- Campbell

On Wed, Feb 18, 2009 at 1:45 PM, Alex Fraser <alex at phatcore.com> wrote:
> On Wed, Feb 18, 2009 at 10:52 PM, Campbell Barton <ideasman42 at gmail.com> wrote:
>> 3) return Mathutils types Vector(), Matrix() etc.
>> Its annoying that in C++ you can do vec1+vec2 but in the python API
>> you have do this one axis at a time or convert to Mathutils types.
>> We switched some parts of Blender.* api to use Mathutils types and
>> surprisingly few scripts broke because in most cases they can be used
>> interchangeably with tuples/lists.
> +1
> But don't GameEngine matrices need to be transposed when used with Mathutils?

More information about the Bf-committers mailing list