ThomasL has published a useful 74-page Python 'cookbook' for Blender 2.5.
ThomasL writes:
With the arrival of the Blender 2.5x versions of Blender, Python scripting is taken to a new level. Whereas the Python API up to Blender 2.49 was quite incomplete and ad hoc, the API in Blender 2.5x promises to allow for python access to all Blender features, in a complete and systematic way.
However, the learning curve for this amazing tool can be quite steep. The purpose of these notes is to simplify the learning process, by providing example scripts that illustrate various aspects of Python scripting in Blender.
The focus is on data creation and manipulation. Here is a list of the topics covered:
- Meshes.
- Vertex groups and shapekeys.
- Armatures.
- Rigged mesh.
- Applying an array modifier.
- Three ways to construct objects.
- Materials.
- Textures.
- Multiple materials on a single mesh.
- UV texture.
- Object actions.
- Posebone actions.
- Parenting.
- Drivers.
- Particles.
- Hair.
- Editable hair.
- Texts.
- Lattices.
- Curves.
- Paths.
- Camera and lights.
- Layers.
- Groups.
- Worlds.
- Render settings and viewports.
- Batch run.
Some of the things that you will not find in these notes, at least not in the present revision:
- User interfaces, button layouts, etc.
- Macros, acting on what is currently selected.
- Nodes, for materials, compositing, etc.
- Game engine stuff.
- Brushes and sculpting.
- Advanced rendering, video compositing, ...
Links
21 Comments
First post!
Downloaded, and I'll take a look at it! I wanted to learn Python programming for 2.4x, but I never did. Maybe that's a good thing, since now the API is so different :)
Brilliant, thank you for the effort!
Thanks!!!
I always find examining code examples a much better way to learn a new language/API than trying to follow convoluted tutorials.
Thanks very much for these.
Thanks for sharing. Very much appriciated.
Now this sound like a new opportunity for me to learn Python Script with 2.53
Thank you for your this stunning piece of Work.
Great! I spent a few hours with 2.53 recently, and it's an incredible piece of software. Good examples and documentation is a plus! Thanks.
Awesome! Thanks! Keep em coming, nothing schools you more than trying out and editting an example! I can really have some fun with these! :D
Interesting. I've always steered clear of the overwhelming task of learning Python... one snippet at a time sounds like a more reasonable way to go. I'll have to look through this.
I liked this little glitch in the readme file:
"Some of the things that you will not find in these notes, at least not in the
present revision. This is not to say that these are important topics."
Just slightly amusing to me somehow.
Hey, thanks for taking the time to do this. Very nice of you.
I appreciate this as I'm wanting to learn more about Python in Blender.
Cheers.
very helpful, because you hardly can find material for learning python. Thanks...
That looks very very useful! Thanks so much!
nice and very helpful thanks!
thank you, its really gonna help me on artistic projects with Blender
thank you very much !
your scripts helped me a lot to understand how things work in Blender2.53
keep going !
thank you very much! this is just what i was looking for!
indeed very helpful!
Update: The examples in the original document from August do not work anymore, due to changes in Blender's python API. A second edition, updated for Blender 2.54 and with many new examples, can be downloaded from
http://rapidshare.com/files/425538067/Code_snippets_updated_for_Blender_254_2010_10_17.zip
Major changes:
* The scripts work with Blender 2.54. More precisely, they have been tested with Blender 2.54.0 rev 32510, compiled from svn, on Ubuntu 10.04 64 bit.
* User interfaces (panels, buttons, properties, menus, polling).
* Simulations (cloth, softbodies, particle fire, smoke, rigid bodies, fluids).
Since the API is now supposed to have stabilized, there is a fair chance that most scripts will continue to work for the foreseeable future.
thank you so much!
i realized that 2.54 is quite different myself, tried to figure out the diffs myself, but your code snippets make it so much easier :)
I learned quite a lot by reading your document.
I have a question though: how would you make a reflecting material? I'm pretty sure it has something to do with MaterialRaytraceMirror, but I can't get it to work.
Any ideas?
the updated rapidshare link doesnt work.