ジャンプ先: 概要. 戻り値. キーワード. 関連. フラグ. MEL 例.
addAttr [-attributeType string] [-binaryTag string] [-cachedInternally boolean] [-category string] [-dataType string] [-defaultValue float] [-disconnectBehaviour uint] [-enforcingUniqueName boolean] [-enumName string] [-exists] [-fromPlugin boolean] [-hasMaxValue boolean] [-hasMinValue boolean] [-hasSoftMaxValue boolean] [-hasSoftMinValue boolean] [-hidden boolean] [-indexMatters boolean] [-internalSet boolean] [-keyable boolean] [-longName string] [-maxValue float] [-minValue float] [-multi] [-niceName string] [-numberOfChildren uint] [-parent string] [-proxy string] [-readable boolean] [-shortName string] [-softMaxValue float] [-softMinValue float] [-storable boolean] [-usedAsColor] [-usedAsFilename] [-usedAsProxy] [-worldSpace boolean] [-writable boolean]
addAttr は、取り消し可能、照会可能、および編集可能です。
1 つまたは複数のノードにダイナミック アトリビュートを追加します。longName か shortName のどちらか一方またはその両方を指定する必要があります。dataType と attributeType のどちらも指定しないと、double アトリビュートが追加されます。dataType フラグを複数回指定すると、指定したすべてのタイプが許可されます(論理和)。 double 以外のアトリビュートを追加する場合、次の基準を使用して dataType フラグと attributeType フラグのどちらが適切か判断することができます。double3 など、タイプによってはどちらも使用できる場合があります。このような場合は、データにアトミック エンティティとしてのみアクセスする場合には、-dt フラグを使用します(例えば、double3 を構成する 3 つの個々の値にはアクセスしないような場合)。一般的には、柔軟性を高めるために -at を使用するのが最良です。-dt バージョンはアトミック タイプで個々の部分を変更できないため、ほとんどの場合はアトリビュート エディタ(Attribute Editor)に表示されません。 下記の「(複合)」が付いたすべてのアトリビュートまたは複合アトリビュート自体は、すべての子が定義されるまで(「-p」フラグを使用して作成された複合をその親に設定)、実際にはノードに追加されません。詳細については、例を参照してください。| アトリビュートのタイプ | 使用するフラグと引数 |
|---|---|
| ブーリアン | -at bool |
| 32 ビット整数 | -at long |
| 16 ビット整数 | -at short |
| 8 ビット整数 | -at byte |
| 文字 | -at char |
| 列挙 | -at enum (enumName フラグを使用して enum 名を指定) |
| 浮動小数点数 | -at "float"(float は MEL キーワードのため引用符を使用) |
| 倍精度浮動小数点数 | -at double |
| 角度値 | -at doubleAngle |
| リニア値 | -at doubleLinear |
| 文字列 | -dt "string"(string は MEL キーワードのため引用符を使用) |
| 文字配列 | -dt stringArray |
| 複合 | -at compound |
| メッセージ(データなし) | -at message |
| 時間 | -at time |
| 4x4 二次元行列 | -dt "matrix"(matrix は MEL キーワードのため引用符を使用) |
| 4x4 float 行列 | -at fltMatrix |
| 反射率 | -dt reflectanceRGB |
| 反射率(複合) | -at reflectance |
| スペクトル | -dt spectrumRGB |
| スペクトル(複合) | -at spectrum |
| 2 float | -dt float2 |
| 2 float (複合) | -at float2 |
| 3 float | -dt float3 |
| 3 float (複合) | -at float3 |
| 2 double | -dt double2 |
| 2 double (複合) | -at double2 |
| 3 double | -dt double3 |
| 3 double (複合) | -at double3 |
| 2 x 32 ビット整数 | -dt long2 |
| 2 x 32 ビット整数(複合) | -at long2 |
| 3 x 32 ビット整数 | -dt long3 |
| 3 x 32 ビット整数(複合) | -at long3 |
| 2 x 16 ビット整数 | -dt short2 |
| 2 x 16 ビット整数(複合) | -at short2 |
| 3 x 16 ビット整数 | -dt short3 |
| 3 x 16 ビット整数(複合) | -at short3 |
| 二次元配列 | -dt doubleArray |
| float 配列 | -dt floatArray |
| 32 ビット整数の配列 | -dt Int32Array |
| vector 型の配列 | -dt vectorArray |
| NURBS カーブ | -dt nurbsCurve |
| NURBS サーフェス | -dt nurbsSurface |
| ポリゴン メッシュ | -dt mesh |
| ラティス | -dt lattice |
| 二次元 4D ポイントの配列 | -dt pointArray |
なし
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
| ロング ネーム(ショート ネーム) | 引数タイプ | プロパティ | ||
|---|---|---|---|---|
-attributeType(-at)
|
string
|
|
||
|
||||
-binaryTag(-bt)
|
string
|
|
||
|
||||
-cachedInternally(-ci)
|
boolean
|
|
||
|
||||
-category(-ct)
|
string
|
|
||
|
||||
-dataType(-dt)
|
string
|
|
||
|
||||
-defaultValue(-dv)
|
float
|
|
||
|
||||
-disconnectBehaviour(-dcb)
|
uint
|
|
||
|
||||
-enforcingUniqueName(-eun)
|
boolean
|
|
||
|
||||
-enumName(-en)
|
string
|
|
||
|
||||
-exists(-ex)
|
|
|
||
|
||||
-fromPlugin(-fp)
|
boolean
|
|
||
|
||||
-hasMaxValue(-hxv)
|
boolean
|
|
||
|
||||
-hasMinValue(-hnv)
|
boolean
|
|
||
|
||||
-hasSoftMaxValue(-hsx)
|
boolean
|
|
||
|
||||
-hasSoftMinValue(-hsn)
|
boolean
|
|
||
|
||||
-hidden(-h)
|
boolean
|
|
||
|
||||
-indexMatters(-im)
|
boolean
|
|
||
|
||||
-internalSet(-is)
|
boolean
|
|
||
|
||||
-keyable(-k)
|
boolean
|
|
||
|
||||
-longName(-ln)
|
string
|
|
||
|
||||
-maxValue(-max)
|
float
|
|
||
|
||||
-minValue(-min)
|
float
|
|
||
|
||||
-multi(-m)
|
|
|
||
|
||||
-niceName(-nn)
|
string
|
|
||
|
||||
-numberOfChildren(-nc)
|
uint
|
|
||
|
||||
-parent(-p)
|
string
|
|
||
|
||||
-proxy(-pxy)
|
string
|
|
||
|
||||
-readable(-r)
|
boolean
|
|
||
|
||||
-shortName(-sn)
|
string
|
|
||
|
||||
-softMaxValue(-smx)
|
float
|
|
||
|
||||
-softMinValue(-smn)
|
float
|
|
||
|
||||
-storable(-s)
|
boolean
|
|
||
|
||||
-usedAsColor(-uac)
|
|
|
||
|
||||
-usedAsFilename(-uaf)
|
|
|
||
|
||||
-usedAsProxy(-uap)
|
|
|
||
|
||||
-worldSpace(-ws)
|
boolean
|
|
||
|
||||
-writable(-w)
|
boolean
|
|
||
|
||||
sphere -name earth;
// Add an attribute named ms/mass with a default value of 1 and a
// minimum value of 0.001 and a maximum of 10000.
//
addAttr -shortName ms -longName mass -defaultValue 1.0 -minValue 0.001 -maxValue 10000;
// Add a multi attribute named ff/forcefield of type double3.
//
addAttr -shortName ff -longName forcefield -dataType double3 -multi;
// Add a compound attribute named sampson with children home, midge,
// damien, elizabeth, and sweetpea of varying types
//
addAttr -longName sampson -numberOfChildren 5 -attributeType compound;
addAttr -longName home -attributeType "matrix" -parent sampson;
addAttr -longName midge -attributeType message -parent sampson;
addAttr -longName damien -attributeType double -parent sampson;
addAttr -longName elizabeth -attributeType double -parent sampson;
addAttr -longName sweetpea -attributeType double -parent sampson;
// To add an attribute that is to be interpreted as a color the
// following attribute group must be used.
//
// Note that the word "float" must be in quotations since it is a
// MEL keyword.
//
addAttr -longName rainbow -usedAsColor -attributeType float3;
addAttr -longName redBow -attributeType "float" -parent rainbow;
addAttr -longName greenBow -attributeType "float" -parent rainbow;
addAttr -longName blueBow -attributeType "float" -parent rainbow;
// Other legal attribute types that can be interpreted as colors need
// not specify the "-usedAsColor" flag as it will be assumed. These
// include "-attributeType spectrum", "-attributeType reflectance",
// "-dataType spectrumRGB", and "-dataType reflectanceRGB".
//
addAttr -longName implColor -dataType spectrumRGB;
addAttr -query -usedAsColor ".implColor";
// Result: 1 //
// Add a double3 attribute named sanders with children bess, les and wes
//
addAttr -longName sanders -attributeType double3;
addAttr -longName bess -attributeType double -parent sanders;
addAttr -longName les -attributeType double -parent sanders;
addAttr -longName wes -attributeType double -parent sanders;
// Create a proxy attribute
sphere -name moon;
select earth;
addAttr -longName someProxyAttr -proxy moon.tx;