如果参数为有效的命令、子程序或脚本,exists 命令将返回 true。
if (exists("sphere")) {
sphere; // make a sphere
}
如果对象存在且包含某个明确的名称,objExists 函数将返回 true:
sphere -name "george";
// Result: george makeNurbSphere1 //
print(objExists("george"));
1
print(objExists("martha"));
0
使用 attributeExists 检查节点上是否存在给定属性。命令的形式为:
attributeExists("attributeName","nodeName")
例如:
if (attributeExists("visibility","mySphere")) {
setAttr mySphere.visibility on;
}