MEL入門005 ウインドウの作成

window -fw -t "ウインドウ名" -rtf 1;
columnLayout -adjustableColumn true;
button -command "実行するスクリプト" -h 16 -label "ボタン名";
showWindow;


例えば
window -fw -t "test" -rtf 1;
columnLayout -adjustableColumn true;
button -command "move -x 0;" -h 16 -label "X=0";
showWindow;

上記のスクリプトをMayaのスクリプトエディタで実行すればウインドウが作成されます。
頂点を選択後、X=0ボタンをクリックするとX=0(y軸)の位置に移動します。


しかし、MEL入門004で説明した下記のスクリプトは " が含まれておりますのでそのままでは使用できませんので

polyProjection -ch 1 -type Planar -ibd on -kir -md b;
setAttr ".projectionWidth" 10;
setAttr ".projectionHeight" 10;

" を \" に置換をし、1行にしましょう。

polyProjection -ch 1 -type Planar -ibd on -kir -md b;setAttr \".projectionWidth\" 10;setAttr \".projectionHeight\" 10;


buttonの行をもう一行複製し下記のように書き換えます。


window -fw -t "test" -rtf 1;
columnLayout -adjustableColumn true;
button -command "move -x 0;" -h 16 -label "X=0";
button -command "polyProjection -ch 1 -type Planar -ibd on -kir -md b;setAttr \".projectionWidth\" 10;setAttr \".projectionHeight\" 10;" -h 16 -label "P_Best";
showWindow;


上記スクリプトを実行しP_Bestボタンをクリックすると 平面マッピングを選択面の方向に行い、projectionサイズを10にします。



それにしても仮面ライダーWのWのドーパントはよく食べる。