忍者ブログ

じぇんどぶろぐ

あたりさわりのないことをかきます

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

コメント

現在、新しいコメントを受け付けない設定になっています。

[Maya][mel]リグ用コントローラの数値初期化、ロック・アンロック、表示非表示ツール

リグ作業をしてたときに、コントローラのアトリビュートをいろいろする作業が地味に大変だったのでmelでボタン化したもの。

//AttEdit
//
//作成:遠藤
//作成日:120319 ver01
//更新:
//選択したノードのアトリビュートエディタの値変更
//ロック・アンロック・フリーズに対応
//

//コントローラーカラー選択用ウィンドウ生成
global proc LockUnlockNode(){
if (`window -ex AttEdit`) deleteUI AttEdit;
window -wh 185 560 -title "AttEdit" AttEdit;
//----------------------------------------------------------------------------
frameLayout -label "Lock" -labelAlign "top" -borderStyle "in";
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.5 0.3 0.3 -label "X" -command "ChangeLock(11)";
button -bgc 0.5 0.3 0.3 -label "Y" -command "ChangeLock(12)";
button -bgc 0.5 0.3 0.3 -label "Z" -command "ChangeLock(13)";
button -bgc 0.5 0.3 0.3 -label "Translate" -command "ChangeLock(1)";
setParent ..;

columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.5 0.3 -label "X" -command "ChangeLock(21)";
button -bgc 0.3 0.5 0.3 -label "Y" -command "ChangeLock(22)";
button -bgc 0.3 0.5 0.3 -label "Z" -command "ChangeLock(23)";
button -bgc 0.3 0.5 0.3 -label "Rotate" -command "ChangeLock(2)";
setParent ..;

columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.3 0.5 -label "X" -command "ChangeLock(31)";
button -bgc 0.3 0.3 0.5 -label "Y" -command "ChangeLock(32)";
button -bgc 0.3 0.3 0.5 -label "Z" -command "ChangeLock(33)";
button -bgc 0.3 0.3 0.5 -label "Scale" -command "ChangeLock(3)";
setParent ..;
columnLayout -adjustableColumn true;
button -bgc 0.4 0.4 0.4 -label "Visibility" -command "ChangeLock(100)";
setParent ..;
setParent ..;
//----------------------------------------------------------------------------

frameLayout -label "Unlock" -labelAlign "top" -borderStyle "in";
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.5 0.3 0.3 -label "X" -command "ChangeLock(41)";
button -bgc 0.5 0.3 0.3 -label "Y" -command "ChangeLock(42)";
button -bgc 0.5 0.3 0.3 -label "Z" -command "ChangeLock(43)";
button -bgc 0.5 0.3 0.3 -label "Translate" -command "ChangeLock(4)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.5 0.3 -label "X" -command "ChangeLock(51)";
button -bgc 0.3 0.5 0.3 -label "Y" -command "ChangeLock(52)";
button -bgc 0.3 0.5 0.3 -label "Z" -command "ChangeLock(53)";
button -bgc 0.3 0.5 0.3 -label "Rotate" -command "ChangeLock(5)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.3 0.5 -label "X" -command "ChangeLock(61)";
button -bgc 0.3 0.3 0.5 -label "Y" -command "ChangeLock(62)";
button -bgc 0.3 0.3 0.5 -label "Z" -command "ChangeLock(63)";
button -bgc 0.3 0.3 0.5 -label "Scale" -command "ChangeLock(6)";
setParent ..;
columnLayout -adjustableColumn true;
button -bgc 0.4 0.4 0.4 -label "Visibility" -command "ChangeLock(111)";
setParent ..;
setParent ..;
//----------------------------------------------------------------------------


frameLayout -label "Freeze" -labelAlign "top" -borderStyle "in";
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.4 0.4 0.4 -label "T" -command "ChangeLock(7)";
button -bgc 0.4 0.4 0.4 -label "R" -command "ChangeLock(8)";
button -bgc 0.4 0.4 0.4 -label "S" -command "ChangeLock(9)";
button -bgc 0.4 0.4 0.4 -label "ALL" -command "ChangeLock(10)";
setParent ..;
setParent ..;
//----------------------------------------------------------------------------

frameLayout -label "Hide" -labelAlign "top" -borderStyle "in";
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.5 0.3 0.3 -label "X" -command "ChangeLock(211)";
button -bgc 0.5 0.3 0.3 -label "Y" -command "ChangeLock(212)";
button -bgc 0.5 0.3 0.3 -label "Z" -command "ChangeLock(213)";
button -bgc 0.5 0.3 0.3 -label "Translate" -command "ChangeLock(210)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.5 0.3 -label "X" -command "ChangeLock(221)";
button -bgc 0.3 0.5 0.3 -label "Y" -command "ChangeLock(222)";
button -bgc 0.3 0.5 0.3 -label "Z" -command "ChangeLock(223)";
button -bgc 0.3 0.5 0.3 -label "Rotate" -command "ChangeLock(220)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.3 0.5 -label "X" -command "ChangeLock(231)";
button -bgc 0.3 0.3 0.5 -label "Y" -command "ChangeLock(232)";
button -bgc 0.3 0.3 0.5 -label "Z" -command "ChangeLock(233)";
button -bgc 0.3 0.3 0.5 -label "Scale" -command "ChangeLock(230)";
setParent ..;
columnLayout -adjustableColumn true;
button -bgc 0.4 0.4 0.4 -label "Visibility" -command "ChangeLock(240)";
setParent ..;
setParent ..;
//----------------------------------------------------------------------------
frameLayout -label "UnHide" -labelAlign "top" -borderStyle "in";
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.5 0.3 0.3 -label "X" -command "ChangeLock(311)";
button -bgc 0.5 0.3 0.3 -label "Y" -command "ChangeLock(312)";
button -bgc 0.5 0.3 0.3 -label "Z" -command "ChangeLock(313)";
button -bgc 0.5 0.3 0.3 -label "Translate" -command "ChangeLock(310)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.5 0.3 -label "X" -command "ChangeLock(321)";
button -bgc 0.3 0.5 0.3 -label "Y" -command "ChangeLock(322)";
button -bgc 0.3 0.5 0.3 -label "Z" -command "ChangeLock(323)";
button -bgc 0.3 0.5 0.3 -label "Rotate" -command "ChangeLock(320)";
setParent ..;
columnLayout -adjustableColumn true;
rowLayout -numberOfColumns 4 -adjustableColumn4 4;
button -bgc 0.3 0.3 0.5 -label "X" -command "ChangeLock(331)";
button -bgc 0.3 0.3 0.5 -label "Y" -command "ChangeLock(332)";
button -bgc 0.3 0.3 0.5 -label "Z" -command "ChangeLock(333)";
button -bgc 0.3 0.3 0.5 -label "Scale" -command "ChangeLock(330)";
setParent ..;
columnLayout -adjustableColumn true;
button -bgc 0.4 0.4 0.4 -label "Visibility" -command "ChangeLock(340)";
setParent ..;
setParent ..;
//----------------------------------------------------------------------------


showWindow;

}


