PDA

View Full Version : get selected renderlayers


cybermoos
01-17-2011, 05:20 PM
Hi all,

I need to get a list of selected renderlayers in the renderLayerTab of the Maya GUI.
In ...\Maya2011\scripts\startup\layerEditor.mel I found a function called getLayerSelection which seem to do the job.
global proc string [] getLayerSelection(string $type)
//
// Description:
// Return the current layer selection for the specified layer type.
//
// Arguments:
// $type - Valid values are: "Display", "Render", or
// an emtpy string. In the case of an empty string the
// current layer type displayed in the editor will be used.
//
// Returns:
// A string array containing the names of the selected layers.
But is throws an error:
string $layers[]; $layers = `getLayerSelection("Render")`;
print $layers;
// Error: file: C:/Program Files/Autodesk/Maya2011/scripts/startup/layerEditor.mel line 5315: Invalid layer type: Render
Did the layer type for renderlayers change? With Display as type I get a list of the selected displaylayers.
Any ideas? Some help would be nice...

greatPumpkin
01-20-2011, 09:25 AM
took a look at that script. I suppose something has changed, or perhaps that never worked.

If you want to get selected render layers you could just do:

string $sel[] = `ls -sl`;
select -cl;
for($o in $sel)
{
if(`objectType $o` == "renderLayer")
select -add $o;
}

cybermoos
01-21-2011, 05:20 PM
thanks for your reply greatPumkin.

'ls' was also my first try. But selected renderlayers via the renderlayer tab (see screenshot) aren't really selected. So you can select objects in the scene AND some renderlayers e.g. to add the objects to all selected renderlayers.
This is what i want to do...

CGTalk Moderation
01-21-2011, 05:20 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.