Finding Render Layers


#1

If the layer(eg :- Key) is existed if condition result gets true,
when layer(eg :- Key) is not existed iam getting an error (// Error: line 2: No object matches name: Key).

i need to identify if key layer exists, if condition should be true. when key layer does not exists else condition should be true ?

anybody plzz help me…


string $lay[] = ls -type "renderLayer";
editRenderLayerGlobals -currentRenderLayer “Key”;

if ( editRenderLayerGlobals -query -currentRenderLayer == “Key”) {

print (“Already Key Layer Exists”);

}
else {

createRenderLayer -name “Key” -number 1 -noRecurse ls -selection;

}


how can i identify the specific render layer name it exists or dose not exists ?


#2

You should be able to use the objExists command.

if( `objExists Key` ) {
    //code if true here.
} else {
    warning("Not found");
}


#3

Thnxs Dude for helping… :wavey: