コマンド、オブジェクトおよびアトリビュートの存在をテストする
 
 
 

コマンドおよびスクリプト: exists

exists コマンドは、引数が有効なコマンド、サブルーチンまたはスクリプトの場合、true を返します。

if (exists("sphere")) {
	sphere; // make a sphere
}

オブジェクト: objExists

objExists 関数は、特定の名前のオブジェクトが存在する場合に、true を返します。

sphere -name "george";
// Result: george makeNurbSphere1 //
print(objExists("george"));
1
print(objExists("martha"));
0

ノード上のアトリビュート: attributeExists

attributeExists を使用して、指定されたアトリビュートがノード上に存在するかどうかを確認します。このコマンドの形式は次の通りです。

attributeExists("attributeName","nodeName")

例:

if (attributeExists("visibility","mySphere")) {
	setAttr mySphere.visibility on;
}