So, how much python do I need to know to do useful things in blender?

I’ve always been much more of a programmer than a 3d artist, though I like attempting art, and I learned that you can do a lot in blender if you know python, and I was curious, if I wanted to attempt doing useful things in blender with python, what would I need to know at the very least? My language of choice is C# generally.

The Python API can reach very deeply into blender. You can build meshes, create drivers, animate values, change the blender UI itself, and lots of other things. If someone were so inclined, it would be possible to do meaningful work in blender using only python, and not using the keyboard/mouse UI at all.

In terms of the minimum amount of knowledge you’d need, you’d need a working knowledge of python itself, but more important than that you’d need to become familiar with the API. This can be difficult because in my opinion it’s not well documented. Because of that, it’s hard to go from beginner to advanced user in a clear way. You generally need to scramble forward in whatever way you can, solving specific problems as you go, rather than learning in a structured way.

The best ways to learn the blender API include

  1. reading existing scripts by other people
  2. reading the documentation (it’s not great, but it’s got some useful info)
  3. watching youtube videos
  4. google searches and stack exchange searches, etc
  5. using the blender UI to identify data paths to specific variables/functions

Python is much more powerful than C# and much more simple. Python achieve this by removing all “extra fat” from syntax and library complexity that does not really add to flexibility and by adding its own flexibility.

This make Python much easier to learn. Of course because in life you cannot have your cake and eat it too, Python loses a lot when it comes to performance. This happens because in order for Python to be so powerful and so simple it does a lot under the hood that leads to consume more cpu cycles.

Learning Python for someone that is already familiar with coding and have written a couple of thousand of lines of code it is a 2 day process, assuming you spend around 8 hours a day. Add to that another 7 days learning the Blender Python API. 10 days should be more than enough to make you capable to create a vast array of different addons.

For Python itself I have written a book which can be found here

https://wiki.blender.org/index.php/User:Kilon/Python_book_of_magic

Learning the API is a matter of reading the docs here

https://docs.blender.org/api/blender_python_api_2_78a_release/contents.html

You can also use any other language you like including C# via IPC. Python supports a vast array of IPC options, memory mapped files, sockets, pipes, RPC, databases and much more.

Welcome to our neighborhood :slight_smile:

The language should be the least of your problems. Python liberates you from a static type system at a massive performance cost. The syntax is weird (some might say dysfunctional). The standard library is pretty good, though.

None of this will really make a big difference, because you need a lot of domain-specific knowledge on how Blender works. Here’s one of my rants on the API. It’s not really an API. It’s mostly a set of UI-oriented bindings, at best it’s a macro system. It can be a giant pain in the ass to use. Most of it was not designed to be used by programmers, it just happens to kind of work, some of the time.

I can only warn people about investing significant amounts of time into learning this stuff, but if you need to script something, you have no other choice. You can make a lot of stuff happen (as evidenced by existing addons) through persistent yak shaving. You can also save a lot of time by automating simple things. What you often can’t do is make things work efficiently at scale, not just because Python is slow, but also because operators and data access/creation can have huge overhead.

Learning the API is a matter of reading the docs here

No. The API docs are just as autogenerated and the API itself. There’s no rhyme or reason to most of it. There’s over a thousand operators and pretty much no documentation on how to use them or whether they are usable by programmers at all. You really learn by figuring things out through trial and error, or by reading other people’s code.

The exception is APIs like BMesh, but even there useful examples are few and far between.