Home > MEL, update > Keep Maya from renaming your shaders.

Keep Maya from renaming your shaders.

October 10th, 2009 Leave a comment Go to comments

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!

Categories: MEL, update Tags:
  1. May 14th, 2010 at 22:12 | #1

    Love your seamless ik/fk joint system. Thank you, thank you, thank you!I’ve been looking for a way to do that for what seems forever.

    And kudos on “Despicable Me”, awesome minions!

    Cheers,

    Randa

  2. sreenivas
    October 6th, 2014 at 11:51 | #2

    Thanks a lot for this man!
    Its so annoying to keep renaming the shaders.

  1. No trackbacks yet.