global proc ChangeLock(int $locknum){

//選択ノードの配列への格納
string $names[] =`ls -sl`;

//配列のサイズが0かどうか(何も選択されてないか)
if (`size ($names)` == 0){

print "NoObject";
}
else {
for ($name in $names) {

switch($locknum){
case 1:
setAttr -lock true ( $name + ".tx");
setAttr -lock true ( $name + ".ty");
setAttr -lock true ( $name + ".tz");
break;
case 11:
setAttr -lock true ( $name + ".tx");
break;
case 12:
setAttr -lock true ( $name + ".ty");
break;
case 13:
setAttr -lock true ( $name + ".tz");
break;
case 2:
setAttr -lock true ( $name + ".rx");
setAttr -lock true ( $name + ".ry");
setAttr -lock true ( $name + ".rz");
break;
case 21:
setAttr -lock true ( $name + ".rx");
break;
case 22:
setAttr -lock true ( $name + ".ry");
break;
case 23:
setAttr -lock true ( $name + ".rz");
break;
case 3:
setAttr -lock true ( $name + ".sx");
setAttr -lock true ( $name + ".sy");
setAttr -lock true ( $name + ".sz");
break;
case 31:
setAttr -lock true ( $name + ".sx");
break;
case 32:
setAttr -lock true ( $name + ".sy");
break;
case 33:
setAttr -lock true ( $name + ".sz");
break;
case 4:
CBunlockAttr ( $name + ".tx");
CBunlockAttr ( $name + ".ty");
CBunlockAttr ( $name + ".tz");
break;
case 41:
CBunlockAttr ( $name + ".tx");
break;
case 42:
CBunlockAttr ( $name + ".ty");
break;
case 43:
CBunlockAttr ( $name + ".tz");
break;
case 5:
CBunlockAttr ( $name + ".rx");
CBunlockAttr ( $name + ".ry");
CBunlockAttr ( $name + ".rz");
break;
case 51:
CBunlockAttr ( $name + ".rx");
break;
case 52:
CBunlockAttr ( $name + ".ry");
break;
case 53:
CBunlockAttr ( $name + ".rz");
break;
case 6:
CBunlockAttr ( $name + ".sx");
CBunlockAttr ( $name + ".sy");
CBunlockAttr ( $name + ".sz");
break;
case 61:
CBunlockAttr ( $name + ".sx");
break;
case 62:
CBunlockAttr ( $name + ".sy");
break;
case 63:
CBunlockAttr ( $name + ".sz");
break;
case 7:
channelBoxCommand -freezeTranslate;
break;

case 8:
channelBoxCommand -freezeRotate;
break;

case 9:
channelBoxCommand -freezeScale;
break;
case 10:
channelBoxCommand -freezeTranslate;
channelBoxCommand -freezeRotate;
channelBoxCommand -freezeScale;
break;
/////////////////////////////////////////////////////////////////
case 210:
setAttr -k off ( $name + ".tx");
setAttr -k off ( $name + ".ty");
setAttr -k off ( $name + ".tz");
break;
case 211:
setAttr -k off ( $name + ".tx");
break;
case 212:
setAttr -k off ( $name + ".ty");
break;
case 213:
setAttr -k off ( $name + ".tz");
break;

case 220:
setAttr -k off ( $name + ".rx");
setAttr -k off ( $name + ".ry");
setAttr -k off ( $name + ".rz");
break;
case 221:
setAttr -k off ( $name + ".rx");
break;
case 222:
setAttr -k off ( $name + ".ry");
break;
case 223:
setAttr -k off ( $name + ".rz");
break;

case 230:
setAttr -k off( $name + ".sx");
setAttr -k off( $name + ".sy");
setAttr -k off( $name + ".sz");
break;
case 231:
setAttr -k off ( $name + ".sx");
break;
case 232:
setAttr -k off ( $name + ".sy");
break;
case 233:
setAttr -k off ( $name + ".sz");
break;
/////////////////////////////////////////////////////////////////
case 310:
setAttr -k on ( $name + ".tx");
setAttr -k on ( $name + ".ty");
setAttr -k on ( $name + ".tz");
break;
case 311:
setAttr -k on ( $name + ".tx");
break;
case 312:
setAttr -k on ( $name + ".ty");
break;
case 313:
setAttr -k on ( $name + ".tz");
break;

case 320:
setAttr -k on ( $name + ".rx");
setAttr -k on ( $name + ".ry");
setAttr -k on ( $name + ".rz");
break;
case 321:
setAttr -k on ( $name + ".rx");
break;
case 322:
setAttr -k on ( $name + ".ry");
break;
case 323:
setAttr -k on ( $name + ".rz");
break;

case 330:
setAttr -k on( $name + ".sx");
setAttr -k on( $name + ".sy");
setAttr -k on( $name + ".sz");
break;
case 331:
setAttr -k on ( $name + ".sx");
break;
case 332:
setAttr -k on ( $name + ".sy");
break;
case 333:
setAttr -k on ( $name + ".sz");
break;
/////////////////////////////////////////////////////////////////
case 100:
setAttr -lock true ( $name + ".v");
break;
case 111:
CBunlockAttr ( $name + ".v");
break;
case 240:
setAttr -k off ( $name + ".visibility");
break;
case 340:
setAttr -k on ( $name + ".visibility");
break;
default:
break;
}
}

}
}


LockUnlockNode();
PR

コメント

お名前
タイトル
文字色
メールアドレス
URL
コメント
パスワード Vodafone絵文字 i-mode絵文字 Ezweb絵文字

プロフィール

HN:
tnobu
性別:
非公開

P R