Archive for Python

Script: Align Tool (Similar to 3dsMax)
One thing I like about 3dsMax is it’s Align Tool. The way it works is that you select the source object(s), trigger the align tool (hotkey: Alt+A), then pick the object to align to, the window that opens will let you snap specific components instantly. What I’ve usually done in Maya is that I have a similar tool, but I had to have the tool open, select and load the source objects in the tool window, choose components to align, then select the destination object, and click apply. The first method simply has one less step, doesn’t seem like a big difference, but every single step in your workflow accumulates.

Example:The way this script works under the hood is that when the script is triggered, if something is selected a scriptjob will initialize, this opens the tool window if the next selection is a transform node, when selecting a checkbox in the window it will align instantly. Clicking Apply will apply the alignment, and if you close the window it will revert back to initial transformations.The way this script differs from other similar scripts is that instead of taking the source and destination object from one selection, the scriptjob lets you choose the destination object in a separate step, which I personally find to be more intuitive.

The tool is stripped down to three options; translation, rotation and scale. There’s room to add more options, like individual components and transformation space, but for now it’s just plain and simple.

The Script:
The way I usually use workflow scripts is that I hook them up to hotkeys, so when downloading this it will include a .mel file that initializes the tool on startup and links it to a hotkey (Alt+A). For this to work you have to copy both userSetup.mel and jh_alignTool.py into your scripts directory, then restart Maya. There’s other ways to initialize python scripts/methods on startup, I just chose this method as I think there’s less room for error.

Since I put up my rigging reel I’ve received a lot of questions and requests for a tutorial on the procedural ribbons, so I’ve finally put together a tutorial on them. When I finished the tutorial I realized that it was really slow-paced, so I’ve written a script for it (attached at the bottom of this post). So for those of you that find it easier to figure out what’s going on by skimming through some code, you know what to do 🙂

This kind of technique might be old news to some people, but it’s too awesome not to be shared. These ribbons actually evaluate slightly faster than the traditional ribbon-setup, which is crazy considering they’re so much more flexible. What makes this setup powerful though, is that they utilize the nonLinear deformers in Maya, which means you inherit the same flexibility as you have with deformers, so you won’t take a performance-hit as you’re just adding functionality to an already existing deformer. This technique could of course be altered to ride ontop of FK-rigs, which could be used to rig tails/tentacles/fishes etc. When I figured out this technique I felt like it opened a door to a new way of thinking about rigging challenges.

The tutorial:

The script:
The ribbon produced by the script is almost identical to the ribbon created in the tutorial, with the exception of some cleanup in the setup and an option to offset where on the surface the twist occurs.

So, I’ve finally started to look into Python 🙂 I haven’t taken the OOP functionality into use yet, I’m just starting off by getting used to the syntax before I dive into classes and stuff. On that note, I recommend checking out Zeth Willie‘s video: The basics of using Classes and OOP in Maya/Python. That was the kick in the butt that I needed to get off the fence and try something other than MEL, quite refreshing actually!

So the first version of the Cartoony Wheel Rig looked to work ok when playing around with the rig, but when doing some actual animation I wasn’t too happy with it. There’s particularly two things that I wanted to fix in the next version, the first thing is that you were totally limited to the lattice, which means that you couldn’t hit a specific shape unless the lattice allowed for it. The second issue was that you couldn’t do big things with just one controller, I would always end up having to move/rotate three or more controllers to hit each shape, which means slower workflow.

So for this version I added the possibility to actually add blendShapes to the wheel while maintining the shape when spinning the wheel, so if the rig can’t reach that specific shape you want, you can just add it yourselves. I also got rid of the motionPath-controllers, they were a bit messy and the rotations didn’t work too well. I think this rig will work a lot better than the previous, but I’ll do some test-animations with it in a while to see how well it works.

Here’s the script in action:

This version is a bit cleaner than the first version, though it’s a bit slower because of the wrap-deformer. I’ve added an option to turn on a proxy-object through main-controller so that it evaluates a bit faster.

If you have any feedback/critique I’ll be more than happy to hear about it 🙂