string $obj_names[];
string $mtr_names[];
global proc objSearch(){
string $allobj[] = `ls -tr`;
global string $collection;
string $radio = `radioCollection -q -select $collection`;
global string $obj_names[];
global string $mtr_names[];
int $i;
int $j;
for($i=0;$i<size($obj_names);$i++){
string $obj_name = `textField -q -tx $obj_names[$i]`;
string $mtr_name = `textField -q -tx $mtr_names[$i]`;
if($radio == "zenpou"){
$obj_name = $obj_name + "*";
}else if($radio == "bubun"){
$obj_name = "*" + $obj_name + "*";
}
for($j=0;$j<size($allobj);$j++){
int $sw = `gmatch $allobj[$j] $obj_name`;
if($sw!=0){
select $allobj[$j];
hyperShade -assign $mtr_name;
break;
}
}
}
}
global proc addObjForm(){
global string $obj_names[];
global string $mtr_names[];
separator -hr true -h 20 -vis true -st single;
text -label "ObjectName";
$obj_names[size($obj_names)]=`textField`;
text -label "MaterialName";
$mtr_names[size($mtr_names)]=`textField`;
}
string $window_name = `window -resizeToFitChildren true -title "materialAssign"`;
columnLayout;
rowLayout -numberOfColumns 2;
string $collection = `radioCollection`;
radioButton -label "前方一致" -select zenpou;
radioButton -label "部分一致" bubun;
setParent ..;
button -label "検索名の追加" -c "addObjForm()";
string $form = `formLayout -numberOfDivisions 100`;
string $apply_button = `button -label "適用" -c "objSearch()"`;
formLayout -edit -attachNone $apply_button "top"
-attachForm $apply_button "left" 10
-attachForm $apply_button "bottom" 10
-attachForm $apply_button "right" 10
$form;
string $scrollLayout = `scrollLayout -height 200 -width 400 `;
showWindow;
MELスクリプトエディタに張り付け→全て実行
またはMELスクリプトエディタに張り付け→すべて選択し中ボタンドラッグでシェルフに登録
してご利用ください。