Dev:2.4/Source/Python/Python architecture

提供: wiki
< Dev:2.4‎ | Source‎ | Python
移動先: 案内検索

There will be a session on this in the 2004 conference. This is to prepare for that, so that we would get most out of the session.


1. current API

MichelSelten re-wrote. started from Object module, other came in for World etc.

CampbellBarton involved in C, written several plugins, change?

2. making new API


3. extending/embedding

at least exposing as much of Blender to Python as possible (is the current 'organic' mode, driven by the needs of the scriptwriters)

- tough ones: event propagation, ..?

The purpose of this is studying the ways Python is becoming integrated into Blender, and finding strategies to do it well in the future.


Currently, Blender mbeds Python. This means that the interpreter is included in the application, which provides an API that can be used for scripting within the application itself. This has been quite succesfull, as the growing number of useful scripts demonstrate. The API is expanding continuously, and people are experimenting with new kinds of functionality made in Python. Interesting recent examples of this include enchancing the OOPS window by Campbell Barton and using the Draw module for creating customizable GUIs through the Python API.

The problem?

There are several things that can't be done via Python, and (potential) developers are continuously facing the problem that functionality that is available and defined in the components written in C are unavailable from Python. Sometimes it is almost like a race: new features are added to the core, someone wants to use them from Python but can't, and then again someone needs to add new hooks the the Python API. Could and should something be done about this? Or is the current mode of development ok for the future too?

(is this a / the problem, what others are there?)


An extreme approach is PythonBlender -- i.e. refactoring Blender to so-called xtend Python. There one perspective is using parts of Blender outside it for other apps, but that is perhaps not so interesting .. as Blender is first of all an integrated and nice application for modelling, animating etc., and not a library for making other tools, the primary target here is to enhance Blender itself. That is, the main thing regarding Python architecture is to make it so that Blender may become better. (...)

What else? Continue with bpython as it is ..? will present an interesting angle to this, with critique of the current API and a (I find) fascinating alternative (currently made as a wrapper on top of the bpy API)


-- ToniAlatalo - 27 Sep 2004