View Full Version : Is there a way in MEL to get the right order of the selected components?
04-13-2007, 04:56 PM
Is there a way in MEL to get the right order of the selected components?
By doing ls -sl or using the filterExpand command,you get the components but not in the order they were selected.
04-13-2007, 05:01 PM
use scriptCtx to create a selection based tool....
04-13-2007, 07:13 PM
This is from the maya help :
-title "Attach Curve"
-fcs "select -r $Selection1; performAttachCrv 0;"
-setNoSelectionPrompt "Select two curves close to the attachment points"
-setSelectionPrompt "Select a second curve close to the attachment point"
-setDoneSelectionPrompt "Never used because setAutoComplete is set"
attachTool;I executed it and nothing happened.Can you please explain,what exactly scriptCtx is and how it is used?
After i execute this what should i do to see some results?
04-13-2007, 09:43 PM
I believe the 'ls' command already does that.
04-13-2007, 09:45 PM
I believe the 'ls' command already does that. If you do 'ls -selection' it returns names of the selected objects in the order they were selected. If you take the output of ls -selection in a string array, the first element that is array would contain the object selected first and the last element of the array is the object selected last.
04-13-2007, 10:02 PM
ls command does not do that.
Components are still reordered.
04-14-2007, 02:49 AM
I previously did a script which gets the correct selection order by recording the selection history into a text file, it might point you in the right direction. The function is imbedded in a script that generates a cv curve from selected points.
04-14-2007, 09:39 AM
I executed it and nothing happened.Can you please explain,what exactly scriptCtx is and how it is used?
The command has created a new tool object called attachTool. To use that tool, simply call
the attachTool will now remain resident in maya until you close it, so no need to re-run the script each time. To kill the tool, use :
the ls command only returns the correct selection order for objects, with components the only *nice* way to do it is to create a specific tool context (scriptCtx, draggerCtx etc)
04-14-2007, 09:39 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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.