So, you want to learn to do motion graphics scripting/coding and you don’t know where to start?
You’re in luck because I’m going to take the hard part out of your hands. I’ve complied a list of resources to help you get started in scripting for a variety of motion graphics applications like Cinema 4D, Maya, and After Effects.
This isn’t a tutorial, but I will be going over some basics as to what scripting/programming language each program uses, along with pointing you off into the right direction to get started so that you can create the next great plugin for your application of choice.
Let’s get started. So, what is scripting? The simple answer, is that scripting is writing code, a set of instructions, to automate a process (not make the process run), that is executed at run-time. Holy crap that’s scary! Not really… All it means is that when you write your bits of code, they work right away… or, they don’t work if you make a mistake, but hey, we are all perfect!
Common Scripting/Programming Languages used by 3D and 2D applications
First, let’s take a look at some of the common languages you will see when you start scripting that next great plugin. These will be related to the CORE of the language, and not applications specific; that comes next, but the basics always come first.
JavaScript:
JavaScript is dynamic prototype-based scripting language that is most known for being used for web browsers. There probably isn’t a website you visit that doesn’t have some sort of javascript running. Most people probably don’t even realize you can use it outside of a webpage… how sad.
Lets take a look at a quick example of some javascript
function myFunction() { console.log("Hello, World!"); return true; } myFunction();
In this example, you get ‘Hello, World!” printed out to a console.
Javascript is the primary language for scripting in Adobe After Effects, so if you are planning on making that next great plugin for After Effects, you should learn as much as you can about it.
Here are some resources to help get you started:
- http://en.wikipedia.org/wiki/JavaScript – what it is, where it came from, etc
- http://www.w3schools.com/js/DEFAULT.asp – official w3schools javascript info. tutorials and more.
- http://www.codecademy.com/tracks/javascript – some nice javascript courses for free
- http://www.tutorialspoint.com/javascript/javascript_quick_guide.htm – a quick guide for javascript
Just a quick note, pretty much any tutorial you find on javascript will be related to doing websites… do them anyway. The information will translate over to After Effects, and its invaluable to learn. Swallow your pride, and do the tutorials.
C++ or cpp:
C++ is a vernal purpose language with imperative, object-oriented, and generic programming features. C++ is a compiled language and not a script. That means, you have to do the code, then build the code into an application container, then run it. You can read all about it on the wiki which is linked below.
Lets take a look at a quick example of some C++
include <iostream> int main() { std::count << "Hello, World!\n"; }
In this example, you get ‘Hello, World!” printed out, and then a new line is created.
C++ is used for creating plugins in Cinema 4D. I’m not sure if any other applications use it, but I would not be surprised if they did.
Here are some resources to help get you started:
Python:
If any of you reading this know me, then you know that this is my personal favorite for doing scripting and plugins in Cinema 4D. Python is a general purpose high-level language that has a structure closer to real english, making it very easy to learn. As well as being a scripting language, it can also become a compiled language with the right modules.
Lets take a look at a quick example of some Python
say_hello = 1 if say_hello: print "Hello!"
Now that is a lot cleaner, and it prints “Hello!” in cause you were wondering.
Python is used by Cinema 4D, Maya, Blender, and probably other apps that I have not researched.
Here are some resources to help get you started:
- https://www.python.org/
- https://docs.python.org/3/tutorial/
- https://www.python.org/about/gettingstarted/
- http://www.learnpython.org/
- http://www.codecademy.com/tracks/python
- http://docs.python-guide.org/en/latest/intro/learning/
- https://www.learnstreet.com/lessons/study/python
- https://www.coursera.org/course/interactivepython
- https://www.udacity.com/course/ud036
Application Specific Languages and resources
Cinema 4D:
Cinema 4D uses 3 different types of scripting languages: Python, C++, and COFFEE.
COFFEE:
COFFEE Script is basically a Java and JavaScript hybrid. It’s your typical object oriented curly bracket language. The wiki article says that the name doesn’t really stand for anything and that it probably is a comic reference to Java. My thoughts? Nope. I think it refers to caffeine, and caffeine makes you crazy, and using COFFEE script makes you go crazy and want to break anything within arms reach.. at least, thats my experience with it.
Lets take a look at a quick example of some COFFEE
var a = new(array,1,1); var b = a; b[0] = 2; println( "a[0] =", a[0] ); // prints "2" to the console window
Here are some resources to help get you started:
- http://en.wikipedia.org/wiki/COFFEE_(Cinema_4D) – wikipedia article on what it is
- http://ruimac.com/coffee_book/ – an excellent read on COFFEE
- http://www.andrewnoske.com/wiki/Cinema_4D_-_COFFEE – detailed overview of COFFEE with plugin example code
- https://www.youtube.com/watch?v=yD5wfChv8X0 – good tutorial on scripting your own nodes, really basic.
C++ or cpp:
C++ has been the primary language for writing plugins for who knows how long; probably since Michelangelo painted naked dudes on that ceiling. Similar to what I’m going to say about python, with c++ it’s all about using the API. Download it, study it, build a shrine to it, and whisper sweet nothings onto it.
Here are some resources for you to get started with c++ in Cinema 4D:
- http://www.maxon.net/support/developer-support.html – official SDKs (c++, COFFEE, Python, Melange)
- http://www.microbion.co.uk/graphics/c4d/create_plugins1.htm – this is the guy who coded up X-Particles so pay attention to this one
- http://andrewnoske.com/wiki/Cinema_4D_-_C%2B%2B_plugins – detailed overview of C++ with plugin code examples
- https://www.youtube.com/watch?v=tN_CtBER9Xc – good beginners guide to c4d and c++ with visual studio.
- https://github.com/PluginCafe/cpp-cinema4dsdk – a new SDK project from Niklas Rosenstein aiming to update the SDK
Python:
Python is the up-and-comer for plugins in Cinema 4D. I say that, but really, Python has been around since version 12 of the software. It’s not that new. It started out as a plugin but Maxon saw the potential and quickly adopted it into the application. Just like C++, this is all about learning the Cinema 4D API and studying the Python SDK. Now, I love Maxon, and I love Cinema 4D, but I have to warn you on this… The SDK for Python in Cinema 4D sucks so bad! It’s horribly documented and for a person with no coding experience it’s like trying to read rocket science papers. The good thing though, is there are more resources and more tutorials for Python in Cinema 4D than all the other languages it uses, so making sense of this is super easy.
Here are some to help you get started with Python in Cinema 4D:
- http://www.maxon.net/support/developer-support.html – official SDKs (c++, COFFEE, Python, Melange)
- http://www.plugincafe.com/forum/default.asp – official maxon scripting forum
- http://www.cineversity.com/ – tutorials and forums
- http://www.c4dcafe.com/ipb/forum/102-xpresso-python-scripting/ – c4d cafe python/xpresso scripting forum
- http://www.c4dlounge.eu/forum/forumdisplay.php?f=30 – forum, use google chrome to translate >_<
- https://github.com/PluginCafe/py-cinema4dsdk – a new SDK project from Niklas Rosenstein aiming to update the SDK
- https://github.com/n1ckfg/C4DToolbox/blob/master/c4dtoolbox.py – a set of helper functions by Nick Fox-Gieg
- https://lesterbanks.com/2011/10/an-introduction-to-using-python-in-cinema-4d/ – and introduction to python using Cinema 4D from 2011
- http://www.fxphd.com/fxphd/courseDetails.php?idCourse=339 – C4D208: Python Scripting in C4d
- http://avd3design.com/?p=185 – good explanation of pros and cons of various python uses in C4D, with examples
- http://www.smart-page.net/blog/2011/05/09/advanced-python-plugin-coding-for-cinema-4d/ – Advanced Python plugin coding for Cinema 4D (2011). this is a great article on setting up Eclipse for c4d plugin creation
- http://www.908video.de/lab_project/tutorial-c4d-python-sdk-and-plugins/ – good look at creating a super simple object plugin
- https://www.youtube.com/channel/UCwJi8wfXyyQnsdp-x76A5_A – Pim Grooff Youtube channel, full of python tutorial goodness
- http://blog.grooff.eu/ – Pim’s website
All Languages:
Here are some resources pertaining to all the languages Cinema 4D uses:
- http://www.peranders.com/w/index.php?title=Main_Page – excellent
- http://c4dprogramming.wordpress.com/ – awesome blog for c4d programming
Maya:
Maya uses two languages, Python and its proprietary MEL script.
MEL:
Here are some to help you get started with MEL in Maya:
- http://en.wikipedia.org/wiki/Maya_Embedded_Language – overview of MEL
- http://download.autodesk.com/global/docs/maya2014/en_us/index.html?url=files/GUID-F48E3B78-3E56-4869-9914-CE0FAB6E3116.htm,topicNumber=d30e144972 – MEL Scripting Guide from Autodesk
- http://www.melscripting.com/
- http://cgi.tutsplus.com/tutorials/procedural-modeling-with-mel-script-in-maya-day-1–cg-2941
- http://www.digitaltutors.com/lesson/6053-Learning-MEL-scripting
- http://wiki.bk.tudelft.nl/toi-pedia/Introduction_to_MEL_and_Variables
Python:
Here are some to help you get started with Python in Maya:
- https://www.youtube.com/channel/UCn_SncP23QP819Y__Ew7VIA autodesk scripting youtube channel
- http://zurbrigg.com/maya-python
- http://www.chadvernon.com/blog/resources/python-scripting-for-maya-artists/
- http://www.digitaltutors.com/tutorial/1283-Getting-Started-with-Python-Scripting-in-Maya
- http://www.digitaltutors.com/tutorial/3414-Python-Scripting-in-Maya
- http://www.maya-python.com/
3D Studio Max MAXscript
3D Studio Max uses something called MAXscript for its scripting language. From what I know, it needs to die in a fire, but it is what it is. If you love using 3DSMAX then these resources are you. I’ve looked at some code examples, and it doesn’t seem too difficult to grasp, so you should lots of fun with it.
Here are some to help you get started with MAXscript in 3DSMax:
- http://www.tdtransformation.com/sq/39639-opt-in1
- http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/
- http://wiki.cgsociety.org/index.php/Maxscript
- http://www.scriptspot.com/3ds-max/tutorials/maxscript-101-free-online-training
- http://www.allanmckay.com/site/index.php/3ds-max/68-maxscript-for-beginners-1
- http://www.3dbuzz.com/forum/threads/106481-Official-MAXScript-Tutorial-Thread!?s=9c7f428349e8e5fbe35c56dbdc2b7835
Blender
Blender is a free open-source 3D application. Being a Cinema 4D user, I never got into blender, but I have always wanted to give it a try. I mean, who doesn’t like free stuff right! One of the best parts about Blender being free and open-source is that there are a TON of awesome resources for it. I started learning Python by dissecting some of the open-source Blender scripts, so do not under estimate this software. There is a huge community around Blender, and you should take full advantage of that when trying to learn Python for Blender. The only thing Blender doesn’t do is make tasty smoothies, which is a bit disappointing for me.
Here are some to help you get started with Python in Blender:
- http://en.wikipedia.org/wiki/Blender_(software) – the wikipedia page
- http://wiki.blender.org/ – Official Blender Wiki
- http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts – Python guide
- http://www.blender.org/documentation/blender_python_api_2_70a_release/ – Python API for Blender 2.70a
- http://blenderscripting.blogspot.com/ – A script repository for Blender
- http://cgcookie.com/blender/2011/08/26/introduction-to-scripting-with-python-in-blender/ – a good video intro on scripting with Blender
- http://blenderartists.org/forum/forumdisplay.php?11-Python-Support – Python support thread at blenderartists.org
Adobe After Effects
After Effects is a little different in terms of scripting/expressions. Here, you are dealing with Javascript. As mentioned in the start of this article, most of the tutorials you are going to find for JavaScript are going to be dealing with creating things for web pages, but you should do those tutorial the best you can because the javascript knowledge is transferable to AE. My best advice here, is to print out The After Effects Object Model and tape it to the wall directly in front of you; it’s invaluable.
One thing I will touch on here is the difference between After Effects scripting and After Effects expressions. Now, this is my take on the two, and is probably not the official definition of the difference, but a script is called and runs 1 time (or however many times the script is written to run) and an expression is something that is in your timeline and runs all the time. So, script is an outside file, expression is in your timeline. Dylan Winter, who will be linked to shortly, had a great definition, “Expressions will make you a king of your workflow, scripts will make you a god.” Bingo to that my friend.
Here are some to help you get started with Expressions in After Effects:
- http://helpx.adobe.com/after-effects/using/expression-basics.html – Adobe’s Expression Basics
- http://forums.adobe.com/community/aftereffects_general_discussion/aftereffects_expressions – Adobe Expressions forums
- http://forums.creativecow.net/adobe_after_effects_expressions – Expression Forums at Creativecow
- https://vimeo.com/7471983 – harry frank expressions video, old but relevant
- http://www.graymachine.com/ – Anything by Harry Frank… period.
- http://www.jjgifford.com/expressions/tables/ – great list of expressions and parameters, i use it constantly
- http://www.schoolofmotion.com/intro-to-expressions-after-effects/ – some expression basics
- http://aenhancers.com/ – a forum for expressions and scripting
Here are some to help you get started with Scripting in After Effects:
- http://helpx.adobe.com/after-effects.html – official Adobe stuff
- http://blogs.adobe.com/aftereffects/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf?file=2012/06/After-Effects-CS6-Scripting-Guide.pdf – The official Scripting guide, learn it.
- http://download.macromedia.com/pub/developer/aftereffects/scripting/JavaScript-Tools-Guide-CC.pdf – another adobe scripting guide
- http://www.adobe.com/devnet/aftereffects/sdk/cc.html – Adobe official SDK download
- http://provideocoalition.com/pvcexclusive/video/after-effects-extendscript-training-ep-1-2-3 – a comprehensive serious on tutorials. if you want into scripting, do this.
- http://creativedojo.net/learn-after-effects-scripting/ – Vihnsom Nguyen’s site, Creativedojo, is beyond comparison for scripting
- http://www.fxphd.com/fxphd/courseDetails.php?idCourse=196&v=popup – paid training, but worth it.
- http://cgi.tutsplus.com/tutorials/introduction-to-the-basics-of-after-effects-scripting–ae-22518 – some scripting basics
- http://www.motionscript.com/mastering-expressions/table-of-contents.html – a simple rundown of some more basics
- http://sanfranciscoburning.com/ – Dylan Winter’s website, a ridiculously useful scripting resource
- https://vimeo.com/53984499 – Dylan Winters Intro to After Effects Scripting – AWESOME
- http://www.crgreen.com/boethos/ – if you want to create UI panels, use this… its magic
General Resources and places to find help
The motion graphics community is a great place to get help, and twitter is where you will get it the fastest (in my opinion)
You should seek these people out if you need some guidance!
Search Engines and video sites!
Nothing beats a good old fashioned search query.