PDA

View Full Version : Layer Highlight plugin


LoveFest
12-14-2010, 12:09 AM
Select an object in a viewport and Maya highlights the layer it's on.

Anyone know of a layer highlight plugin like that?

NaughtyNathan
12-14-2010, 09:53 AM
you wouldn't need a plug-in. 3-4 lines of MEL would probably suffice.

here you go:
global proc highlightLayerOnSelect()
{
string $sel[] = `ls -sl -dep`;
if (`size $sel`)
{
string $layers[] = `listConnections -type "displayLayer" $sel`;
$layers = `stringArrayRemoveDuplicates $layers`;
int $lCount = `size $layers`;
if ($lCount)
{
layerEditorLayerButtonSelect 0 $layers[0];
for ($l=1 ; $l<$lCount ; $l++)
evalDeferred("layerEditorLayerButtonSelect 4 "+$layers[$l]);
}
}
}
Simply run: highlightLayerOnSelect; at any time to highlight ALL layers the selected nodes belong to. If you want it to run automatically upon selection you simply attach it to a scriptjob like so:
scriptJob -e "SelectionChanged" "highlightLayerOnSelect";:nathaN

LoveFest
12-14-2010, 08:51 PM
you wouldn't need a plug-in. 3-4 lines of MEL would probably suffice.
... here you go: If you want it to run automatically upon selection you simply attach it to a scriptjob like so:
scriptJob -e "SelectionChanged" "highlightLayerOnSelect";:nathaN

Awesome, man! Thanks Nathan. :thumbsup:

Now, I'm off to go read the Help files on what the "scriptjob" is all about. :)

Fester

CGTalk Moderation
12-14-2010, 08:51 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.