I'm trying to write a Mel script to set all Display layers with "LPL in it's name to visible.
Display layers seems to have very bad documentation and I cant find anything.
I've got many many layers and switching each one on one by muda-nuckin one is getting bothersome.
Any help is much appreciated.

Till then I shall be sincerely be banging my head into the desk.

Regards
Dev
Replies
import maya.cmds as cmds layers = cmds.ls(type='displayLayer') for i in layers: if "LPL" in i: cmds.setAttr('%s.visibility' % i, 1)mel code would be something likestring $layers[] = `ls -type "displayLayer"`; for ($i in $layers) { setAttr ($i + ".visibility") 1; }but you would have to figure out the if statmeant since i dont know how mels string fromatting works off handThanks for relearning mel for me haiddasalami!
string $layerlist[] = `ls -type "displayLayer"`; for ($layer in $layerlist) { if ($layer != "defaultLayer") { string $layerCheck = `substring $layer 1 3`; if ($layerCheck == "LPL") { setAttr ($layer+".visibility") 0; } } }Heres some of the string formatting stuff you can do
string $layers[] = `ls -type "displayLayer"`; for ($i in $layers) { if (python("'LPL'" + "in" + "'" + $i +"'")) { setAttr($i + ".visibility", 1); } }though as you seen it is most easily done via pythonedit:
ah hadiddasaalmi beat me to it.
@hadiddasaalmi also have to agree with you hadiddasaalmi, it just feels bad going back to mel once your used to more advanced languages like python and c#
I made some changes and here they are:
string $layerlist[] = `ls -type "displayLayer"`; for ($layer in $layerlist) { if ($layer != "defaultLayer") { string $lyrChk = endsWith ($layer, "LPL"); if ($lyrChk) { setAttr ($layer+".visibility") 1; } } }@Passerby: I agree mel seems outdated compared to python. I will switch to it soon.