Autodesk Maya: 5 Tips And Tricks

Staff Writer By: Kurt Foster (Modulok)


Autodesk Maya: 5 Tips And Tricks  | renderosity magazine, Renderosity, review, tips, tutorials, Kurt Foster

These are some quick tips and tricks for Autodesk Maya users. A few for beginners and some for more advanced users. While I can't promise they'll make you more productive, they will certainly impress your friends at parties!

Tip 1 - Lock and unlock entire nodes

Everyone knows you can lock and unlock individual attributes, like translation, rotation, etc. What you might not know is that you can lock entire nodes themselves. A locked node:

  • Cannot be deleted, renamed, parented or unparented.
  • Cannot have individual attributes added or removed.
  • Cannot have individual attributes locked or unlocked.

Why would you lock a node? Think rigging. Animation controls are sometimes ahem accidently deleted by animators. Locking nodes is just one way of helping to prevent these mishaps. Select what you want to be locked and then run this.

Python:

    import maya.cmds as cmds
    cmds.lockNode()

Now try to delete the node. You can't!

Locked nodes cannot be deleted.

Unlocking is easy, just select what needs unlocked and use this Python:

    import maya.cmds as cmds
    cmds.lockNode(lock=False)

Tip 2 - Press 'g' to repeat the last command.

Yeah, it's a simple one, but it's always useful! Just press 'g' to repeat whatever the last command was. It's very useful when duplicating things or doing repetitive tasks.

Tip 3 - Drop selected objects precisely to the grid

This is a little more advanced but tremendously useful. With this handy Python script, you can precisely drop all selected objects precisely on the grid. Drag this to your shelf or bind it to a hotkey:

    import maya.cmds as cmds
for obj in cmds.ls(selection=True): if cmds.attributeQuery('translateY', node=obj, exists=True, writable=True): bbox = cmds.xform(obj, query=True, worldSpace=True, boundingBox=True) offset = bbox[1] * -1.0 cmds.xform( obj, worldSpace=True, relative=True, translation=(0, offset, 0) ) else: print("dropToGrid(): Skipping '%s' has no translateY or it is locked." % obj)

Here's the result:

Placing thousands of random objects precisely on the grid - cake!

Tip 4 - Object Count HUD

Know exactly how many objects you have selected at all times by enabling the "Object Details" heads up display. It's easy to use and quite handy!

Enable your object count HUD to always know how many objects you have selected.

Tip 5 - Open a Window Explorer (or any program) from Maya

Wouldn't it be nice to have a button or hotkey that opens Windows Explorer for whatever the current project is, all from Maya? Or maybe launches some external program or script job to do something. With this tip, you can! Just drag this script to the shelf or assign to your favorite hotkey:

    import maya.cmds as cmds
    import subprocess
    import os.path

    workspace = cmds.workspace(query=True, fullName=True)
    subprocess.call(["explorer", os.path.normpath(workspace)])
        # We have to normalize the path to universal forward slashes.
        # Windows file paths that use backslashes, these are converted.

Now we have a button to open an external program!*

That's it! Now, if you click that button or press that hotkey you're greeted by Windows Explorer looking right at whatever the currently set project is. This could be configured to open any program. Convenient!

Conclusion

I had fun making these tips and hope it helps somebody out there in Internet land with their Maya endeavors! Thanks for reading and good luck! Oh, if you are new to Maya you might consider trying their Maya LT version. You can download a demo here.