[Bf-committers] ctypes wrappers for blender

Campbell Barton ideasman42 at gmail.com
Tue Apr 12 13:49:00 CEST 2011


On Mon, Apr 11, 2011 at 5:18 AM, Hart's Antler <bhartsho at yahoo.com> wrote:
> Hi BlenderDevs,
>
> http://rpythonic.googlecode.com/files/libblender-ctypes-test2.tar.bz2
>
> Above contains a ctypes wrapper around a large part of the blender C API.  Also included is a blender.h header file that the wrapper is generated from.  I wasn't sure if there was some more headers that should be included in there, so far its just a starting point.  The archive includes libblender.so compiled for 32bit ubuntu.  The ctypes wrapper (blender.py) can be used from within blender by having ctypes load an empty string, telling ctypes to load from the current process, in case your not interesting in using libblender.so
>
> -brett

Hi Brett, firstly do you have to do anything special with RPythonic to
generate the wrapper? if so could you give info as to how you
generated blender.py
I noticed some of the structs have no fields, is there some way to
control this? ImBuf & View3D for eg.

Do you have some examples of this api being used?

Noticed you had to make some changes to get blender to build as a library.
You can also do this by building with WITH_PYTHON_MODULE which will
give bpy.so but from what I can tell is the same thing as you
generated, just means it can be done without editing cmake files.

-- 
- Campbell


More information about the Bf-committers mailing list