This year at Libreplanet I gave a small talk about Python in Blender. My primary goal behind was to talk about the ways that Blender, by exposing its Python API directly in the interface, there for users to discover, gives a new meaning to ‘free software’ not just in licensing or community (though these things are important) but also in the design of the program itself. How many programs do you know that have an ‘edit source’ button for each interface element?
One of the elements of the talk was a tutorial on how to use Blender’s Python API, and add a new primitive type into the Add Mesh menu. This is made very easy thanks to the template scripts included in Blender, that allow you to create your own with just a few edits, and by the fact that you can grab data from Blender, and pipe it into your script directly.
I’m not sure if the video from the conference will be available from the FSF; they are slowly putting talks up on the FSF mediagoblin site – I’ll post something if it does. In the meantime, I recorded a Python tutorial for just this part:
Going back and recording the tutorial actually made it better than what I presented at the conference. I used the Addon template, instead of the Operator template, which makes it even easier to share the code. Interestingly, during the presentation, I found a bug in the operator template, which I fixed after it was over. The fix is now in Blender 2.77, a nice way in which a presentation about a free software project leads directly to a contribution 😉