一半君的总结纸

听话只听一半君

#67 How do I control the visibility for the currently active Display Layer?

A quick scan through the MEL Command Reference indicates the following commands are available for accessing Display Layer information:

createDisplayLayer
editDisplayLayerGlobals
editDisplayLayerMembers

The second of these commands is used to query and set the current Display Layer; e.g.:

string $currentDisplayLayer = `editDisplayLayerGlobals -q -currentDisplayLayer`;
// Result: defaultLayer //

A Display Layer’s visibility is controlled in the same manner as other Maya nodes — that is, by its ‘.visibility’ attribute; e.g.:

setAttr defaultLayer.visibility true;

So, to toggle the visibility of the current Display Layer:

string $currentDisplayLayer = `editDisplayLayerGlobals -q -currentDisplayLayer`;

string $visAttr = ( $currentDisplayLayer + ".visibility" );

setAttr $visAttr ( !`getAttr $visAttr` );

Related How-To’s

Monday, May 21, 2001

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: