zooAttrScroller.mel Virtual Sliders

david | animation,dj mod,mel script | Tuesday, August 11th, 2009

I was rummaging around Hamish McKenzie's zooToolbox the other night and uncovered the intriguingly named zooAttrScroller.mel

I'd never noticed this one before so I opened it up in my favourite code editor, notepad++, to see what it did, and soon worked out that you use it to create a virtual slider in the viewport so that you can change selected attributes by dragging left or right with the mouse.

Yes, I know, you can already do that by selecting the attributes in the channel box and dragging in the viewport. So, whats the difference?

The difference is that the channel box loses focus when you change selection and you have to reselect those attributes each time. And as any rigger knows the precision you get from the channel box sliders is fixed, so if your attribute ranges between 0 and 1 then its hard to drag slowly enough to be precise. On the other hand if your attribute range is large then you will be dragging several times to get any movement at all.

I know you can use the sliders in the attribute editor to change values slowly, but why have another window open if you don't need it?

Ok, so zooAttrScroller.mel is a nice alternative that enables you to work in the viewport with a fair degree of control over the slider speed. You can wok on several objects at once and you can change selections without losing focus (although there is a catch so keep reading).

So, how does it work?

First you must install it, by downloading the rar and extracting the mel and putting it in your local scripts folder and restarting Maya. (The version you will download from my downloads page is a modified version of the one in the zooToolbox, so you will need to rename the original if you already have that installed and you want to try mine. And if you don't have the zooToolbox, thats ok too. zooAttrScroller.mel will run just fine without it. (zooToolbox is still awesome though))

Next you need to create a hotkey to invoke the script. This involves creating a PRESS and RELEASE key assignment. Press is "zooAttrScroller" and release is "zooAttrScrollerKillUI" as shown in the following two images

I chose the @ key because it seemed appropriate but you can choose any you have spare. But then there is some tricky editing of the mel file because we must tell it whether or not our hotkey requires a modifier key. For example my @ key is really a 2 with a SHIFT modifier. So open the mel script in a text editor and look for the first popupMenu command. The first half will look like this

popupMenu -ctl 0 -alt 0 -sh 1

Notice the 1 after the -sh. That's how I tell it that my hotkey uses the shift modifier. If for example you wanted CTRL-ALT-a as your hotkey, then you would change that code to

popupMenu -ctl 1 -alt 1 -sh 0

And save the script. You'll need to "source zooAttrScroller.mel" or restart maya to have it take effect.

Now we can give it a try. Select some objects (one or more). Hotkey with left click and you should see a marking-menu containing a list of the keyable attributes. Select one and when you release the mouse button the menu should disappear and the cursor should change to cross-hairs indicating that the scroller has been invoked.

When you drag with the left mouse the attribute name will display above the cross hairs with a + or - depending on whether you drag right or left.  If you hold the CTRL key while dragging then values will change more slowly. If you drag with the middle button, values will change slower than with the left, and CTRL-middle button will be the slowest of all.

Select another tool or hit the q key to exit the scroller.

If you press and release the hotkey with no mouse click, then the scroller will be invoked on the most recently selected attribute.

While the scroller is active you will not be able to select a new object by clicking it, but you can use pickwalk (or better still zooPickwalk) to jump around your rig. I've been using this a for few days now and it is quite a comfortable way of working. There are three things I may add in future updates - the ability to choose a speed setting form the marking menu, the ability to select several attributes at once, and the ability to use the alt key to temporarily suspend the scroller while selecting new object(s). Stay tuned.

Look for zooAttrScroller.rar at the bottom of the downloads page.

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck