MEL: for loop commands and storing previous selections

The problem I have is that some commands in Maya work differently when multiple objects are selected. An example (which I’m not using) would be a planar projection. When multiple objects are selected the planar projection will project over both at once, even though you may want to do one at a time to fill up the UV quadrant. Because of this the standard for loop won’t work with ls -sl.

So I guess I would need to fetch the current $selectedObjects[] and feed them into a new array such as $previouslySelectedList[] that will not change when the objects are deselected.

Then in the for loop I would add each object from $previouslySelectedList[] one at a time to the active selection list, run my commands, and then select -d the objects or select -clear them and remove them from the $previouslySelectedList[] and then the loop would continue until it reaches the end of the $selectionList[].

Any info will be appreciated on how to achieve this.

Thanks

No Responses to “MEL: for loop commands and storing previous selections”

Post a Comment