[C++-sig] Can Boost.Python help me?

Roman Yakovenko roman.yakovenko at gmail.com
Tue Aug 8 11:35:09 CEST 2006


On 8/8/06, Qun Cao <quncao at gmail.com> wrote:
> Hi Everyone,
>
> I am a beginner on cross language development. My problem at hand is
> to build a python interface for a C++ application built on top of a 3D
> game engine.  The purpose of this python interface is providing a
> convenient scripting toolkit for the application.

Fortunately you are not the first one, and I hope not the last:

http://language-binding.net/pyplusplus/quotes.html#who-is-using-pyplusplus
1. Python OGRE
   * http://lakin.weckers.net/index_ogre_python.html
   * http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1478&sid=df5ad0fff81d1f746f527ebcdd4aa1db

2. http://cgkit.sourceforge.net/ - contains Python bindings for Maya C++ SDK

3. PyOpenSG - https://realityforge.vrsource.org/view/PyOpenSG/WebHome
    The goal of PyOpenSG is to provide python bindings for the OpenSG
scene graph.

> Since the main program is still going to be the C++ application, I
> guess we need to embedding the python scripts in the C++ code.

I think cgkit project is dealing with this problem too.
>
> But for this to work, the python code needs to know the Player class,
> is it right?

Right

> Does that mean I need to build a python wrapper class for
> Player and "import Player" in the python code?  But because this
> application is built on top of a game engine, Player class inherits
> many classes from there, I cannot possibly wrapping them all, right?

It depends on how much functionality you want to export.

> Also, some global objects are probably needed in this code of adding
> players, how can the python code access them?

Boost.Python provides the functionality.

> I know I probably don't have a grasp of basics here,  please kindly
> enlighten me!
>
> Btw, if you can point me to any source code of non-trivial projects
> utilizing Boost.Python, that would be very helpful.  I found the
> examples on the tutorials are far too simple.

Those are tutorials, they should be simple, right :-) ?

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list