background preloader

Python + Maya

Facebook Twitter

Python Scripting for Maya Artists. This workshop is geared towards students with little to no scripting/programming experience.

Python Scripting for Maya Artists

By the end of this workshop, you will have the knowledge to write and run Python scripts inside and outside of Maya. You will not learn everything about Python from this workshop. This workshop includes all the basic information you should know in order to be proficient in reading, writing, running, and modifying Python scripts. The purpose of this workshop is not to make you expert Python scripters, but to give you a solid foundation from which in further your Python studies. Learning Python, 3rd Edition by Mark Lutz Dive Into Python: The python_inside_maya Google email list: Some Programs that support Python: Maya Modo Houdini XSI Massive Blender Photoshop (indirectly) 3ds max (indirectly) What is Python used for? Artists can Automate repetitive and/or tedious tasks. Engineers can Create applications and tools to run studio pipelines. Building Maya Interfaces with Python. Python Scripting - Home. Python Scripting - Maya Python. Download: Available for free download here : Purpose: This node is the key module in maya rigging process.

Python Scripting - Maya Python

One node for the most of the rigging process. asNode is still going to include many general methods required for rigging / animation process. It played key role in hyper skinning system as shown in below video: asNode was developed with the inspiration from PyNode in PyMel, But with extended support to Rigging process. PyMEL. =þ. Wooden Trains (Tutorial) 2:14 PM - Dec 26, 2008 Download kit here: (3MB) This is the technical side of the wooden trains work that appears on the artwork page.


I wanted to make the trains ride along the tracks and make the track layout fairly flexible. This meant making the track scripting system update somewhat automatically, making functional switch tracks, and making off-ramps and on-ramps that would let the train go "off road" and drive around on the train table. I also (despite working with Maya since 2001) hadn't really ever had the need of building a control window, so this was also an exercise in building a control panel. Icons need to be stored in This is a simple track layout. This is the actual train system. Each track piece consists of the geometry shape, two locators, and a NURBS curve. The locators have a string attribute added called "other track".

Python Scripting in Maya Tutorial. Lsystems in Python. The above information is giving us the outlines of a Python Lturtle class.

Lsystems in Python

We'd need a current state list, saved state, and rotation methods. The heading, up and left members of the state tuple are unit vectors. So we need a vector class -- something like this: from coords import Vector class Lturtle: stackstate = [] # remembers saved state delta = 0 # angle of rotation length = 0.5 # full length of turtle move thickness = 0.02 # default thickness of cylinder def __init__(self,vPos=Vector((0,0,0)), vH =Vector((0,0,1)), vL =Vector((0,1,0)), vU =Vector((1,0,0))): """The turtle will start at the origin with the Z-axis as forward direction and Y-axis as left direction.

(lparser.txt)""" self.vPos,self.vH,self.vL,self.vU = vPos,vH,vL,vU def turnleft(self): print "Turn Left by delta" def turnright(self): print "Turn Right by delta" More information on Lsystems: In the shoptalk of Lsystems, you start with axioms and rules of production. >>> axiom = 'F--F--F' L-system Maya Python Script. Visualizing L-Systems. I previously wrote a little uninspiring post about L-systems and how to generate one in Python.

Visualizing L-Systems

To illustrate their use, I took an existing system from Wikipedia and used that to develop and verify that my visualizations would work correctly. So, here is an image that is done based on the post I made earlier and new code that takes the output of the L-system generator and creates curves to render it our on Maya. And here’s the code, but please note that the blog may do horrible things to it. One could do additional tricks to create leaves by other L-systems, for example. Sean Dooley - Scripting. Continuingly along the same ideas of the last script of breaking down the creation process of an Lsystem generation, another necessary function is to read in a series of rules.

Sean Dooley - Scripting

The last script focused on creating the lstring - the string that has the end rules of the Lsystem. But it needs to get its order and creation from somewhere, from something. In this case, these definitions read an external file (sample.dat) and interpret it to something that can later be used to create a Lsystem. The script will first reference a .dat file and convert it to a string through the readScript() definition. Then it will pass that string (or parse it) the the parseScript() definition which will convert it into something that can be used in the end goal. The scripts that I used are below if you want to test these scripts. To download, Right-click and Save Target As... L-system. Maya Python Script.