アットウィキロゴ

【MAYA】MEL

「【MAYA】MEL」の編集履歴(バックアップ)一覧に戻る

【MAYA】MEL - (2016/02/24 (水) 16:51:56) のソース

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

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

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

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



|&bold(){スケマティックビュー上のノードのカラーを一括で変更するMEL}|

//ハイパーグラフ上のノードの色を一括で変更する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の数値をいじって合わせてください。
 */
ツールボックス

下から選んでください:

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