I've been playing about with Maya api, with python, a bit more. I took my experiences from this post on a bit further. The previous node i created, in the mentioned post, had a few downfalls as to useability. The main one was I could only define a radial offset from the comparison axis. I wanted to be able to define a more arbitrary shape for the angle comparison, essentially I wanted to elongate the shape, This would help me define more useable shapes to define as my target pose. If that makes any sense! Anyway here’s the node in action.

The node outputs a 0-1 blended value representing if the axis of the node is within the range set. I've just piped that output into a sphere for visual guide.

This node should aid my rigging in terms of deformations. My main reason for wanting to create this, was a solution to some armor rigging that is needed in work. Here's a super rough, quick test where I'm driving an aim constraint and its up vector node via three volume range nodes.
And here’s the obligatory bicep deformation shot. Again a very rough test, but should help give you the idea... like you needed it!
I'm starting to look into Communicating between applications from Maya. So If you’re looking to install the COM python module for Maya, here's how I got it working.

Get the appropriate installer here
    For Maya 2012 64 bit get the pywin32-217.win-amd64-py2.6.exe
    For Maya 2012 32 bit get the pywin32-217.win32-py2.6.exe
Run the downloaded executable, it should install to your C:\Python26\Lib\site-packages.
Copy the contents of that folder to your C:\Program Files\Autodesk\Maya2012\Python\lib\site-packages.

That should do it!

Of course be aware of what other packages you had installed previously in both site package folders, if you're concerned about overwriting something.
..Maybe because I am.
    ls -type "joint" "|*" ;
Sometimes we just need to get something working, and we write functions to get simple pieces of data or whatever. Well I was at my desk recently and the above piece of code just dawned on me. The amount of times I've written code to get all joints at the root of the scene, looping parent queries.... Sometimes I feel stupid.

If you want to display a custom ui and halt all other maya ui interaction whilst it's open, here’s a script.

This uses Maya’s new-ish layoutDialog ui element, and it basically lists things and returns the user's specification. Nothing special, but it is nice that it basically acts like a confirmDialog.. The code is a bit hacked together as I originally thought I could get a textScrollList, in python, to simply accept data with some *args or **kargs callback functions, but no joy there. So I had to wrap this up in a class and use some class attributes to store and access the needed data on events.

Anyway here's the script. This may not be the cleanest way to do this, but I had to get it working. Hope someone finds it useful.

File Size: 3 kb
File Type: py
Download File

I wrote another custom node, again beholden somewhat to this post, that basically calculates the angle between to vectors.

It takes in two world space matrices and compares specified axis (x,y or z) of the nodes. It returns a ranged, 0-1, value based on user set bounds (actually the node outputs a ranged angle, full angle and dot product). Its really pretty simple but should come in handy.

I have tried to make this setup before, using Maya utility nodes and some elbow grease, but It was always quite cumbersome and I was a bit off with the math, So I thought an api node would be a better bet. So I created a nice self contained node that does it all for you and gave the user a nice display.

Here it is in action. I piped the output into the scale of the cube for visual cue of the output. 
I think i can take this a bit further, I'm thinking of trying to make this calculate a u-v space bounds of a sphere, so i can cut a more complex piece of a sphere to calculate if the vector is inside. We'll see how far i get with that!
I wrote a custom locator node for use in my rigs a while back, thought I'd show it off.

As many other have, I'm sure, I read through this post and started playing about with the methods outlined.  It's a great tutorial for anyone looking to get into the python api, so check it out now! Yes, stop reading this and go there if you haven't already,

I took it a little further and wrote a node that could be used as an all purpose controller for rig setups. One of the main pluses of this node is that it can be set to 'draw on top', which is very nice for making aesthetically easy to understand rigs. Credit needs to go to Christopher Lewis also for help on the openGL depth methods for that.

I also wrote in the ability to change the draw shape, rescale the drawn shape, edit transparency and other settings.

I've been using it for a while now and its working great!

Post Post Edit! I found a much easier way to do this. :D
    scriptJob -uiDeleted "uiName" "someFunction";
Ah well, I learned something anyway!

Add a callback when a window is closed.

Can come in really handy when you have heavy ui usage and require post tool cleanup or whatever.

from maya import OpenMaya
from maya import OpenMayaUI
import maya.cmds as cmds

def makeTestWindow():
    window = cmds.window( 'TEST_WIN', title="Long Name", iconName='Short Name', widthHeight=(200, 55) )
    cmds.columnLayout( adjustableColumn=True )
    cmds.button( label='Do Nothing' )
    cmds.button( label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)') )
    cmds.setParent( '..' )
    cmds.showWindow( window )
    return window
def uiDeleteCallback( *args ):
    This is the function that will be called whenever the ui, passed to the MUiMessage.addUiDeletedCallback( window, uiDeleteCallback )
    is deleted
    cmds.confirmDialog(-message "The Window Was Closed!!!") 

# make a test window
win = makeTestWindow()

# create the callback to run when the ui is deleted
uiCallBack = OpenMayaUI.MUiMessage.addUiDeletedCallback( win, uiDeleteCallback )

# removes the callback from memory
#OpenMaya.MMessage.removeCallback( uiCallBack )

File Size: 1 kb
File Type: py
Download File

Here's a face rig that I created around two years ago. Its was a bit of a prototype, but i think it works quite well and is worth posting. It uses some nurbs shapes for the major parts of the face, and drives joints attatched via some hair follicle nodes. Nothing too fancy. The face for my Jedi character is based on the same type of rig, though that character has improved control of eye deformation and more control of the mouth region.

The animation below was done by Gary Talbot, a top animator at Rare.
One of the requests for this setup was that animation could be shared across rigs easily. This is acheived, in this instance, by manipulating the nurbs shapes and fitting them to the required face. Then its a case of reconnecting the joints of the face. Below is a test for this, though it has some issues it proved the concept would work across faces of different proportions and styles.
test.....test :D

Welcome to my blog. hopefully I'll write something vaguely interesting, once in a while.