If you change the type of shader in Hypershade, Maya discards every time the name of your shader. So if you had a Lambert shader called “my_shader”, and you changed it to a Blinn shader, your shader would be automatically renamed “blinn1”. If you don’t like this just go to this folder:

C:\Program Files\Autodesk\Maya(version)\scripts\AETemplates and open AEshaderTypeNew.mel

Find this line (at the very bottom):

delete $shaderNode;

And add this line just after:

rename $replaceNode $shaderNode;

And Maya will keep the name of your existing shader!


You can add Self Separator to your custom Maya shelf. Just open your custom shelf file and put these lines between two items.

Maya Shelf Separator

separator
        -enable 1
        -width 12
        -height 35
        -manage 1
        -visible 1
        -preventOverride 0
        -enableBackground 0
        -backgroundColor 0 0 0 
        -highlightColor 0.321569 0.521569 0.65098 
        -style "shelf" 
        -horizontal 0
    ;

I think the smart selective XRay in the viewport is very useful, for instance for retopology. With this script, you can use XRay only for selected meshes.

Smart selective XRay in Maya

You can save this MEL script to the shelf:

string $sel[];
int $temp[];
int $value;
$sel = `ls -sl -dag -ap -typ surfaceShape`;
for ($obj in $sel){
$temp = `displaySurface -q -xRay $obj`;
$value=$temp[0];
if($value==1)
displaySurface -xRay 0 $obj;
else
displaySurface -xRay 1 $obj;
};

In Maya viewport, the selected object has always wireframe. You can turn on/off this wireframe. Sometimes you don’t want to see the wireframe when you rotate the object or check the texture, also you can edit the verticles without seeing the wireframe.

Maya editing object and wireframe turn off

You can put this MEL script to the shelf:

string $wires = `displayPref -q -wsa`;
 if ($wires == "none")
 displayPref -wsa "full";
 else
 displayPref -wsa "none";

Since Maya 2017 the default renderer is not the mental ray and also not installed as default. So if you are opening old Maya files you shall get every time a mental ray warning message window because unfortunately all default Maya scenes have mental ray nodes even if you didn’t use mental ray in that scene.

Maya mental ray nodes warning error message
You can get rid off this message. In some scenes, it’s enough to turn off Display > DAG Objects Only in the Outliner and then delete the mental ray nodes, but that doesn’t work in every scene. This script removes all mental ray nodes from your Maya scene, just put this MEL script to the shelf:

// Script to remove mental ray data from Maya scene files
// Run this script while the scene is open in Maya, then save the file with a new name

print("\n");
print("\n");
print("Working on:\n");

string $mrNodes[] = `ls -typ "unknown"`;

for ($each in $mrNodes){
	if (`objExists $each` && `unknownNode -q -p $each` == "Mayatomr"){
		print($each + "\n");
		delete $each;
	}
}

if (`objExists mentalrayIblShape1`){
	delete mentalrayIblShape1;
}

unknownPlugin -remove "Mayatomr";
print "\n";
print "---> Done";

 


If you have a mesh that has been assigned more shaders and if you have a big scene with a lot of shaders, to identify which shader is assigned to which polygons you can go in the Outliner and enable Display > Assigned Materials to display shaders assigned to each object in the scene, then right-click the material and select Select Objects with Material. Or you can also choose to Frame Objects with Material.

Maya Identify Shaders Select Objects with Material


Sometimes you don’t need the instance anymore, you can break the instance with this command: Modify > Convert > Instance to Object.

Maya break instance


Sometimes Maya doesn’t allow you to change the desired name of an object. You can check this name in the Namespace Editor and you can delete it: Windows> General Editors > Namespace Editor.

Maya Namespace Editor


I found a great renaming script by Magnus Olsson. This script will change the name of all the File nodes in a scene to their Image Name. You can save the Python script to the shelf:

import maya.cmds as cmds
import maya.OpenMaya as om
import os

#Changes the name of file nodes to their Image Name

fileNodes = cmds.ls(type = "file")

for f in fileNodes:
    cmds.select(f, replace=True)
    imageNameFull = cmds.getAttr(".fileTextureName")
    imageNameBase = os.path.basename(imageNameFull)
    imageName, imageExt = os.path.splitext(imageNameBase)
    cmds.rename(f, imageName)
    om.MGlobal.displayInfo("Changed name on all file Nodes")

If the Drawing Overrides in the Attribute Editor of the selected mesh is active then for example you are not able to use the layer visibility settings, like freeze mesh.


With this Python script, you can select all bones instantly.

import pymel.core as pm
pm.select(pm.ls(type="joint"))

You can find quickly the triangles and nsided polygons. For example, ZBrush does not like when we are importing a mesh with nsided polygons. I think also if we are making a high polygon geometry it is best to use only quads for nice meshsmooth, if we are making game mesh we can use triangles too. If you have a lot of polygons and a complicated model I recommend activating the polygon counter: Display > Heads Up Display > Poly Count. In this way, if you see the numbers too when you select the triangles or nsided polygons you will not miss the small polygons.

Maya Select Nsided PolygonsMaya Select Triangles

 

You have two ways to do it, the first way is to use the Polygon Selection Constraint on Faces: Select > Use Constraints… You need to select the mesh and choose the face selection. In this panel you can select the triangles, quads, and nsided polygons.

Maya Polygon Selection Constraint on Faces

The other way to use the Cleanup Options: Mesh > Cleanup…  You can save this setting as a script to your shelf and later it is enough to click only on your icon to highlight the nsided polygons.

Maya Cleanup Options