MEL ウエイト調整ツール3

ウエイトツールに更に使いやすさを考え4つまでジョイントを設定できるようにし、まとめてウエイトを表示できるボタンと変更できるボタンを追加。選択頂点にすぐ使用できるようにしました。インフルエンスのロックボタンを追加しました。

ウエイト調整ツールの説明

SkinClusterノードを選択しnameボタンをクリック。
ウエイトを変更したいジョイントを選択しJOINTのnameボタンをクリック。直接打ち込みでも良いです。

Weightボタンは頂点を1つ選択しをクリックした場合のみウエイト値が表示されます。

Enterボタンは入力したウエイト値に変更します。複数の頂点でも使用できます。

SelWeightボタンは選択している頂点のジョイントウエイト値を表示します。(複数選択の場合最初の頂点を表示)

SelEnterボタンは選択している頂点のウエイト値を入力したウエイト値に変更します。複数の頂点でも使用できます。

WeightALLボタンはjoint4つのウエイトを1から4の順序で表示します。(複数選択の場合最初の頂点を表示)
EnterALLボタンはjoint4つのウエイトを1から4の順序で入力したウエイト値に変更します。複数の頂点でも使用できます。

ウエイト値はトータル1です。複数のジョイントを同時に設定する場合は1以下を入力し、トータル1になるようにしてください。
調整がやりやすくなるようにジョイントインフルエンスロックボタンをつけました。
JNT lockONボタンは選択ジョイントをジョイントインフルエンスロックする。
JNT lockOFFボタンは選択ジョイントをジョイントインフルエンスロックを解除する。
ALL JNT lockONボタンは 全てのジョイントを選択しジョイントインフルエンスロックをする。
ALL JNT lockOFFボタンは 全てのジョイントを選択しジョイントインフルエンスロックを解除する。


下記がMELです。






string $window = `window -widthHeight 368 323`;
setParent ..;
showWindow $window;
deleteUI -window $window;


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



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


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;
};


global proc J001is()

{
string $SKN1 = `textField -query -text SKN`;
string $names1= `ls -sl`;
float $J001s = `textField -query -text J001s`;
string $J001 = `textField -query -text J001`;
skinPercent -transformValue $J001 $J001s $SKN1 $names1;
};



global proc SelJnt2()
{
string $Jnts2= `ls -sl`;
for( $Jnt2 in $Jnts2 )
{
textField -e -tx ($Jnt2) J002;
};
};


global proc J002s()
{
string $SKN2 = `textField -query -text SKN`;
string $names2= `ls -sl`;
string $J002 = `textField -query -text J002`;
float $J002s =`skinPercent -transform $J002 -query $SKN2 $names2[0]`;
textField -e -tx ($J002s) J002s;
};


global proc J002is()

{
string $SKN2 = `textField -query -text SKN`;
string $names2= `ls -sl`;
float $J002s = `textField -query -text J002s`;
string $J002 = `textField -query -text J002`;
skinPercent -transformValue $J002 $J002s $SKN2 $names2;
};


global proc SelJnt3()
{
string $Jnts3= `ls -sl`;
for( $Jnt3 in $Jnts3 )
{
textField -e -tx ($Jnt3) J003;
};
};


global proc J003s()
{
string $SKN3 = `textField -query -text SKN`;
string $names3= `ls -sl`;
string $J003 = `textField -query -text J003`;
float $J003s =`skinPercent -transform $J003 -query $SKN3 $names3[0]`;
textField -e -tx ($J003s) J003s;
};


global proc J003is()

{
string $SKN3 = `textField -query -text SKN`;
string $names3= `ls -sl`;
float $J003s = `textField -query -text J003s`;
string $J003 = `textField -query -text J003`;
skinPercent -transformValue $J003 $J003s $SKN3 $names3;
};


global proc SelJnt4()
{
string $Jnts4= `ls -sl`;
for( $Jnt4 in $Jnts4 )
{
textField -e -tx ($Jnt4) J004;
};
};


global proc J004s()
{
string $SKN4 = `textField -query -text SKN`;
string $names4= `ls -sl`;
string $J004 = `textField -query -text J004`;
float $J004s =`skinPercent -transform $J004 -query $SKN4 $names4[0]`;
textField -e -tx ($J004s) J004s;
};


global proc J004is()

{
string $SKN4 = `textField -query -text SKN`;
string $names4= `ls -sl`;
float $J004s = `textField -query -text J004s`;
string $J004 = `textField -query -text J004`;
skinPercent -transformValue $J004 $J004s $SKN4 $names4;
};


global proc LON()

{
string $name;
string $names= `ls -sl`;
for( $name in $names )
{
setAttr ( $name + ".lockInfluenceWeights")1;
};
};


global proc LOFF()

{
string $names= `ls -sl`;
string $name;
for( $name in $names )
{
setAttr ( $name + ".lockInfluenceWeights")0;
};
};


global proc ALON()

{
select `ls -type joint`;
string $name;
string $names= `ls -sl`;
for( $name in $names )
{
setAttr ( $name + ".lockInfluenceWeights")1;
};
};


global proc ALOFF()

{
select `ls -type joint`;
string $name;
string $names[]= `ls -sl`;
for( $name in $names )
{
setAttr ( $name + ".lockInfluenceWeights")0;
};
};


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

columnLayout -adjustableColumn true;

gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "skinCluster" -align "right";
textField -editable true -it "skinCluster1" SKN;
button -label "name" -command "SelSKN";
setParent..;
separator;
separator;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "JOINT1" -align "right";
textField -editable true J001;
button -label "name" -command "SelJnt1";
setParent..;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
button -label "SelWeight" -command "J001s";
textField -editable true J001s;
button -label "SelEnter" -command "J001is";

setParent..;
separator;
separator;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "JOINT2" -align "right";
textField -editable true J002;
button -label "name" -command "SelJnt2";
setParent..;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
button -label "SelWeight" -command "J002s";
textField -editable true J002s;
button -label "SelEnter" -command "J002is";

setParent..;
separator;
separator;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "JOINT3" -align "right";
textField -editable true J003;
button -label "name" -command "SelJnt3";
setParent..;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
button -label "SelWeight" -command "J003s";
textField -editable true J003s;
button -label "SelEnter" -command "J003is";

setParent..;
separator;
separator;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
text -label "JOINT4" -align "right";
textField -editable true J004;
button -label "name" -command "SelJnt4";
setParent..;


gridLayout -numberOfColumns 3 -cellWidth 120 -cellHeight 20;
button -label "SelWeight" -command "J004s";
textField -editable true J004s;
button -label "SelEnter" -command "J004is";

setParent..;

separator;
button -label "WeightALL" -command "J001s;J002s;J003s;J004s";
button -label "EnterALL" -command "J001is;J002is;J003is;J004is";
separator;
gridLayout -numberOfColumns 2 -cellWidth 180 -cellHeight 20;
button -label "JNT lockON" -command "LON";
button -label "JNT lockOFF" -command "LOFF";

setParent..;
separator;
gridLayout -numberOfColumns 2 -cellWidth 180 -cellHeight 20;
button -label "ALL JNT lockON" -command "ALON";
button -label "ALL JNT lockOFF" -command "ALOFF";

setParent..;


showWindow;