I wrote this script to help check which objects in your Maya scene have a second UV set.  A second UV set is required for AO and Lightmapping in Unity or whatever baking application you may be using.  Add this to your Maya shelf and click to run.  It will print out the names of the meshes that do not have 2 UV sets as well as a total count at the end.

# UV2 Checker
import maya.cmds as cmds


def selectMeshes():
    meshes = cmds.ls(selection = False, type = "mesh")
    for mesh in meshes:
        cmds.select(mesh, add = True)
    return meshes


def getUVSetCount(currentObject):
    mesh = currentObject
    indices = cmds.polyUVSet(mesh, query = True, allUVSetsIndices = True)
    return len(indices)

   
def main():
    uvCountPrintString = " UV count is:  "
    
    meshes = selectMeshes()
    meshesThatNeedUV2 = []
    for mesh in meshes:
        currentObjectUVCount = getUVSetCount(mesh)
        if currentObjectUVCount != 2:
            meshesThatNeedUV2.append(mesh)
            print mesh.ljust(15) + uvCountPrintString.ljust(10) + str(currentObjectUVCount)
            
    print "Total number of meshes that require UV2: " + str(len(meshesThatNeedUV2))
            
main()
Posted
AuthorAndrew Doll