| wahn wrote: |
| Hi,
Unfortunately the Python API is also not consistent between the game engine and the rest of Blender. Erwin and me wanted to work on that but there was just no time left before NaN went bancrupt the first time. And I had other problems to survive in London Jan |
| ton wrote: |
| In the past, with each new developer coming in, we were confronted with a new vision on how Python should be implemented in Blender.
This resulted in incompatibility among releases, and a non-uniform API (game engine vs. rest of Blender). Causing quite some frustrations with our users... |
| strubi wrote: | ||
Hello there, well, finally, I thought, I check out what the old blender fellows are chatting about these days.. |
| strubi wrote: |
|
The problem about implementing a good object oriented API is: the robust Kernel. Blender has no Kernel (at least you can't really call it one). So, at least one point where all different python API people would agree: There are things you just can't to to make it stable. |
| strubi wrote: |
|
(The GameEngine is another topic - there was not even a concept of an API. It got obviously just hacked in to 'make something work') |
| strubi wrote: |
|
So the only approach I see to make a clean API: 1. Redesign a Blender object kernel |
| strubi wrote: |
|
2. Create a good C API (C++ still is too problematic among different platforms and compilers - *sigh*) |
| strubi wrote: |
|
3. SWIG the darn thing, or use other approaches like BOOST (which involve a lot of C++ knowledge though. And they can make size explode...) More on BOOST at http://www.boost.org. |
| strubi wrote: |
|
Too bad. I've got another job follow some redesign ideas, Maya-alike. Let's see what the current blender hackers work out. |
| Michel wrote: |
|
I'm currently one of the guys who is working on the Python API. |
| Michel wrote: |
|
I haven't even looked at that one yet, since the current focus is to get the 'offline' Python api to build without any problems on all platforms. |
| Michel wrote: |
|
Could you give examples on which platforms problems arise? I mean, ghost is written in C++ as well as the game engine and these work on all platforms. Well, the game engine has problems with the physics engine, but that's another kind of problem. |
| Michel wrote: |
|
Yep, I've tried that too. But I had problems with functions that have different return types. For example, the function Blender.Get() can return long, char* and float. This construction is impossible to use swig for. |
| wahn wrote: |
| Good to see that someone took the job to design a new Python API. As I said before it would be much easier to start from scratch with having Python in mind from the very beginning.
|
| wahn wrote: |
|
But maybe it does help you to see how others approach the integration of a scripting language. Have a look at the very good and well designed library VTK: [ http://public.kitware.com ] It wraps the C++ functionality for several scripting languages (Tcl, Python, Java, ...) and you can learn a lot from there BUT it would work only for a well designed kernel (as Strubi said). |
| wahn wrote: |
|
Speaking about VRML2 - look at: http://oss.sgi.com/projects/inventor |
| wahn wrote: |
|
In a few days I had a simple "Blender" version running. I mean I "borrowed" some ideas from Blender but the source code was completely written from scratch |
| strubi wrote: |
|
Oh yes. I've had a close look at SWIG some time ago (at NaN) - it wasn't really usable at that time for all the complex object types in Blender, so I went back to hand coding the modules. But using functions that return a lot of different types can be avoided...(and can be handled faster, too). |
| strubi wrote: |
|
I must admit: I've given up on Blender and concentrated on my own toolbox. So, the only thing that would really interest me at the moment is a complete redesign of the mesh & curve 'kernels'. I think it would really pay off. It might be hell of a job to integrate a new mesh kernel into blender, but then you could program a lot of nice functionality on top with python. The current structures just make it (IMHO) impossible to write a powerful and robust API. |
| strubi wrote: |
|
I've written a mesh library a year ago which allows full undo and handles all entities (verts, edges, faces) as single objects. The thing is in C++ and could be easily python-wrapped with BOOST, which is a rather intelligent C++ solution, but featured by massively nested templates, which produce a lot of code. It's really good to make a python wrap in a few lines though. Maybe you want to have a look at it.. The mesh library demo (win32) can still be downloaded at http://www.section5.ch. I'm actually using it with Blender. But it's a bad bad hack and far from complete. |
| strubi wrote: |
|
If you've ever looked at that terrible 'hacked in' VRML2 importer: The guy who has written all the underlying scenegraph code obviously had been thinking a lot about a well organized and flexible scenegraph. VRML2 might be seen as dead, but A LOT can be learnt from those formalisms introduced (see Scenegraph Walker concept, etc.) The same architecture would be great to have in a future blender kernel. |