Hello there, I will start this off by saying I have minimal scripting abilities (completed first year visual basic in high school) and none with mel and I am trying to get Maya to behave as much like 3DS Max as possible when modeling (I am also learning general rigging but with no hard attachments to any software in that field I am not worried about adapting to Maya in that regard).
I am very pleased with the progress I have made so far but the final thing that I am trying to do is the add a feature where any object I select I can make transparent with a hotkey.
This script I found in this forum: http://forums.autodesk.com/t5/modeling/x-ray-to-some-objects-not-all/td-p/4122962
It is supposed to make it so that if executed when any objects are selected they become transparent but if no object is selected then all objects are X-rayed or not.
[B]global proc r_superXray()
{
string $select[] = `ls -sl`;
int $sizes = `size $select`;
if ($sizes >= 1){
string $mySel[] = `ls -sl -dag -s`;
for ($s in $mySel){
int $xState[] = `displaySurface -q -xRay $s`;
displaySurface -xRay ( !$xState ) $s;
print $xState;
}
}else{
select -all;
string $all[] = `ls -sl -dag -s`;
int $xRayState = 0;
for($obj in $all){
int $xState[] = `displaySurface -q -xRay $obj`;
print $xState;
if (int($xState) == 1){
$xRayState = 1;
break;
}
}
if ( $xRayState == 1){
displaySurface -xRay 0;
}else{
displaySurface -xRay 1;
}
select -cl;
}
}
r_superXray;[/B]
The problem is whenever I try to execute the script in Maya 2013 I get the error: Error: Line 21.27: Cannot cast data of type int[] to int.
I am guessing there is some sort of conflict on Lines 21 and 27 in the script and I do not know Mel script (yet) so I cannot divine the nature of the conflict or how to resolve. If anyone would be so kind to help me and explain to me what caused the issue in the first place.
THANKS!!! :bowdown: