Renderlayer based on object name


#1

Hi,

I’m quite a novice to MEL and I’m trying to automate a process so its (more) fool proof than manually doing it.
I have a character which sometimes has different props (ball, bat, hat, bag etc).

What I’m trying to do is, the artist selects the prop and via a button on the shelf a renderlayer is setup for that prop using the props name.

So far I have this :-

string $Prop[] = ls -selection -long;
string $Newlayer = createRenderLayer -n$Prop;

If the prop is called “Ball” the renderlayer created is called “Ball1”.

How do I rename it or force it to be called “Ball_Prop” ?

So I get render layers like
Ball_Prop
Hat_Prop
Bat_Prop etc

(Using maya 2015)