Here's the scenario, I have a PSD with 73 Layer sets in it. I want to load each of them into PSD textures and connect them to a switch whose out color is connected to a surface shader. That surface shader is then applied to 73 sequentially numbered objects. I couldn't find a way to change the layer set names on the texture nodes using MEL, so I had to export each layer set as an individual file and then load them that way. This is fine i guess, except in the interest of my sanity I'd love to have just one PSD to manage and use layer sets to connect to my network.
I run into this situation a lot and am trying to automate this the best i can for the future. If anyone could help me figure out how to change the "Link to Layer Set" option in MEL I'd greatly appreciate it. Usually I just make a connection/change an attribute and watch what happens in the script editor, but when I change the layer set on the psdNode nothing happens. Even if I have Echo all Commands on it isn't very clear to me what's happening.
*As a side note, if anyone knows of a script to batch rename Layer Sets in Photoshop I'd love to hear from you. I have a good one that renames layers but it completely ignores Layer Sets/Groups.
Thanks! -DD
Below is the code I used to achieve the result thus far:
///// Connect PSD nodes to switch (Select Tex Nodes First)
string $selectedObjects[] = ls -sl;
$switchNode = "tripleShadingSwitch1";
for($i = 0; $i < 73; $i++) {
connectAttr -f ($selectedObjects[($i)] + ".outColor") ($switchNode + ".input[" + ($i) + "].inTriple");
};
///// Load Sequentially numbered psd's to Sequentially numbered psd textures (Select Tex Nodes First)
string $selectedObjects[] = ls -sl;
for($i = 0; $i < 73; $i++) {
setAttr -type "string" ($selectedObjects[($i)] + ".fileTextureName") ("/Volumes/PathToFile/BG_" + (($i) + 1) + ".psd");
};