how do you test if a variable has a null value? I have a variable assignment: $isShape = ls -sl -s; to test whether a selection is a shape node or not (is there an easier way to do this?). If the selection isn't a shape node this variable doesn't seem to have a type, and maya complains when I do anything with it. so how do you test to see if it has a null value? There doesn't seem to be a null reserved word or anything according to the docs...
PS does anyone know of an easier way to test if an selection is a shape node or not? if not I want to select its parent.
thats exactly what I thought too. but it doesn't seem to work that way. just as an example, select a shape node (i just created a sphere, and pressed down), and then run this code:
string $isShape = ls -sl -s; string $temp = ($isShape == "") ? "yes it is" : "no it isn't"; print $temp;
it gives me this error: // Error: line 1: Cannot convert data of type string[] to type string. //
and trying to change the $isShape == "" to: $isShape[0] == "" doesn't work because the array is an empty array. doing a size on that array doesn't seem to work either.
is there anyway I can determine if I have a shape node or a transform node selected? Thanks.
The problem with your version is that ls -sl -s is going to return an array value. You cannot compare a whole array (even an empty one). When you test $isShape it needs to be...