Hey all,
I’m having some issues with the scriptCtx command in MEL. I’m trying to make a tool that chains together some functions that perform some operations on a list of objects. My selection sets don’t seem to be working at all.
At the end of the scriptCtx, it does call the functions I have listed, but the contents of the selections are wrong. In addition, the second set will not accept a single object alone, I press enter and nothing happens until I select 2 or 3. Then, testProcB prints the wrong set of objects, to boot!:curses:
So clearly I’m doing something crazy wrong here
This is what I’d like to accomplish:
Press a button in a UI
User selects a set of objects and presses Enter
Objects are added $Selection1
User selects another set of objects presses Enter
Objects are added to $Selection2
$Selection1 is passed to testProcA
do some things to objects in $Selection1
$Selection1 is passed to testProcB
do some things to objects in $Selection2
and so on until the end of the chain (set to 2, currently)…
Here’s my code and thanks for reading. This site has really helped me grow as a tech artist
proc testProcA(string $a[]) {
for ($object in $a) {
print("In Selection A: "+$object +"
");
}
}
proc testProcB(string $a[]) {
for ($object in $a) {
print("In Selection B: "+$object +"
");
}
}
if (`contextInfo -exists chainTest`)
deleteUI chainTest;
window;
columnLayout;
button -c "setToolTo chainTest" chainTest;
showWindow;
scriptCtx
-title "chainTest"
-totalSelectionSets 2
-finalCommandScript "testProcA($Selection1); testProcB($Selection2);"
-setNoSelectionPrompt ("1: Select objects")
-setSelectionPrompt ("1: Select more and hit ENTER")
-setAutoToggleSelection false
-setAutoComplete false
-setSelectionCount 0
-setNoSelectionPrompt ("2: Select objects")
-setSelectionPrompt ("2: Select more and hit ENTER")
-setAutoToggleSelection false
-setAutoComplete false
-setSelectionCount 0
chainTest;