Python's the Lingua Franca of CG
I think it is pretty safe to say that Python has become the mostly widely adopted scripting language across many, many CG and VFX applications. A few years back almost every tool had its very own choice of scripting language. They pretty much still exist and from pure history they are still heavily used for existing tools or just for the fact that developers, TDs and artists rely on them because they know them well. Python increasingly replaces them across the board though.
Widespread Industy Support…
So let’s have a brief look what applications support Python these days - and this list is definitely neither complete nor well researched as it is what comes to my mind right now:
- Maya (natively using MEL, a TCL dialect)
- Softimage (using the Windows scripting host, previously supported VBScript and JScript)
- Modo (in addition to Perl and LUA)
- Houdini (starting to replacing HScript)
- Renderfarm tools like RenderPal, Deadline, Cube!, DrQueue
- Nuke (in addition to TCL)
- Fusion (in addition to eyeonscript which is based on LUA)
- Toxik - now bundled as Composite with Maya etc.
… means what?
That sound very promising. One might now think learning Python will allow you to script all those applications and use the same scripts with different applications. They all support Python, don’t they?
Unfortunately the language itself is just a minor part. Just like a C++ program does not automatically run on Windows, OSX and Linux a Python script does not work across applications. They integrate Python differently and more importantly, they have very different APIs (Application Programming Interfaces).
It not as grave though. Python clearly has the advantage that you do not need to learn the language each time, just broaden your vocabulary. Python is easy enough to be picked up by an artist but powerful enough to provide all the bells and whistles for an advanced programmer. So it scales well. Scripts grow in complexity over time and Python allows that without the need to resort to clumsy workarounds. It allows to build up libraries and resort to existing ones to build upon blocks of prior, tested code.
The first step in learning a programming language would be to get acquainted with its basic syntax. How to declare variables to store values and basic flow control. Luckily Python is pretty easy to pick up in this regard.
After knowing the basics you need to learn about you applications APIs that allow you to interact with your scene data. That’s more taxing. Some applications record your interaction into an log that shows what APIs were used. That is a good starting point to pick up the necessary functions to call. More often than not you would need to consult the documentation or get some scripts from the Web and examine them. Use them as starting points and modify them to do what you need.
Initial scripts should help you get things done faster. Often it’s enough to collect several steps you do manually into a script - making them work as macros that perform several steps at once. Next, you might want to give them some intelligence. Have some conditions in there that do things differently depending on what data they work or what parameters you provide for them. From there the sky is the limit.