View Full Version : Splitting selections?
11-13-2011, 07:17 AM
I'm working on a copy/set position script. It takes the translation, rotation and/or scale of the first selected object and applies it to the other selected objects. I just need help with the very first part. I was thinking something like:
string $everything = `ls -sl`;
string $target = $everything;
string $toMove = The rest of the selected objects??? <--- no idea what to do here
I might just be stubborn, but don't want to just do 'deselect $target' or whatever and go on. I know there's a way to do what I'm asking, I just can't remember.
Could someone point me in the right direction?
Thanks a lot!
11-13-2011, 12:06 PM
you could just remove the "target" object (it's really the "source", not "target", the remaining objects are the "targets") from the array using stringArrayRemove or stringArrayRemoveAtIndex commands. Alternatively, the loop which you use to iterate through the remaining objects could just start from 1, rather than 0, then you wouldn't have to change anything in the selection array. There's also the -tail and -head flags for the ls command which can sometimes be help with stuff like this.
Don't forget Maya's selection highlighting paradigm which it uses to differentiate a specific single selected object from the rest. This is known as the "lead" or "Focus" object, and it's always the LAST one selected . If you select multiple objects (individually or by marquee) you should see they are all highlighted in white apart from one which is green. (assuming you haven't modified your default palette). This green one is your lead object and it makes sense for all your tools and functions to use this object as the "source" of whatever it is the function does. However, it's ultimately up to your personal preference, it's your tool.
11-13-2011, 12:13 PM
I seriously didn't know about ANYTHING you just posted. I've just learned so, so, so much! Thanks!
Oh, and before I forget:
11-13-2011, 12:13 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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.