Tuesday, November 3, 2009

Keep Maya from renaming your shaders

I got this tip from SeithCG:
Every time you change a shader’s type in Maya’s attribute editor, Maya discards the name of your shader. So if you had a shader called “my_carefully_named_shader” that happened to be a Lambert, and you changed it to a Blinn, your shader would be automatically renamed “blinn1″. Great, no? No. So if like me you’re tired of Maya renaming your shaders when it shouldn’t, just go to C:\Program Files\Autodesk\Mayaxxxx\scripts\AETemplates and open AEshaderTypeNew.mel. In the last proc (called AEshaderTypeCB(…)) find this line (usually 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! Yay!