Mel: Processing Scene/Selected Objects

From wikinotes

Select Vertexes/Edges/Faces...

filterExpand will pull specific information about selected objects, like their vertexes, uvs, edges etc.


Useful Selection Mask Ids
-sm 31
vertices (polygon)
-sm 32
edges (polygon)
-sm 34
faces (polygon)
-sm 35
uvs (polygon)
filterExpand -selectionMask 35;					//returns all selected UVs
ls -sl -fl;                                  // get selected vertices



ls -type /argument/

ls is a bit less specific, but you can quickly query all of a single object type in the scene, or amongst your various selected objects.

ls -type fileTexture;



Node Types

To find the node type of an object:

nodeType  pCube4;
objExists pCube4;


for a complete list of all node types in Maya:

string $nodeTypes[] = `allNodeTypes`;

for ($i = 0; $i < size($nodeTypes); $i++){
    print ($nodeTypes[$i] + "\n");
}


to search all node types for node types containing a particular word:

// This returns all object types that contain the search word $searchWord
string $searchWord = "manip";    //<----- this is the search word
string $match = "";
string $nodeTypes[] = `allNodeTypes`;

for ($i = 0; $i < size($nodeTypes); $i++){
    $match = "";
    $match = `match $searchWord $nodeTypes[$i]`;
    if ($match != ""){
        print ($nodeTypes[$i] + "\n");
    }
    //print ($nodeTypes[$i] + "\n");
}