Maya

Auto-rivet script:

As part of my sculpting process for overhangs I often have to move stuff around but can't be bothered moving other static elements like the nose, eyeballs, whiskers etc. Soon as I don't want these to deform I don't want to use a wrap deformer I want to rivet them. This script uses a function I found online to get the closest vertex to the centroid of whatever meshes you have selected first, then rivets them to the last mesh selected. Then you can re-export the shapes once they've been moved into position. 

Auto-Rivet code (python):

import maya.cmds as mc

import maya.api.OpenMaya as om

import operator



def getClosestVertex(mesh, pos):


    pos = om.MPoint(pos)

    sel = om.MSelectionList()

    sel.add(mesh)

    fn_mesh = om.MFnMesh(sel.getDagPath(0))


    index = fn_mesh.getClosestPoint(pos, space=om.MSpace.kWorld)[1]  # closest polygon index

    face_vertices = fn_mesh.getPolygonVertices(index)  # get polygon vertices


    vertex_distances = ((vertex, fn_mesh.getPoint(vertex, om.MSpace.kWorld).distanceTo(pos))

                        for vertex in face_vertices)

    return min(vertex_distances, key=operator.itemgetter(1))



mesh = mc.ls(sl=True)[-1]

strang = ''.join(mesh)

childMesh = mc.ls(sl=True)[0:-1]


for c in childMesh:

    t = mc.xform(c, query=True, bb=True)

    pos = ((t[3] + t[0]) / 2, (t[4] + t[1]) / 2, (t[5] + t[2]) / 2)

    foo = getClosestVertex(mesh, pos)[0]

    fooS = str(foo)

    mc.select(strang + '.vtx' + '[' + fooS + ']')

    mc.Rivet()

    newname = ('rivet' + c)

    mc.rename('pinOutput', newname)

    mc.parentConstraint(newname, c, mo=True)





Walk mode (Unreal style controls):

Hit Alt+X (or from the viewport menus, View -> camera tools -> walk mode) and use the WASD keys (plus Q and E to change height) to fly around your scene, this is super handy for large layouts and landscapes. Make sure to go into your tool settings and turn the speed and sensitivity settings to something reasonable. 

2D Pan and Zoom controls

So you're viewing through an animated camera and need to view something small in the frame, but you can't move the camera because it's animated. Hold the backslash ( \ | ) key + right click to zoom in (middle click to pan). Tap the key to toggle between the normal camera and the zoomed in version.

Select the camera and run this python script to reset it to default or find the pan and zoom controls under display options in the attribute editor. 


import maya.cmds as mc 

sel = mc.ls(sl=True) 

sel = (sel[0] + 'Shape')

mc.setAttr((sel + '.zoom'), 1) 

Alt Bump

A good companion for the 2d Pan and Zoom, hit alt + the arrow keys with an object selected to "bump" the object around 1 pixel in screen space. Very useful for lining things up to plate footage!

Select via wildcard 

Adding the star to any point of the select by name string will wildcard it to automatically search for everything it can find to fit in the place of the star. Want to select all of the body meshes, not just the high poly ones? enter body_*, want to get all of the high res meshes of all types? enter *_high* . These can go in the middle too, so *_*2 is actually a valid search that would result in the selection of the meshes tongue_high2, goggle_lens_high2, goggle_strap_high2 and body_high2.

Wildcarding works in all kinds of programs (like Houdini and katana) so keep it in mind. 

Faster layouts with GPU caches

Keep your scene fast and light by using GPU caches for static elements, go to Cache -> GPU cache -> export and then reimport it. GPU caches are streamed off disk so your projects load instantly, soon as the geometry is not in the file itself your working files stay light and small as well. GPU caches are just alembic files so if you export your meshes as alembics from somewhere else they can just be directly imported as GPU caches. Wrap the reference nodes (the little green lightning bolts in your outliner) up in a group, export that as a .mb and reference that in again to have an instant scene layout loader!

Run Python scripts from hotkeys

Go to Windows -> Settings/Preferences -> Hotkey Editor, change the window on the right over to Runtime Command Editor, paste in your Python (or MEL) script, give it a name you'll remember, hit save then look it up on the search bar on the left, assign a hotkey to it you'd like and voila. Here's a sample script, in move mode activating this script will toggle you to go between world and local space on your gizmo. 


import maya.cmds as mc 

if mc.manipMoveContext('Move', q=True, mode=True) == 2:

    mc.manipMoveContext('Move', e=True,mode=0)

else:

    mc.manipMoveContext('Move', e=True,mode=2)