MEL How-To #44
How do I expand a polygon component selection to include all components in the same shell?
By using the
It was previously reported on these pages that you had to use a recursive "brute force" method to expand the selection to include the full shell. This is not true.
The key lies in the ‘
The following MEL will select all polygon face components within the same "shell" as the current selection:
ls -sl; // Result: pCube1.f // // type 0x0008 is facet // mode 3 is "All&Next" polySelectConstraint -type 0x0008 -shell true -mode 3; ls -sl; // Result: pCube1.f[0:5] //
The starting selection need not be a face component:
ls -sl; // Result: pCube1.e // polySelectConstraint -type 0x0008 -shell true -m 3; ls -sl; // Result: pCube1.f[0:5] // ls -sl; // Result: pCube1.f // // Select all vertices is same shell polySelectConstraint -type 0x0001 -shell true -m 3; ls -sl; // Result: pCube1.vtx[0:7] //
Note: This command enables a global constraining selection mode that affects the UI. If you leave the user in this mode
then everytime they select one or more components the selection will be expanded to include the entire shell.
Thus, you should reset the selection contraints by turning off all modes that you turn on.
In this example that would be the ‘
// Reset -shell selection constraints polySelectConstraint -shell false;
Be aware that if the constraint results in UVs being selected you will receive repeated "Some items cannot be moved/rotated/scaled" warnings if any of the Sacred Tools are active. You can get around this by temporarily activating the Select Tool, performing the selection and then resetting the previously active Sacred Tool:
global string $gSelect; string $currentCtx = `currentCtx`; setToolTo $gSelect; // ... UV selection stuff here ... setToolTo $currentCtx;
|Copyright ©2005 by Bryan Ewert, email@example.com|
Maya is a Registered Trademark of Alias