MEL ウエイト調整ツール1

MEL入門010で説明した関数を使用し作成しました。
下記ヘルプと読むとMELでウエイト編集ができそうですので今まで説明した技術でつくってみました。

skinCluster コマンド

ウエイト調整ツールの説明
SkinClusterノードを選択しnameボタンをクリック。
ウエイトを変更したしたい頂点を選択しVERTEXのnameボタンをクリック。
ウエイトを変更したいジョイントを選択しJOINTのnameボタンをクリック。
Weightボタンは頂点を1つ選択しVERTEXのnameボタンをクリックした場合のみウエイト値が表示されます。
Enterボタンは入力したウエイト値に変更します。複数の頂点でも使用できます。
SelWeightボタンは選択している頂点のJOINTボタンで設定したジョイントウエイト値を表示します。(頂点を1つ選択)


下記がMELです。



string $window = `window -widthHeight 370 108`;
setParent ..;
showWindow $window;
deleteUI -window $window;


global proc SelSKN()
{
string $skins1= `ls -sl`;
for( $skin1 in $skins1 )
{
textField -e -tx ($skin1) SKN;
};
};


global proc SelNAME()
{
string $names= `ls -sl`;
for( $name in $names )
{
textField -e -tx ($name) VE;
};
};


global proc SelJnt1()
{
string $Jnts1= `ls -sl`;
for( $Jnt1 in $Jnts1 )
{
textField -e -tx ($Jnt1) J001;
};
};


global proc J001()
{
string $SKN1 = `textField -query -text SKN`;
string $VE = `textField -query -text VE`;
string $J001 = `textField -query -text J001`;
float $J001i =`skinPercent -transform $J001 -query $SKN1 $VE`;
textField -e -tx ($J001i) J001i;
};


global proc J001e()

{
string $SKN1 = `textField -query -text SKN`;
string $VE = `textField -query -text VE`;
string $J001 = `textField -query -text J001`;
float $J001e = `textField -query -text J001i`;
skinPercent -transformValue $J001 $J001e $SKN1 $VE;
};


global proc J001s()
{
string $SKN1 = `textField -query -text SKN`;
string $names1= `ls -sl`;
string $J001 = `textField -query -text J001`;
float $J001s =`skinPercent -transform $J001 -query $SKN1 $names1[0]`;
textField -e -tx ($J001s) J001s;
};




window -width 300 -height 135 -title "Weight Tool";

columnLayout -adjustableColumn true;

gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "SkinCluster" -align "left";
textField -editable true SKN;
button -label "name" -command "SelSKN";
setParent..;

gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "VERTEX" -align "left";
textField -editable true VE;
button -label "name" -command "SelNAME";
setParent..;

gridLayout -numberOfColumns 6 -cellWidth 60 -cellHeight 20;
text -label "JOINT" -align "left";
textField -editable true J001;
button -label "name" -command "SelJnt1";
textField -editable true J001i;
button -label "Weight" -command "J001";
button -label "Enter" -command "J001e";
setParent..;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "JOINT_SelWeight" -align "left";
textField -editable true J001s;
button -label "SelWeight" -command "J001s";

setParent..;

showWindow;