I'm new to mel script. I know that I can toggle manually xray with the code.
displaySurface -xRay true; //Xray on
displaySurface -xRay false; //Xray off
But I want it to toggle automatically, like
if(xRay on)
set xRay off
else
set xRay on
I know that I can check xRay on or off with the command
displaySurface -query -xRay;
But I just can't put this command into if block
. I tried many things like the code below, but nothing works.
if(`displaySurface -query -xRay` == 1) // Error: line 1: Cannot use data of type int[] in a scalar operation. //
print("To be or not to be");
Looks like displaySurface -query -xRay
is returning an array. This worked for me:
int $y[] = `displaySurface -query -xRay`;
if( $y[0] == 1)
print("To be or not to be");