Agree with GDC. But if you work with polygons, i think it's beter to use "filterExpand -sm 34 -ex 1" instead of "ls -sl". It allows you to avoid such replies like "f[10:30]".
Note: I've pasted my script in a couple times now, and every time I post it in, not only does the formatting get screwed up, but the "for" loops loose a bunch of their code. I aplogoize, but I don't know what's going on
I have a proc written to do this stuff. Select a material from the Hypershade (not multilister... the multilister dosen't "select" things by default), and it will select the nodes it's assigned to, plus list them in the script editor:
global proc EP_listShadedElements() { string $material[] = ls -sl; if (size($material) != 1) error "Please select only a single Material"; text -e -l ("Shader Name: " + $material[0]) T_PSF_shaderName; string $destinationConnections[] = listConnections -s 0 -d 1 $material[0]; for ($a=0; $a { if (objectType -i "shadingEngine" $destinationConnections[$a]) { string $shadingEngine = $destinationConnections[$a]; string $setMembers[] = sets -q $shadingEngine; for ($b=0; $b { setParent CL_PSFelements; button -l ("Select: " + $setMembers[$b]) -c ("select -r " + $setMembers[$b]); } } } }