So I’m working on bits of code debugging for a larger project and I’ve run into a snag I don’t quite understand. I’m new to MEL (not so new to maya) so it’s been trial and error to learn what I need to. I’m trying to create a location check (several in fact) so I can change an attribute of an object that reaches a given location. In this particular case I’m trying to check the location of an object against the location of my selected object… they should be the same. However, while the code I’m debugging right now throws no errors and as far as I can see prints the same location my one of my three if checks doesn’t pass.
float $red_Ctrl[] = `xform -q -ws -rp red_ctrl1GRP`;
print $red_Ctrl;
float $red_CtrlX = $red_Ctrl[0];
print $red_CtrlX;
float $red_CtrlY = $red_Ctrl[1];
print $red_CtrlY;
float $red_CtrlZ = $red_Ctrl[2];
print $red_CtrlZ;
string $sel_Ctrl[] = `ls -selection`;
float $sel_Loc[] = `xform -ws -q -rp $sel_Ctrl`;
print $sel_Loc;
float $sel_LocX = $sel_Loc[0];
print $sel_LocX;
float $sel_LocY = $sel_Loc[1];
print $sel_LocY;
float $sel_LocZ = $sel_Loc[2];
print $sel_LocZ; print $sel_Ctrl;
if ($sel_LocX == $red_CtrlX){
print true;
}
else{
print false;
}
if ($sel_LocY == $red_CtrlY){
print true;
}
else{
print false;
}
if ($sel_LocZ == $red_CtrlZ){
print true;
}
else{
print false;
}
The output for the the prints before the if checks comes out as a repetition of “006” but the if checks print “101”. As I understand it, it is telling me the Y values which both print as zero do not equal each other. I don’t understand why…
Can anyone help me out?