From BlenderWiki

Jump to: navigation, search

http://artificial3d.com/images/suzanne_green.gif - Blender goes green.

there was a node in the Requests section for this in the old wiki, now at Requests/Python-Blender. current info about this attempt is in the mailing list archives, http://projects.blender.org/pipermail/bf-committers/2005-October/012135.html

Please insert new topics at the button of this page.

core code sketch

that first sketch is http://www.blender.org/~antont/blender.blend which just includes:

http://www.blender.org/~antont/green/blender.py - port of SDNA (just data)

http://www.blender.org/~antont/green/modifier.py - current mods as classes

http://www.blender.org/~antont/green/application.py - Creator, replaces G.

Yann's Pyrex work is still the other way around, i.e. wrapping c data for Python use, but still perhaps interesting .. not least because it works with current Blender :) http://donkey.dyndns.org/~yann/blender/pyrex/

yet another thing and approach is http://mediawiki.blender.org/index.php/User:Joeedh/Scripts/PySDNA - a plain py script that reads & writes .blend files using the python struct module .. probably not related to this directly, but might be interesting if prototyping some python-written thing that would like to use blender data

Python Numeric data types

http://numpy.scipy.org/ is the new package and home for python numeric types, which provide highly optimized efficient ways to deal with large sets of data in arrays, such as 3d geometry and 2d bitmaps.

this gives some hints about how python numeric data can be used in c: http://www.scripps.edu/mb/olson/people/sanner/html/Python/NumericTypemaps/index.html .. and perhaps a more suitful doc about the same, "Numerical Python arrays in C extension modules" at http://starship.python.net/crew/hinsen/NumPyExtensions.html

There are plans to include numeric types in the Python core. A design document has been posted and your comments are appreciated, http://numpy.scipy.org/array_interface.shtml

with the c written Blender, it might be cool and pretty straightforward to add support for py num types in the bpy api code.

other python 3d projects

there are many other 3d projects that use Python, like cgkit, Endo and http://www.pythoncad.org/ - also a 2d vector drawing app called Skencil, http://www.nongnu.org/skencil/

Making a python-makrorecorder for Blender

I read here the interesting thoughts about using Blender to extend python instead of only embedding python into blender giving python a subset of blenders functionalty to access.

Besides the idea to give python potential access to all functions, methods and public datastructures of blender, there is another idea that intrigues me. If all python classes would be defined to do those functions, the terrain whould also be prepared to embbed a macrorecorder that when acitivated, records als user interactions an writes down their python-coded aquivalent. I'm sure this whould give the community of blender-pythoncoders an immense push. On the other hand the more life and code evolution takes place in the python community, the more we have potential spillbacks of proven python functions that later might be implemented in the Cpp-Core of Blender. --Ollio 12:50, 24 December 2006 (CET)