Mel script....selection set to material assignment...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need a mel script that will look at a meshes various face selection sets and use these set names to assign unique materials with that name to each set of face. Lets just say lambert for now but I eventually need it to apply VrayMtls but I think I can figure that part out. I have a mesh that comes into maya with a unique face selection set for each material. I just want to loop through those sets, taking their names, and apply a material to each set with that same name. This should be pretty simple but I cannot figure it out.
I think it should involve the listSets command and a for-loop but I cannot seem to be able to make an array of the sets to loop through. Mel freaks out every time I try to declare listSets as a variable.
How would I do this?