background preloader

Python Scripting for Maya Artists

Python Scripting for Maya Artists
This workshop is geared towards students with little to no scripting/programming experience. 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. Related:  Python + Maya

Python Scripting - Home Python Scripting - Maya Python Download: Available for free download here : Purpose: This node is the key module in maya 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. And this doesn't depend on PyNode in PyMel. Features: 1. 2. asNode was developed with the inspiration from PyNode in PyMel 3. 4. 5. 6. 7. 8. 9. Updates: 2014.09.08 -- Updated asNode.rar with help file on all methods by adding 'asNode.pypredef'. 2014.09.21 -- Test files are added in asNode.rar for asN.addChild, asN.mConstrain etc 2015.02.05 -- Auto completion methods will update and change according the selection type of object And added new example maya files Future Updates: 1. Usage: Testing the asNode: p2.select() or

Wooden Trains (Tutorial) 2:14 PM - Dec 26, 2008 Download kit here: woodTrains.zip (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". The NURBS curve is the path that the train follows. Rubik's Cube Texturing Tutorial 12:00 AM - Mar 15, 2008

Lsystems in Python The above information is giving us the outlines of a Python Lturtle class. 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. We also need a way to parse Lsystem files, meaning we iterate through a set of rules (e.g. substitions) a specified number of times, and feed the resulting string to the Lturtle as a series of commands e.g. More information on Lsystems: In the shoptalk of Lsystems, you start with axioms and rules of production. In Python:

Visualizing L-Systems I previously wrote a little uninspiring post about L-systems and how to generate one in Python. 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 | Python 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. 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 tester.py 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... scriptreader.py --- Source tester.py --- Source sample.dat --- Source

Related: