I want to learn Python for Blender

I am not sure where to post this, but I want to learn Python for the purposes of expanding blender’s capabilities. I just don’t know where to start learning. I know that I could be very good at programming or scripting because that’s just how I think; very logic driven.

Let me give you an example of something I need a code to do. I am very interested in geometry and phi. I can manually create a golden spiral with circles and such, but I would love to build a 3d golden spiral which I think is a nautilus shell actually. I think this would be a good project to learn python for. At least get my feet wet. Am I over reaching? Should I start smaller?

Help me out. I haven’t attempted code since qbasic.

Hie, I am a programmer too, a Python perhaps, nothing else, You should start at the basic of Python, there you can get an solid and in depth understanding on how Python codes works, learning Python takes a while, but it was all worth it, Anyways, here is the book to get you started, This book is for beginners but luckily it gave you almost anything you need to learn in python including functions, variables, etc. :


after you learn it, review it, master it, you can now strait down to learning Blender’s API:

You can also learn some really deep in python like learning algorithms, how to build your code in the proper way. Expect difficulty and frustration, and boring perhaps, But that’s just how it is, learning is boring, but if you have passion on it, It’ll be like a piece of cake.

Good luck,

P.S > Don’t forget to choose the best coffee. :smiley:

@BrentNewton, I really liked http://www.codecademy.com/tracks/python classes. It’s in an easy to use online form that’s free. Give it a try to learn Python then jump into the Blender API. At one point Ton was looking into adding Blenders API to Code academy but not sure what came of that.

Open up the Text window inside Blender and take a look at the provided python Templates menu. A lot of good working example code there.

Thanks guys. Great advice. You’ve given me some leads to run down. I will stick with it until I get it. Expect lots of stupid questions to follow this. =)

Assuming you know (enough) python, here are some suggestions for programming in blender (possibly already mentioned):

  1. Look at (working) code other (more experienced) people have (recently) written:
    1.1) the blender Info area (where the main menu is) (you can pull that down and observe)
    1.2) the templates menu Atom mentioned
    1.3) the code available in the ‘Released Scripts and Themes’ forum: http://blenderartists.org/forum/forumdisplay.php?48-Released-Scripts-and-Themes
    1.4) the (official/bundled) addons: http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts

  2. Try to start small and build up your own code-base. To be able to implement the ‘nautilus spiral shell’, for example, you’ll have to be in touch with some (sub-) areas/disciplines:
    2.1) General Math/Geometry. I understand from your OP that this shouldn’t be a problem.
    2.2) Blender Geometry (meshes, polygons, edges, vertices), and how to create them in Blender.
    2.3) Blender GUI – you probably want to define/visualise some parameters to control your script/addon.
    In short: get your feet wet one toe at a time, and be organised about it. Try to keep things in separate files (.py), or even projects (.blend files and/or addon directories). Eg, make a UI/Operator/addon that moves the selected object in the X-direction whenever you change a FloatProperty. And make a button that prints the names/types of the selected objects. Try to have a collection of simple (often recurring) functionalities to build upon. Break up your projects into smaller sub-projects/files/objects whenever possible.

  3. Know blender. If applicable: try to do it manually (via the user interface) before you try to do it automatically (through code) (see also tip 1.1).

  4. Use your search buttons wisely and frequently, eg, on http://www.blender.org/documentation/blender_python_api_2_70_0/, http://blenderartists.org/forum/, https://www.google.be/ and C:\Program Files\Blender Foundation\Blender\2.69\scripts\addons. And don’t necessarily search for code; also search for (possibly existing) blender functionality, and work your way back to the code from there (see also point 3 above).

  5. Be prepared for some significant mood swings, as you go through several frustrating hours of trying to find out why it doesn’t work as you expected to some exhilarating moments when you feel like the king of the world… :slight_smile:

And don’t forget the free ebook Programming Add-Ons for Blender. I have learnt a lot with it.

ugh, I have a LOT to learn. I need a lesson plan designed to teach code to a person like Honey Booboo. Is there a python for the mentally handicapped? =)