一半君的总结纸

听话只听一半君

#54 How do I get an expanded list of selected components instead of the default “range” format?

Typically Maya returns a list of selected components using its “range” format where an index sequence is compressed to “[start:end]”.

ls -sl;
// Result: pSphere1.f[73:76] //

There are several methods you can use to retrieve a fully expanded list.

ls

In Maya v3 a −flatten flag was added to the ‘ls’ command:

ls -sl -flatten;
// Result: pSphere1.f[73] pSphere1.f[74] pSphere1.f[75] pSphere1.f[76] //

The −flatten flag can also be used to expand an arbitrary selection list:

string $adjacentComponents[] = { "pSphere1.f[26:27]", "pSphere1.vtx[1:3]" };
// Result: pSphere1.f[26:27] pSphere1.vtx[1:3] //

ls -flatten $adjacentComponents;
// Result: pSphere1.f[26] pSphere1.f[27] pSphere1.vtx[1] pSphere1.vtx[2] pSphere1.vtx[3] //

Note that items in your arbitrary list must actually exist within the current scene, else the ‘ls’ command will not include them in its result array.

filterExpand

The ‘filterExpand’ command returns a string array of selected components and offers an −expand option. You must also include one or more −selectionMask flags to specify which component type you require:

filterExpand -selectionMask 34 -expand true;
// Result: pSphere1.f[73] pSphere1.f[74] pSphere1.f[75] pSphere1.f[76] //

29 August 2002

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 博主赞过: