【MAYA】MEL

自作したMEL置き場とか覚えたこととか

  • MELを書く際に注意すること
MELコマンドはすべてヘルプに詳細が書いてあるので、
わからないものがあればそこで調べる。
そこに記載されていなければ、それはMELコマンドではないルールなので別途調べること。

""(ダブルクォーテーション) 文字列を使用するときに使用する
``(シングルクォーテーション) MAYAのコマンドを使用するときに使用する
なにもつけないもの ただの数値、あるいは変数

変数を使用する場合は、頭に$をつける。



スケマティックビュー上のノードのカラーを一括で変更するMEL

global proc NodeColorRed ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")13;
};

}

global proc NodeColorGreen ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")14;
};

}

global proc NodeColorYellow ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")21;
};

}

global proc NodeColorBlue ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")18;
};

}

global proc NodeColorPurple ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")30;
};

}

global proc NodeColorGray ()
{
for($work in `ls -sl`){
setAttr ($work+".overrideEnabled")1;
setAttr ($work+".overrideColor")0;
};

}

window -title "NodeColor";

rowLayout -numberOfColumns 6;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorRed" -bgc 1 0 0;
setParent ..;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorPurple" -bgc 0.7 0 0.9;
setParent ..;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorYellow" -bgc 1 0.5 0;
setParent ..;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorBlue" -bgc 0 1 1;
setParent ..;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorGreen" -bgc 0 1 0;
setParent ..;

string $columnLayoutName1 = `columnLayout`;
button -label "" -command "NodeColorGray" -bgc 0.5 0.5 0.5;
setParent ..;

showWindow;
/*
13=赤
14=黄緑
17=黄色
18=水色
30=紫
0=灰色
上記の色はインデックスカラーを使用しているため、
使用する色を細かく変えたい場合は、【ウィンドウ】⇒【設定/プリファレンス】⇒【カラー設定】⇒【アクティブ】から
カラーパレットの色を変更することで細かい色の指定ができる。
インデックスカラーが変更されてもGUIのボタンの色は変更されないので、
bgcの数値をいじって合わせてください。
*/
最終更新:2016年02月24日 16:51
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。