A guy I work with named Rod Clifton recently unearthed this little gem that he made a long time ago. It was never finished, but I still smile when I watch it even though I know what is going to happen.
All year I have wondered why Maya 8.5 lets you select some objects and create a render layer containing those objects with a single click - but for display layers you have to create an empty layer and then add your objects using the drop-down menu.
For myself and anyone else who likes to keep clicks to a minimum I modified the layerEditor.mel
As you can see, there is a new tab button (far right) and a new menu item called "Create Layer from Selected".
Placing it in your local scripts folder means it will be used instead of the one installed by maya. This is safer than actually overwriting the maya version. Then if you find any problems you can simply delete the modified version.
How long would it take to create an animating chain and sprocket setup like the one in this picture? Thanks to a really cool mel script by Dave Lake, you can do it in a matter of seconds. Check out the UI.
Three clicks and you hit "play" and it animates. There is even a little chain jiggle on the slack side. Very nice!
I grabbed the whole lot which meant I ended up with over 80 mel scripts, not to mention the bitmaps. Some organization is required to keep things tidy. Time to talk about modules.
Modules are a way to package mel scripts, icons and plugin files in their own folder, which could be anywhere on your system. It avoids cluttering your usual maya scripts folder and keeps related files like icons in the same location. If you are part of a team you could have a shared module folder on the network to make updates easier.
The module folder can contain sub-folders called scripts, icons and plug-ins and maya will access them just like your normal scripts or plug-ins folder. The .mel files go in scripts, the .xpm's and .bmp's go in icons and the .mll's in plug-ins. (Actually there are no plug-ins to worry about with the Davvey tools, but if there were...)
There are two ways to tell maya about the module.
Method 1: Using the default modules definition folder
By default maya looks for a folder called modules in your maya application folder. If the folder is found maya will look in it for module definition files. These are simple text files that give the name of the module and point to the location of the folder.
For example my folder called X:\david\maya\8.5\modules contains a text file called DavveyWorld.module, which contains the following text
+ DavveyWorld 8.5 X:\david\maya\DavveyWorld
Method 2: Using the Maya.env file
You can also use Maya.env to tell maya to look in other places for module definition files.Maya looks for Maya.env in X:\david\maya\8.5 and I would need to add the following line
MAYA_MODULE_PATH = X:\david\maya\DavveyWorld;
then maya would look in X:\david\maya\DavveyWorld for a module definition file, like the one described in method 1.
If you have several different modules just add a module definition file for each one. If you use method 2, the Maya.env line needs to specify each folder in a semi-colon seperated list like in the following example
NOTE: The name of the module definition files is unimportant. Maya simply reads the all the files in the folder you specify looking for a line starting with "+". This means you should not mix module definition files with other kinds of files. For example if your text editor creates backups you should delete those before starting maya.
Which method you choose is upto you. Method 1 probably suits a single user working alone. I can look into X:\david\maya\8.5\modules and see immediately what modules are installed. I can make changes to a local copy of the module without upsetting anyone else. On the other hand, method 2 may be better suited to a group of users where setting up shared module folders ensures everyone is using the same version. Each user just needs a copy of Maya.env.
Hamish McKenzie's zoo toolbox has some very useful animation tools. Here are some I have used in the last couple of days with a few modifications.
zooKeymaster.mel invokes the UI shown above. You use it to nudge keyframes forwards and backwards and to scale animation curve values relative to a selection of pivot points. What is really cool is the "curve pivot" mode. For example you can specify the pivot to be "max" and activate "curve pivot". When you "push up" or "push down" the curves are each scaled relative to their own maximum value.
The absolute flag plays an important roll in how the scaling works. Setting the "absolute" flag means the keyframe value is always decreased when pushing down and increased when pushing up. If "absolute" is NOT set, then "push down" means scale the keys to be closer to the value of the pivot. This can be a little confusing until you see it in the graph editor, but essentially it means that a keyframe whose value is less than that of the pivot will increase in value (moving it closer to the pivot value) if you "push down".
I discovered that the "absolute" flag was ignored when the "curve pivot" flag was set, so I made a small modification to the code to fix that. You can download it at the end of this post.
zooTangentWorks is a marking menu that can be created from the zooToolboxUI. To take full advantage of this wonderful menu you need to use weighted tangents with unlocked weights. You can then use it to sharpen/unsharpen or tighten/untighten tangents in increments, which is much less trouble that manipulating the tangent handles directly. But the best function of all is "make sensible tangents".
"make sensible tangents" pulls your animation curves into shape by minimising the exagerated over-shoot that often results from spline tangents, but it avoids the jerky feel of using linear tangents. You specify a "sensible factor" so the curve reshaping is incremental. I have the marking menu assigned to a key, but "make sensible tangents" is the default action for tapping the key once. So as I animate I can quickly tap it a few times to iron out those kinks.
zooSetKey.mel & zooKeyCommands.mel Together this pair of scripts make the marking menu shown above. This menu provides some really powerful animation tools.
For example sometimes I animate something and think in hindsight that I would actually like the pose at one keyframe to be a bit closer to the look of the previous keyframe. So I step back a few frames in the timeslider and use "copycat value towards next" to copy this inbetween pose to the next keyframe.
A more complicated example involves the concept of "space switching" or "dynamic parenting". Rigs built with zooCST have space switching capability on most of their control objects. You can animate the parenting of the control objects and their transforms are automatically recalculated to maintain orientation under the new parent. The "setParent" functions in this marking menu allow you to take an existing animation that has animated parenting and to reparent the control objects. The values of all the keyframes are recalculated to work under the new parent. This is heavy duty stuff, but once you get the hang of it its quite easy to use.
The features highlighted in yellow in the image are my additions.
When I'm rigging a character in maya I generally use some kind of auto rigging system. My current preference is Hamish McKenzie's zoo toolbox (zooCST). This means that things pole vector constraints are created for me. Recently I was helping Jeremy rig something where the auto rigger just didnt seem appropriate. When we got to adding the pole vector constraints, Jeremy asked why we couldn't just put the control objects where we wanted them. He was getting frustrated because the joints would rotate when he added the constraint.
With zooCST I knew how to put a control object at the exact location that would not cause this rotation, but my collegue insisted that we should be able to just place the control object where we wanted, click a button and let maya figure out how to keep the joints in place.
After some searching I found a little mel script on highend3d called nilsNoFlipIK.mel (written by Nils Lerin). It lets you specify a vector and an ik handle and it calculates the twist value required to keep the joints from rotating. Since the ikHandle.twist can be calculated for a given vector, I just needed to figure out how to calculate that vector from the location of the control object.
Maya 8.5 service-pack 1 fixes an API bug that affected Michael Comet's poseDeformer plugin. A few months ago I compiled a working version for maya 8.5 by changing the source code, but this was only a workaround and not a complete fix. With service-pack 1 installed I was able to recompile a working version of the poseDeformer using Comet's original source code. This version only works correctly if you have maya 8.5 sp1
The maya "heads up display" or HUD provides useful information right there in the viewport so you dont have to look away from what you are working on. Like most things in maya, the HUD can be customized using mel. Here are two little mel scripts that I use regularly: frame-counter and memory-spy.
frame-counter puts the current frame number into the bottom left corner of the viewport so that it is burned into playblasts.
memory-spy shows your system free-ram value in the top right corner. If I'm working on something where maya keeps running out of memory, this heads-up is a visual reminder that I need to exit and restart, or save the scene before I lose work to a crash.
To install these just download and extract into your scripts folder then add the following lines to your userSetup.mel...
When you restart maya you will have two new additions to your "Display|Heads Up Display" menu.
I have set mem-spy to be active by default, and frame number hidden by default. (You can change this behavior by editing the relevant mel file. Look for the lines with "-vis 1" and "-checkBox true" and change them both to "-vis 0" and "-checkBox false".)
Thanks and Credit to the coder's from whom I copied these techniques. memSpy was based largely on code by Alin Sfetc, and frameCounter by someone whose name eludes me now. Thanks to both.
The maya 8.5 mia_material has attributes for BRDF which is like a built-in facing-ratio type control for the reflectance. It can be confusing for new users to find that the labels called "Refl Facing View" and "Refl Perpendicular to View" are actually the wrong way around. The error can easily be fixed by a simple edit to the AEmia_materialTemplate.mel file
(original version in C:\Program Files\Autodesk\Maya8.5\scripts\AETemplates).
The label names need swapping between lines 274 and 276.