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.
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 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.
689 total views, 1 views today
Script: Measure Rig Performance
As a rigger you have to get along with the animators, and a good startingpoint for that is to provide them with fast rigs. If the animators have to playblast for each time they want to see the actual animation, they are going to waste a lot of time!
I asked this question over at Rigging Dojo about a year ago:
I often find myself implementing a lot of stuff in a rig, stuff I think the animators may need. As I’m improving my rigs, I get more nodes and more calculations going on to achieve what I want – which in the end may result in performance issues with the rig when animating. I’m trying to find out if there’s some way to measure the performance of a rig-component? I find it really hard to find out which components that slows down my rig, as I have to add and animate all of the rig-components together, and then try to compare the playback-speed, remove components, re-check, etc. How do you guys approach this? Also, is there any documentation of speed differences for expressions vs nodes, extra joints vs corrective blendshapes, skinClusters vs wrapDeformers, constraints vs normal parenting, etc?
I got a lot of interesting answers in the thread, but one in particular from Josh Carey (a mentor on Rigging Dojo) helped a lot. He tipped me off on dgtimer, which does exactly what I asked for. So I’ve just wrapped this into a clean little script.
The script measures the speed by playing off the scene and evaluating each DG node’s performance, which means that for the object(s) to actually be evaluated you have to animate each component (that you want to be included in the evaluation) over a given timespan, the more frames you calculate from the more accurate the results will be.
So if you have a rig that runs too slow, you can use this script to see which node(s) that does the hardest impact on the performance. You often find that it’s just a couple of nodes that really takes onto the percentage, stuff like wrap deformers are something you want to avoid (at least in the proxy-rig) 🙂
I’ve uploaded a video to demonstrate how it can be used, in the video I’m using it to compare normal parenting, direct connections, constraints and skinclusters.
6,807 total views, 3 views today
Script: Cartoony Wheel Rig v1
When rigging vehicles you’ll usually have to deal with at least two wheels, and (especially if you’re going cartoony) you’re going to waste a lot of time if you’re rigging them manually, one by one. So I decided to write a script for this, the script is supposed to do all of the work automatically, and it should work with wheels regardless of size and position.
The requirements I set for the rig was that it had to be clean, fast and flexible. It should also be animationfriendly, so the controllers have to be logical and easy to select. With this current version of the rig I’m not too happy about the flexibility in particular, it works, but it can’t be pushed as far as I want it to. I’m going back to the drawing board.
Here’s the script in action:
The current version is basicly just a lattice with some clusters, and a nurbs-circle with all of the extra-controllers connected to the circle through MotionPath-nodes. As for the main controllers, I have a contact-controller for floor contact, two controllers for the rolling of the wheel, and one main-controller for translation/rotation/scaling.
4,107 total views, 3 views today
Script: Delete Flat Keys
When you’re working with animation you eventually end up with a lot of extra keys, by that I mean flat keys, keys we don’t need.
See the image below, I’ve marked the flat keys with red dots:
With the script you just select all of the objects that you want to clean the keyframes on, then you define the angle threshold, and the script will go through and delete all of the keys with a lower angle threshold than specified.
When ran on the example above, we end up with this:
6,424 total views, no views today
Script: Hide/Display Local Axis
It can be a hassle to turn on/off the local axis of multiple objects simultaneously, the reason for this is that by default there’s no on and off option on “Display > Local Rotation Axis“, it’s just a toggle. This means that if you select a bunch of objects and toggle the local axis, the objects that already have the local axis visible will be hidden, while the rest of the selection’s local handles will be visible (vice versa). This can be frustrating at times, especially if you have joints/objects that have the same position and orientation.
This is a really simple script, it basicly just adds the flag that specifies on/off to the command that toggle’s the local axis. I’ve also added an option for it to go through the entire hierarchy, definitely a timesaver.
8,197 total views, 2 views today
Script: Find Duplicate Names
When dealing with rigs you often end up having a ton of nodes, and it’s easy to end up having several objects with the same name. You may think that Maya automatically renames those objects for you, and it does, but only if the objects are in the same hierarchy. However, if you have the objects in separate hierarchies they can share the same name.
This isn’t really a problem in itself as Maya will just use longnames to distinguish them apart, but you may run into problems if you’re using scripts that doesn’t take longnames into consideration.
In the image above we have two objects named “pCube”. So what Maya does to distinguish them apart is to look at their parent, if the parent’s name is unique it will use that in the longname when dealing the objects. So if I were to select the pCube in root2, Maya would read it as “grp2|pcube”, and if both of the mid-groups was named “grp2” then maya would read the pCube as “root2|grp2|pCube”.
I’ve made a script that finds (and renames) all of the objects in the scene sharing the same shortname, the download link is at the bottom 🙂
5,467 total views, no views today
2,495 total views, 1 views today
1,816 total views, no views today
3,943 total views, 1 views today