コメントは2種類あります。
//
/* */
matrix 以外は配列にすることができます。
int $x = 3;
if($x > 1)
{
print ("$x is greater than 1\n");
}
string $s = "test";
if($s == "test")
{
print ("$s is test\n");
}
int $x = 2;
switch($x)
{
case 1 :
print "$x is 1\n";
break;
case 2 :
print "$x is 2\n";
break;
default :
print "x is not 1 or 2\n";
}
string $s = "test1";
switch($s)
{
case "test1" :
print "$s is test1\n";
break;
case "test2" :
print "$s is test2\n";
break;
default :
print "x is not test1 or test2\n";
}
int $i = 0;
while($i < 3)
{
print ($i + "\n");
$i++;
}
int $i = 0;
do
{
print ($i + "\n");
$i++;
} while($i < 3)
int $i;
for($i = 0; $i < 3; $i++)
{
print ($i + "\n");
}
string $str[3] = { "aaa", "bbb", "ccc" };
for( $val in $str)
{
print($val + "\n");
}
select nurbsSphere1;
select -tgl curve1;
pathAnimation -startTimeU 0 -endTimeU 300;
[global] proc [返り値の型] <手続きの名前>( [引数, ...] )
{
[MEL文]
[return 返り値;]
}
nameCommand -annotation "Make Sphere and Move"
-command "sphere; move 1 2 3;"
makeSphereAndMoveCommand;
hotkey -k "c" -ctl -name makeSphereAndMoveCommand; // Ctrl + c キーにホットキーを登録
| 変換される型 | |||||
|---|---|---|---|---|---|
| int | float | string | vector | matrix | |
| int | OK | OK | OK | <<$i, $i, $i>> | NONE |
| float | 整数部分 | OK | OK | <<$f, $f, $f>> | NONE |
| string | 整数部分(数字でなければ0) | OK(数字でなければ0) | OK | OK(vectorかfloatでなければ0) | NONE |
| vector | ベクトルの長さの整数部分 | ベクトルの長さ | 3つのfloat | OK | OK([1][3]のみ) |
| matrix | ベクトルの長さの整数部分([1][3]より小さい時) | ベクトルの長さ([1][3]より小さい時) | NONE | OK([1][3]より小さい時) | OK |
| 値 | フォーマット | 拡張子 | 注意 |
|---|---|---|---|
| 1 | SoftImage | .pic | * |
| 2 | WaveFront | .rla | * |
| 3 | TIFF | .tif | * |
| 4 | TIFF16 | .tif | * |
| 5 | SGI | .sgi | * |
| 6 | Alias | .als | * |
| 7 | MAYA | .iff | デフォールト |
| 8 | JPEG | .jpg | * |
| 9 | PostScript | .eps | * |
| 10 | MAYA 16 | .iff | * |
| 11 | Codak Cineon | .cin | * |
| 12 | Abekas NTSC or PAL | .yuv | * |
window;
columnLayout;
button;
showWindow;
window;
columnLayout;
checkBox -label "check1";
checkBox -label "check2";
checkBox -label "check3";
showWindow;
window;
paneLayout;
channelBox;
showWindow;
window;
columnLayout -adj true;
iconTextButton -style "iconOnly" -image1 "sphere.xpm" -label "sphere";
iconTextButton -style "iconAndTextHorizontal" -image1 "cone.xpm" -label "cone";
iconTextButton -style "iconAndTextVertical" -image1 "cube.xpm" -label "cube";
showWindow;
window;
columnLayout -adj true;
text -label "help line";
helpLine;
showWindow;
window;
columnLayout -adj true;
iconTextCheckBox -style "iconOnly" -image1 "sphere.xpm" -label "sphere";
iconTextCheckBox -style "iconAndTextHorizontal" -image1 "cone.xpm" -label "cone";
iconTextCheckBox -style "iconAndTextVertical" -image1 "cube.xpm" -label "cube";
showWindow;
window;
columnLayout -adj true;
iconTextRadioCollection sampleIconTextRadioCollection;
iconTextRadioButton -st "iconOnly" -i1 "sphere.xpm" -l "sphere" -select;
iconTextRadioButton -st "iconAndTextHorizontal" -i1 "cone.xpm" -l "cone";
iconTextRadioButton -st "iconAndTextVertical" -i1 "cube.xpm" -l "cube";
showWindow;
window;
columnLayout -adj true;
nodeIconButton -style "iconOnly" -command "torus" -image1 "torus.xpm";
nodeIconButton -style "iconAndTextHorizontal" -command "directionalLight" -image1 "directionallight.xpm" -label "directional Light";
showWindow;
window;
columnLayout;
radioCollection;
radioButton -label "button1" -select;
radioButton -label "button2";
radioButton -label "button3";
showWindow;
string $ramp = `createNode ramp`;
window;
columnLayout;
rampColorPort -node $ramp;
showWindow;
window;
columnLayout -adj true;
text -label "-style default";
separator;
text -label "-style none";
separator -style "none";
text -label "-style single";
separator -style "single";
text -label "-style double";
separator -height 10 -style "double";
text -label "-style singleDash";
separator -height 10 -style "singleDash";
text -label "-style doubleDash";
separator -height 40 -style "doubleDash";
text -label "-style in";
separator -height 40 -style "in";
text -label "-style out";
separator -height 40 -style "out";
showWindow;
window;
columnLayout;
shelfLayout;
shelfButton -annotation "sphere" -image1 "sphere.xpm" -command "sphere";
shelfButton -annotation "cone" -image1 "cone.xpm" -command "cone";
showWindow;
window;
columnLayout;
symbolButton -image "sphere.xpm";
symbolButton -image "cube.xpm";
showWindow;
window;
columnLayout;
symbolCheckBox -image "sphere.xpm";
symbolCheckBox -image "cube.xpm";
showWindow;
window;
columnLayout;
string $shname = `shadingNode -asShader lambert`;
swatchDisplayPort -wh 64 64 -sn $shname;
attrColorSliderGrp -at ($shname + ".color");
showWindow ;
window;
columnLayout;
text -label "text1";
text -label "text2";
showWindow;
window;
paneLayout;
textScrollList -allowMultiSelection true
-append "test1"
-append "test2"
-append "test3"
-append "test4"
-append "test5"
-append "test6"
-selectItem "test2"
-showIndexedItem 4;
showWindow;
window;
columnLayout;
toolCollection;
toolButton
-tool selectSuperContext
-toolImage1 selectSuperContext "aselect.xpm";
toolButton
-tool moveSuperContext
-toolImage1 moveSuperContext "move_M.xpm";
toolButton
-tool scaleSuperContext
-toolImage1 scaleSuperContext "scale_M.xpm";
showWindow;
window;
columnLayout -adj true;
floatSlider;
showWindow;
window;
columnLayout -adj true;
floatSliderGrp -field true -min 0.0 -max 10.0 -value 2.0;
showWindow;
window;
columnLayout -adj true;
floatScrollBar;
showWindow;
window;
columnLayout -adj true;
intSlider;
showWindow;
window;
columnLayout -adj true;
intSliderGrp -field true -min 0 -max 10 -value 2;
showWindow;
window;
columnLayout -adj true;
intScrollBar;
showWindow;
window;
columnLayout;
colorSliderGrp -label "Color" -rgb 1 0 0;
showWindow;
window;
columnLayout;
colorIndexSliderGrp -label "Indexed Color" -min 1 -max 31 -value 1;
showWindow;
window;
columnLayout;
colorSliderButtonGrp
-label "Label"
-buttonLabel "button"
-buttonCommand "sphere"
-rgb 1 0 0
-symbolButtonDisplay true
-columnWidth 5 25
-image "navButtonUnconnected.xpm";
showWindow;
window;
columnLayout -adj true;
floatField;
showWindow;
window;
columnLayout -adj true;
intField;
showWindow;
window;
columnLayout -adj true;
string $sname[] = `sphere`;
nameField -object $sname[0];
showWindow;
window;
columnLayout -adj true;
scrollField -text "scrollField";
showWindow;
window;
columnLayout -adj true;
shellField;
showWindow;
window;
columnLayout -adj true;
textField;
showWindow;
window;
columnLayout;
textFieldButtonGrp -label "Label" -text "textFieldButtonGrp" -buttonLabel "Button";
showWindow;
window -menuBar true -width 150;
menu -label "Menu" -tearOff true;
menuItem -label "menu1";
menuItem -label "menu2";
menuItem -label "menu3";
menuItem -divider true;
menuItem -label "menu4";
menu -label "Help" -helpMenu true;
menuItem -label "help";
columnLayout;
button;
showWindow;
window;
columnLayout;
optionMenu -label "Menu";
menuItem -label "test1";
menuItem -label "test2";
menuItem -label "test3";
showWindow;
window;
columnLayout;
button;
popupMenu;
menuItem -label "test1";
menuItem -label "test2";
menuItem -label "test3";
showWindow;
window;
columnLayout;
button;
button;
button;
showWindow;
window;
string $form = `formLayout -numberOfDivisions 100`;
string $b1 = `button -label "button1"`;
string $b2 = `button -label "button2"`;
string $b3 = `button -label "button3"`;
string $b4 = `button -label "button4"`;
formLayout -edit
-attachForm $b1 "top" 5
-attachForm $b1 "left" 5
-attachControl $b1 "bottom" 15 $b2
-attachPosition $b1 "right" 0 55
-attachNone $b2 "top"
-attachForm $b2 "left" 10
-attachForm $b2 "bottom" 10
-attachForm $b2 "right" 10
-attachForm $b3 "top" 5
-attachPosition $b3 "left" 0 70
-attachControl $b3 "bottom" 25 $b4
-attachForm $b3 "right" 5
-attachNone $b4 "top"
-attachPosition $b4 "left" 0 60
-attachControl $b4 "bottom" 35 $b2
-attachForm $b4 "right" 5
$form;
showWindow;
window;
columnLayout -adjustableColumn true;
frameLayout -label "Frame1" -labelAlign "top" -borderStyle "in";
columnLayout;
button;
button;
setParent ..;
setParent ..;
frameLayout -label "Frame2" -labelAlign "center" -borderStyle "out";
columnLayout;
button;
button;
setParent ..;
setParent ..;
frameLayout -label "Frame3" -labelAlign "center" -borderStyle "etchedIn";
columnLayout;
button;
button;
setParent ..;
setParent ..;
frameLayout -label "Frame4" -labelAlign "bottom" -borderStyle "etchedOut";
columnLayout;
button;
button;
setParent ..;
setParent ..;
showWindow;
window;
gridLayout -numberOfColumns 3 -cellWidthHeight 50 30;
button;
button;
button;
button;
button;
showWindow;
window;
columnLayout -adjustableColumn true;
menuBarLayout;
menu -label "File";
menuItem -label "New";
menuItem -label "Open";
menuItem -label "Close";
menu -label "Help" -helpMenu true;
menuItem -label "About...";
setParent ..;
button;
button;
showWindow;
window;
paneLayout -configuration "quad";
button;
columnLayout;
button;
button;
setParent ..;
rowLayout -numberOfColumns 2 -columnWidth2 55 50;
button;
button;
setParent ..;
text -label "paneLayout";
showWindow;
window;
rowColumnLayout -numberOfRows 3
-rowHeight 1 30
-rowHeight 2 50;
button;
button;
button;
button;
button;
button;
button;
showWindow;
window;
rowLayout -numberOfColumns 3 -columnWidth3 65 55 60;
button;
button;
button;
showWindow;
window;
scrollLayout -horizontalScrollBarThickness 16 -verticalScrollBarThickness 16;
columnLayout;
int $i;
for($i = 0; $i < 10; $i++)
{
text -label ("label " + $i);
}
showWindow;
window;
shelfLayout;
iconTextButton -style "iconOnly" -image1 "sphere.xpm";
iconTextButton -style "iconOnly" -image1 "cone.xpm";
iconTextButton -style "iconOnly" -image1 "cube.xpm";
setParent ..;
showWindow;
window;
shelfTabLayout -image "smallTrash.xpm" -imageVisible true;
shelfLayout Shelf1;
setParent ..;
shelfLayout Shelf2;
setParent ..;
showWindow;
window;
string $tabs = `tabLayout`;
string $col1 = `columnLayout`;
button;
setParent ..;
string $col2 = `columnLayout`;
button;
button;
setParent ..;
tabLayout -edit -tabLabel $col1 "tab1" -tabLabel $col2 "tab2" $tabs;
showWindow;
window;
paneLayout;
hardwareRenderPanel;
showWindow;
window;
paneLayout;
hyperPanel;
showWindow;
window;
paneLayout;
modelEditor;
showWindow;
window;
paneLayout;
modelPanel;
showWindow;
string $sname[] = `sphere`;
window;
paneLayout;
nodeOutliner -showInputs true -a $sname[0];
showWindow;
window;
paneLayout;
outlinerPanel;
showWindow;
sphere;
window;
paneLayout;
spreadSheetEditor -mainListConnection `selectionConnection -activeList`;
showWindow;
window;
frameLayout -label "scriptEditor" scriptEditorFrameLayout;
scriptedPanel -e -p scriptEditorFrameLayout scriptEditorPanel1;
showWindow;
global proc int importMayaBinary( string $filename, string $fileType )
{
print ($filename+"\n");
print ($fileType+"\n");
return 1;
}
fileBrowserDialog -m 0 -fc "importMayaBinary" -ft "mayaBinary" -an "MayaBinary";
global proc checkboxPrompt()
{
string $form = `setParent -q`;
formLayout -e -width 300 $form;
string $t = `text -l "以下のいづれかのボタンを押してください"`;
string $b1 = `button -l "Abort" -c "layoutDialog -dismiss \"作成\""`;
string $b2 = `button -l "Skip" -c "layoutDialog -dismiss \"適用\""`;
string $b3 = `button -l "Continue" -c "layoutDialog -dismiss \"中止\""`;
string $cb1 = `checkBox -label "操作を覚えておく"`;
int $spacer = 5;
int $top = 5;
int $edge = 5;
formLayout -edit
-attachForm $t "top" $top
-attachForm $t "left" $edge
-attachNone $t "bottom"
-attachForm $t "right" $edge
-attachControl $b1 "top" $spacer $t
-attachForm $b1 "left" $edge
-attachNone $b1 "bottom"
-attachPosition $b1 "right" $spacer 33
-attachControl $b2 "top" $spacer $t
-attachPosition $b2 "left" $spacer 33
-attachNone $b2 "bottom"
-attachPosition $b2 "right" $spacer 66
-attachControl $b3 "top" $spacer $t
-attachPosition $b3 "left" $spacer 66
-attachNone $b3 "bottom"
-attachForm $b3 "right" $edge
-attachControl $cb1 "top" $spacer $b1
-attachForm $cb1 "left" $edge
-attachForm $cb1 "bottom" $spacer
-attachNone $cb1 "right"
$form;
}
layoutDialog -ui "checkboxPrompt";
window;
columnLayout;
webBrowser -w 800 -h 600 -url "http://www.not-enough.org/abe/manual/";
showWindow;