Epopisces
10-02-2005, 03:49 AM
Ok, I am trying to create a rig, decked out with all the coolest tricks and toys that I don't yet know how to make (sounds like a plan, right? :wise: lols). Anyway, I've been trying to figure out how to, when a certain curve is selected, deselect it and select three Clusters instead (which control the curves shape, and the deformation). I'm trying to do it with scriptJob command, as for whatever reason I couldn't get an equivalent script to work as an expression.
Note: I had more comments but they were more to explain to myself all the different commands, and some were. . .lame so I removed them for public viewing (=.
LowerBrow and UpperBrow are the curves in question, with the Clusters all being named starting with 'Lower' or 'Upper'. The Clusters are one on the rightmost cv, one on leftmost cv, and one cluster is on the 2 center cvs, for each of the curves.
Here it is:
//the whole purpose of this script is to change the selection of one thing to another
scriptJob -e "SelectionChanged" LJGReselect;
global proc LJGReselect()
{
int $twoSel = 0;
//Discovered a VERY handy part of list command; will list all selected objects ending in //"erBrow" (so in this case, LowerBrow and UpperBrow but NOT UpperRightBrow.
string $allSelected[] = `ls -sl "*erBrow"`;
switch ($allSelected[0])
{
case "LowerBrow":
select "Lower*";
$twoSel = 1;
break;
case "UpperBrow":
select "Upper*";
$twoSel = 1;
break;
}
if ($twoSel == 1)
{ switch ($allSelected[1])
{
case "LowerBrow":
select "Lower*";
break;
case "UpperBrow":
select "Upper*";
break;
}
}
select -d UpperBrow;
select -d LowerBrow;
}
//WARNING: Mucho buggos. This script destroys the undo function
//when it involves the curve in question. Much work needed!
Yeah, my problems are:
1. Undo stops working when used.
2. The clusters cannot be UNselected once they are selected using the script.
3. For whatever reason when the UpperBrow and LowerBrow curves are deselected, they remain highlighted as if still selected.
If anyone has a solution or better method, have pity on a poor MEL-noob. . .
Note: I had more comments but they were more to explain to myself all the different commands, and some were. . .lame so I removed them for public viewing (=.
LowerBrow and UpperBrow are the curves in question, with the Clusters all being named starting with 'Lower' or 'Upper'. The Clusters are one on the rightmost cv, one on leftmost cv, and one cluster is on the 2 center cvs, for each of the curves.
Here it is:
//the whole purpose of this script is to change the selection of one thing to another
scriptJob -e "SelectionChanged" LJGReselect;
global proc LJGReselect()
{
int $twoSel = 0;
//Discovered a VERY handy part of list command; will list all selected objects ending in //"erBrow" (so in this case, LowerBrow and UpperBrow but NOT UpperRightBrow.
string $allSelected[] = `ls -sl "*erBrow"`;
switch ($allSelected[0])
{
case "LowerBrow":
select "Lower*";
$twoSel = 1;
break;
case "UpperBrow":
select "Upper*";
$twoSel = 1;
break;
}
if ($twoSel == 1)
{ switch ($allSelected[1])
{
case "LowerBrow":
select "Lower*";
break;
case "UpperBrow":
select "Upper*";
break;
}
}
select -d UpperBrow;
select -d LowerBrow;
}
//WARNING: Mucho buggos. This script destroys the undo function
//when it involves the curve in question. Much work needed!
Yeah, my problems are:
1. Undo stops working when used.
2. The clusters cannot be UNselected once they are selected using the script.
3. For whatever reason when the UpperBrow and LowerBrow curves are deselected, they remain highlighted as if still selected.
If anyone has a solution or better method, have pity on a poor MEL-noob. . .
