Hey Guys -
iam on a little arrange script:
basically i want two things:
1. select a group called "camera - or static name"
2. select first subgroup
3. put these two selections in one renderlayer with the naming l1
4. redo everything until evey subgroup is in its own renderlayer
so l1 l2 l3 and so on
sturcture is: "camera - or static name" + "(select maingroup - manually)" = go to every subgroups and do steps above! (automatic)
here my code so far
//kill window if open
if (`window -ex "RenderlyerScript"`)
deleteUI "RenderlyerScript";
{
// create the window
window "RenderlyerScript";
// define the layout of controls added
// to the window.
rowColumnLayout -numberOfColumns 1;
// buttons
button -w 100 -h 100 -backgroundColor .4 .9 .4 -label "put group in renderlayer" -command "rlayer";
button -w 100 -h 100 -label "rename renderlayers" -command "rename";
//renderlayer
proc rlayer () {
select -add CAMERA_LIGHTING ;
createRenderLayer -name "l1" -number 1 -noRecurse `ls -selection`;
select -add "group";
}
//renameLayer
proc rename() {
select -add CAMERA_LIGHTING ;
createRenderLayer -name "l1" -number 1 -noRecurse `ls -selection`;
select -add "group";
}
columnLayout;
scrollField -wordWrap true
-text "Instructions:" -editable false;
text -l "Renderlyer karl v0.1";
showWindow;
}
it worked well when i select the subgroup manually - but i want it to be automatic.
is there some kind of "if - when - "
Thanks.
Also i want a rearrange naming in the renderlayer group.
So if i have l1 l2 l3 l4 l5 and so on - and i put l5 above l3 - i want that the script is rename every renderlayer
so it arranges back to the order l1 till l"end"
Some help would be nice !
Replies
i think about using two loops - one for the subgroups
and on the other button one for the renaming
i dont want the select the subgroups manually - i just want to select the "maingroup"
Here my progress:
Here's a reformatted code with your buttons integrated into the FOR loop:
Your two procs were doing the exact same thing. Not sure why.
I would suggest avoiding naming procs that are also the same as Maya's default commands, such as rename. That'll give you all sorts of errors.
A couple notes on the code:
I basically placed the functionality of your buttons inside the for loop. In order to get each layer to be named incrementally, I used the for loop's counter $i. You can create alphanumeric ordered lists by combining strings and integer values by containing them inside parentheses. The reason for $i + 1 is because $i started on 0 instead of 1, and I was offsetting that.
Hopefully this is what you were aiming for!
Camera Setup not the subgroup stuff.
I assume i have to add - select subgroup?
The second button function is only a placeholder - but i renamed the function, thanks for the hint.
}
not the stuff of the subgroup...
(fixed a little spelling error of your script
So, my code works on my end. It creates a render layer and adds each subgroup to that render layer.
So for instance, render layer L5 would contain CAMERA_LIGHTING and the lantern:lantern group. It doesn't need to go further than that, as anything contained inside of a group is also part of a layer.
Is this what you wanted?