It looks like you're using an ad blocker! I really need the income to keep this site running.
If you enjoy BlenderNation and you think it’s a valuable resource to the Blender community, please take a moment to read how you can support BlenderNation.

Blender 2.5 Python Code Snippets

21

Blender 2.5 Python Code Snippets python scripts documentation 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

Share.
  • http://www.qso.com/carlautta/colin/Beta/ Tynach

    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 :)

  • http://www.jarred.co.za Jarred

    Brilliant, thank you for the effort!

  • kaisaki

    Thanks!!!

  • SNJ

    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.

  • http://www.blendernation.nl WimdB

    Thanks for sharing. Very much appriciated.

  • pixnlove

    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.

  • http://hostomato.com/ Olav

    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.

  • txrx

    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

  • http://patriarchproduction.com Consideringthepickle

    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.

  • Blending BriGuy

    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.

  • FloridaJo

    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.

  • python

    very helpful, because you hardly can find material for learning python. Thanks...

  • http://4museman.wordpress.com 4museman

    That looks very very useful! Thanks so much!

  • kikko

    nice and very helpful thanks!

  • http://www.dofbi.com genova

    thank you, its really gonna help me on artistic projects with Blender

  • Ali

    thank you very much !

    your scripts helped me a lot to understand how things work in Blender2.53

    keep going !

  • http://www.issogood.com Swiss3D

    thank you very much! this is just what i was looking for!
    indeed very helpful!

  • Thomas Larsson

    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.

  • http://www.blendel.com Swiss3D

    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 :)

  • Fonsch

    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?

  • http://www.facebook.com/nathan.martin.501 Nathan Martin

    the updated rapidshare link doesnt work.

Share.