RE: [Script] Multiple Pick Session

Date : Thu, 27 Sep 2007 11:16:09 -0400
To : <XSI(at)Softimage.COM>
From : "Brinkley, Marc" <mbrinkley(at)ea.com>
Subject : RE: [Script] Multiple Pick Session
Great thanks everyone! Just what I needed. 


_______________________________________
Marc Brinkley - EA|Chicago
mbrinkley [at] ea.com
312.661.7412
"I prefer the smooth texture of the HoHo over the DingDong."

-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
Of Guillaume Laforge
Sent: Wednesday, September 26, 2007 2:50 PM
To: XSI(at)Softimage.COM
Subject: Re: [Script] Multiple Pick Session


I tried an other way just for fun :-).

//*********************** PickObject_S ******************* var
oPickedObjects = PickObject_S(new ActiveXObject("XSI.Collection"), "Pick
some Objects"); SelectObj(oPickedObjects);

function PickObject_S(collection, LeftMessage) {
	var oPick = PickObject(LeftMessage);
	if(oPick.value("ButtonPressed") != 0)
	{
		collection.add(oPick.value("PickedElement"));
		PickObject_S(collection, LeftMessage)
	}
		logmessage(collection.count+" Objects Picked");
		return collection;
}
//*********************** PickObject_S *******************

Cheers


Guillaume Laforge.


On Wed, 26 Sep 2007 15:28:52 -0400, "Ponthieux, Joey"
<j.ponthieux(at)nasa.gov> wrote:
> Marc,
> Small mistake in the code I sent. The modifier routines should be as 
> follows. Disregard the return(null); which was included in each 
> segment of the previous version
> 
>           } else if (button == 1&&modifier ==1) { // If Shft-LMB pick 
> multiple objects, terminate with RMB
>                "custom command"(pickobject, 0);
>           // Execute  function using selection
> 
>            } else if (button == 1&&modifier ==2) {
>   // If Ctrl-LMB pick multiple objects, terminate with RMB
>                "custom command"(pickobject, 0);
>            // Execute function using selection
> 
> 
> 
> Joey Ponthieux
> NCI Information Systems Inc.
> NASA Langley Research Center
> ____________________________________________________________
> Opinions stated here-in are strictly those of the author and do not 
> represent the opinions of NASA or any other party.
> 
> 
> 
> 
> 
> 
> Ponthieux, Joey wrote:
>> Marc,
>>    You can try this. I use this frequently with slight variations. 
>> You can alter what the selection mode is by changing the first 
>> parameter in the PickElement command with a different selection 
>> filter such as EDGE etc. This particular method gives the option of 
>> running once then terminating unless using a modifier. This setup 
>> assumes that a custom command is called but you don't have to do 
>> that, just access the selection data from pickobject when you need it

>> or include the command within the "esle if" routine. This is in 
>> JScript and it could probably be done more elegantly but has been a
solid performer.
>>
>>
>> var buffer, pickobject, button, modifier; //Declare PickElement 
>> variables while(button != 0){
>>                // Force pick element to repeat itself until process 
>> either terminates itself automatically or user terminates pick with
RMB
>>            LogMessage( "Pick object/s, SHFT-LMB or CTRL-LMB to select
>> multiple objects...", siInfo );    // Tell user what to do at status
> line
>>              buffer = PickElement( "OBJECT", "Pick object/s", "",
>> pickobject, button, 1, modifier );    // Launch a pick session and
>> store results in buffer.
>>            pickobject = buffer.Value("PickedElement");          //
>> Retrieve current picked element from buffer.
>>            button = buffer.value( "ButtonPressed" );
//
>> Retrieve current button used in pick operation
>>            modifier = buffer.value("ModifierPressed");            //
>> Retrieve key modifier used in pick operation.
>>              if ( button == 0 ) {
>>             // If RMB or ESC used, terminate pick process
>>                LogMessage("Separate operation terminated by
>> user...");    // Report end of pick session
>>                return(null);
>>                             // Exit
>>
>>            } else if (button == 1&&modifier == 0) {  // If LMB pick 
>> one object, terminate immediately
>>                "custom command"(pickobject, 0);
>>          // Execute function using selection
>>                LogMessage("operation completed.");
>>     // Report end of pick session
>>                return(null);
>>                     // Exit pick session after only one pick
>>
>>            } else if (button == 1&&modifier ==1) {
>>    // If Shft-LMB pick multiple objects, terminate with RMB
>>                "custom command"(pickobject, 0);
>>           // Execute  function using selection
>>
>> return(null);
>>                     // Exit pick session
>>
>>            } else if (button == 1&&modifier ==2)
>> {                        // If Ctrl-LMB pick multiple objects,
>> terminate with RMB
>>                "custom command"(pickobject, 0);
>>            // Execute function using selection
>>                  return(null);
>>                       // Exit pick session
>>            }
>>        }
>>
>> Joey Ponthieux
>> NCI Information Systems Inc.
>> NASA Langley Research Center
>> ____________________________________________________________
>> Opinions stated here-in are strictly those of the author and do not 
>> represent the opinions of NASA or any other party.
>>
>>
>>
>> James Easter wrote:
>>> I believe holding down the shift button while selecting objects will

>>> add them to your selection.  If you select 2 objects out of 4 ,then 
>>> hold down the ctrl button while dragging a selection region over the

>>> objects, you will get the two previously unselected objects 
>>> selected.  Nice if you want to select everything but what you 
>>> currently have selected.
>>>
>>> James
>>>
>>> On 9/26/07, *Brinkley, Marc* <mbrinkley(at)ea.com 
>>> <mailto:mbrinkley(at)ea.com>> wrote:
>>>
>>>     Hey guys
>>>          Sorry for the dumb question. I need a picking session that
> will
>>>     allow me to pick more than one object and I cant seem to find
>>>     anything in the docs.
>>>          Pretty sure this is a case of me not reading enough but 
>>> thought I
>>>     would throw it out there.
>>>          Thoughts?
>>>          _______________________________________
>>>     *Marc Brinkley - EA|Chicago*
>>>     mbrinkley [at] ea.com <http://ea.com/>
>>>     312.661.7412
>>>     "I prefer the smooth texture of the HoHo over the DingDong."
>>>
>>>
>> ---
>> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> body:
>> unsubscribe xsi
> -
--
Guillaume Laforge | La Maison

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.