The exists command returns true if the argument is a valid command, subroutine, or script.
if (exists("sphere")) { sphere; // make a sphere }
The objExists function returns true when an object exists with a certain name:
sphere -name "george"; // Result: george makeNurbSphere1 // print(objExists("george")); 1 print(objExists("martha")); 0
Use attributeExists to check whether a given attribute exists on a node. The command has the form:
attributeExists("attributeName","nodeName")
if (attributeExists("visibility","mySphere")) { setAttr mySphere.visibility on; }
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License