Sunday 26 September 2010

Mel and QT

I've kept on scripting on the side of rigging and pretty happy with progress, thought i'd share a couple of useful tips...

as most know, Maya 2011 uses QT for its interface now and makes things far, far easier and quicker to create UI's for it, however full use some QT functions are a little difficult to command with mel. However the benefits far outway the cons as you replace a 500 line code with as little as 5 lines and have full docking capabilities and a good 2hour scripting slog for the UI with 5 minutes in QT Designer...

first things first, plan ahead -
the hardest bit i find is not the scripting at all, but knowing what i need to "connect" etc to get the desired effect/control, so as Milan pointed out, make a flow chart so you can see what needs to drive what and so you avoid cycles.

be experimental -
most of the progress i've made with QT was just playing around.

QT Designer is more flexible than you might think... for example to assign a global proc to run on a button click, you add a new dynamic attribute with a "-c" (or "-command") and then put in the proc name. Simple. but you can take this further, say with a list view, if you want to add a double click command you add a "-dcc" and then the proc name, or if you want to cut down your script size and don't particularly having an entire global proc for one line , write the script in the command line in QT instead, as once the button's pressed in Maya it runs whatever is in the cmd line anyway.

if your not sure how to perform and action with mel, try turning on "Echo All Cmds" and watch how maya performs the task.

use maya help!! (and check the flags for commands) it really is there for a reason :)

one final note, im annoyed atm with a major bug with maya 2011 and even traces of it in 2010 - where gimbal has seemed to become default with no recovery. this has appeared to have come on in the last week or so in various companies and were still waiting to hear from autodesk about this.