View Full Version : Loading a single selection
MikeRhone 12 December 2003, 05:17 PM I feel like a fool for having to ask this but...
whats the most efficient way to get maya to make sure only one object is selected by a user?
Do i still use the:
string $sel[] = `ls -sl`;
command?
o.O
m
|
|
Jhavna
12 December 2003, 05:26 PM
Is this for when the user has selected the objects and called your script?
In that case you can do
string $selection[] = 'sl -ls';
and use $selection[0] to access the first selected object only.... Or copy that into another array if you need to work on array
MikeRhone
12 December 2003, 06:12 PM
I was hoping for a way to limit the selection to 1. If more than one object was selected I wanted to output an error like "Dummy, only select ONE object!"
m
galactor
12 December 2003, 06:41 PM
string $selection[] =`ls -sl -fl`;
if (size($selection)!= 1)
error ("Dummy, only select ONE object!");
if (size($selection)!= 1) This part says: If the amount of elements in $selection is not equal to 1, then print the error.
You should use the ERROR command for this, cause it makes sure the script cannot continue.
:: Galactor ::
MikeRhone
12 December 2003, 07:58 PM
perfect...thanks!
m
CGTalk Moderation
01 January 2006, 12:00 AM
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.