Hi all,

I'd like to announce the initial availability of osgBoostPython, a very work-in-progress python wrapping of OSG.

The project is on Google Code here:
http://code.google.com/p/osgboostpython/

Seeing how osgSwig had its problems wrapping recent versions of OSG, and wanting to do something completely different than what I do at work during my vacation, I started working on this. At the moment, I have some of osg, osgDB, osgGA and osgViewer wrapped, such that I can do the following completely in python code:

1. Create simple node hierarchies (osg::Node, osg::Group, osg::Geode, osg::Drawable, osg::Geometry, osg::ShapeDrawable)
2. Read various files (osgDB::readNodeFile, readImageFile, readShaderFile)
3. Create osg::Geometry with Vec2, Vec3 and Vec4 Arrays for vertices, texcoords, vertex colors and normals. 4. Set modes in a stateset and add a texture to a stateset (the only StateAttribute currently wrapped) 5. Start a viewer (osgViewer::Viewer) with different windowing setups (osgViewer::View) 6. Override osg::NodeCallback, osg::NodeVisitor and osgGA::GUIEventHandler in python subclasses (the enums from osgGA::GUIEventAdapter for key and event type have not yet been wrapped but this is trivial to add and will be added soon) 7. A few more that I surely forget. See the test/ directory in the code for some python-scripted unit tests, I try to keep these complete so they represent what can currently be done with the wrappers.

Lots of things are missing to make a useful application from this, and no performance tests have been done either (I suspect if you make a NodeCallback in python code, it would have to be pretty simple, but I have no numbers). Also, some basic tests are in the code base but some things are known not to work (ref_ptr gives me a bit of trouble sometimes), so more unit tests would be helpful.

The manual wrapping is a bit tedious to do but it has some definite advantages (you wrap what you need as you need it, and things are simple to wrap including VecXArrays).

The project's name comes from the fact that it uses Boost.Python to do the wrapping. Boost.Python is a way to wrap C++ libraries into Python modules using C++ code (boost's heavily-template metaprogramming style of code). As such, it uses bjam as a built tool instead of CMake, but anyone who has boost should have bjam too so it shouldn't be a problem. More info on Boost.Python can be found here:
http://www.boost.org/doc/libs/1_40_0/libs/python/doc/index.html

Essentially, I'm announcing this so people can take a look, give me comments, and if anyone would like to help in the initial stages I'll gladly accept patches. If someone wants to contribute in a more major way I could also give commit access to some.

I don't think I'll ever compete with osgSwig, since the focus of this project will likely be different. I doubt it will ever feature complete wrapping of all of OSG. However, it can be useful to people who want certain features and want lots of control over how the OSG API is exposed to Python.

I'll be back to "regular" work on Monday, so I have no idea how often I'll be able to work on this (it may be quite sporadic). But I'll gladly answer questions and review patches.

If you want to help, you can check the code and see the "WrappingCookbook" page on the project wiki to see how to continue wrapping. Also see the project's Issues section for some of the things I wanted to tackle next (but any additional wrapping will be useful). The README.txt in the repository explains how to build and then how to run the unit tests.

Hope this can be useful to someone someday. Let me know if there are questions or comments.

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to