Trying to create a multiple selection button MEL


#1

So I’m trying to make a button allowing me to select specific objects within a project, however selection doesn’t want to work if there’s more than one object. The best way I’ve been trying to overcome that is by making a set to collect all at once. not a select all because I’m trying to do it for the controls only.

Heres what i have in full:

{
$win = window -t hello;

		rowLayout -numberOfColumns 3 -columnWidth3 50 50 50;
		
			$command = ("deleteUI " + $win);
			//currently does not select set 'controls'
			iconTextButton -st  "iconAndTextHorizontal" -rpt 0 -label "Select All" -command select Controls ;
			iconTextButton -st  "iconAndTextHorizontal" -label "Quit" -command $command; 

	showWindow;
	}

Any and all help will be appreciated


#2

Hi,

Have you looked at the help MEL help section
https://help.autodesk.com/cloudhelp/2016/CHS/Maya-Tech-Docs/Commands/select.html

I also use this
https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mel/

select -r “pCube*”; (Selects all items labelled pCube in the scene)

sets -n set1 “pCube*”; (Creates a set called set1, with all items labelled pCube in it)

select set1; (Selects the items in the selection set “set1” if it exists…


#3

I attempt the third option because i have a set called “Controls” but for some reason it does not like selecting more than one object and I’m unsure as to why.


#4

and yes i have, my issue is that for some reason my code requires only one selection which does not help when I’m trying to make a select all of specific character controls i have made. I’m still really new to rigging but coding is a hefty wall I’m trying to overcome and I’m just not sure why I’m getting errors.


#5

Have you made a selection set of all the controls you selected ?

Select all the controls you want to select create a selection set (Create : Sets: Set) give it a name like controls.

The type select controls;

It will select all the items you placed in the selection set controls

…Just did it with 12 different items (nurbs curves, poly cubes) and it it worked as intended.


#6

maybe its just not responding right on my end because even selection with mouse would not select the objects within for some reason.


#7

Did you get this sorted ?

If your having trouble with general UI issues, might be best to delete your preferences and /or check you GPU drivers.