- ボタン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.button()
- チェックボックス
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.checkBox(label='チェック1')
pm.checkBox(label='チェック2')
pm.checkBox(label='チェック3')
- チャンネルボックス
import pymel.core as pm
name = pm.sphere()
with pm.window():
with pm.paneLayout():
pm.channelBox(name[0])
- cmdScrollFieldExecuter
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.cmdScrollFieldExecuter(showLineNumbers=True, sourceType='python')
- cmdScrollFieldReporter
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.cmdScrollFieldReporter()
- gradientControl
import pymel.core as pm
pname = pm.createNode('polySplitRing')
with pm.window():
with pm.autoLayout():
pm.gradientControl(h=90, at=pname+'.profileCurve')
- gradientControlNoAttr
import pymel.core as pm
pm.optionVar(stringValueAppend=['myCurveOptionVar', '0, 1, 2'])
pm.optionVar(stringValueAppend=['myCurveOptionVar', '1, 0, 2'])
with pm.window():
with pm.autoLayout():
gname = pm.gradientControlNoAttr(h=90)
gname.setOptionVar('myCurveOptionVar')
- ヘルプライン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.helpLine()
- hudButton
import pymel.core as pm
def myHudButton(*args):
print 'pressed'
pm.hudButton('myHudButton', section=7, block=2, visible=True,
label='myHudButton', buttonWidth=80, buttonShape='roundRectangle',
releaseCommand=myHudButton)
(注)
以下のコマンドで消去できる。
pm.headsUpDisplay(rem='myHudButton')
- hudSlider
import pymel.core as pm
def myHudSlider(state, hud):
val = pm.hudSlider(hud, q=True, value=True)
print state, val
pm.hudSlider('myHudSlider', section=7, block=2, visible=True, label='myHudButton',
type='int', value=0, minValue=-10, maxValue=10,
labelWidth=80, valueWidth=50, sliderLength=100, sliderIncrement=1,
pressCommand=pm.Callback(myHudSlider, 'press', 'myHudSlider'),
dragCommand=pm.Callback(myHudSlider, 'drag', 'myHudSlider'),
releaseCommand=pm.Callback(myHudSlider, 'release', 'myHudSlider')
)
- hudSliderButton
import pymel.core as pm
def myHudSliderButton(state, hud):
val = pm.hudSliderButton(hud, q=True, value=True)
print state, val
pm.hudSliderButton('myHudSliderButton', section=5, block=5, visible=True,
sliderLabel='Slider', type='int', value=0, minValue=-10, maxValue=10,
sliderLabelWidth=50, valueWidth=50, sliderLength=100, sliderIncrement=1,
buttonLabel='Button', buttonWidth=60, buttonShape='rectangle',
buttonReleaseCommand=pm.Callback(myHudSliderButton, 'release', 'myHudSliderButton')
)
- iconTextButton
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.iconTextButton(style='iconOnly', image1='sphere.xpm', label='球体')
pm.iconTextButton(style='iconAndTextHorizontal', image1='cone.xpm', label='コーン')
pm.iconTextButton(style='iconAndTextVertical', image1='cube.xpm', label='立方体')
- iconTextCheckBox
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.iconTextCheckBox(style='iconOnly', image1='sphere.xpm', label='球体')
pm.iconTextCheckBox(style='iconAndTextHorizontal', image1='cone.xpm', label='コーン')
pm.iconTextCheckBox(style='iconAndTextVertical', image1='cube.xpm', label='立方体')
- iconTextRadioCollection
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.iconTextRadioCollection('sampleIconTextRadioCollection')
pm.iconTextRadioButton(style='iconOnly', select=True, image1='sphere.xpm', label='球体')
pm.iconTextRadioButton(style='iconAndTextHorizontal', image1='cone.xpm', label='コーン')
pm.iconTextRadioButton(style='iconAndTextVertical', image1='cube.xpm', label='立方体')
- イメージ
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.image(image='z:/tmp/check1.png')
- layerButton
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.layerButton(label='defaultLayer', color=(1.0, 0.0, 0.0), select=True)
pm.layerButton(label='nextLayer', color=(0.0, 1.0, 0.0))
- メッセージライン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.text(label='message line')
pm.messageLine()
- nodeIconButton
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.nodeIconButton(style='iconOnly', command='torus', image1='torus.xpm')
pm.nodeIconButton(style='iconAndTextHorizontal', command='directionalLight', image1='directionallight.xpm', label='ディレクショナルライト')
- picture
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.picture(image='z:/tmp/check2.png')
- ラジオボタン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.radioCollection()
pm.radioButton(label='ボタン 1', select=True)
pm.radioButton(label='ボタン 2')
pm.radioButton(label='ボタン 3')
- ラジオボタングループ
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.radioButtonGrp(numberOfRadioButtons=3,
label='位置', select=True, labelArray3=('X', 'Y', 'Z'))
- rampColorPort
import pymel.core as pm
with pm.window():
with pm.autoLayout():
ramp = pm.createNode('ramp')
pm.rampColorPort(node=ramp)
- rangeControl
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.rangeControl('myRangeSlider', minRange=0, maxRange=60)
- scriptTable
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.scriptTable(rows=4, columns=2, label=((1, 'Column 1'), (2,'Column 2')))
- セパレータ
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.text(label='style=default')
pm.separator()
pm.text(label='style=none')
pm.separator(style='none')
pm.text(label='style=single')
pm.separator(style='single')
pm.text(label='style=double')
pm.separator(height=10, style='double')
pm.text(label='style=singleDash')
pm.separator(height=10, style='singleDash')
pm.text(label='style=doubleDash')
pm.separator(height=40, style='doubleDash')
pm.text(label='style=in')
pm.separator(height=40, style='in')
pm.text(label='style=out')
pm.separator(height=40, style='out')
- シェルフボタン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
with pm.shelfLayout():
pm.shelfButton(annotation='球体', image1='sphere.xpm', command='pm.sphere()')
pm.shelfButton(annotation='コーン', image1='cone.xpm', command='pm.cone()')
- スイッチテーブル
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.switchTable()
- シンボルボタン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.symbolButton(image='sphere.xpm')
pm.symbolButton(image='cube.xpm')
- シンボルチェックボックス
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.symbolCheckBox(image='sphere.xpm')
pm.symbolCheckBox(image='cube.xpm')
- swatchDisplayPort
import pymel.core as pm
with pm.window():
with pm.autoLayout():
shname = pm.shadingNode('lambert', asShader=True)
pm.swatchDisplayPort(wh=(64, 64), sn=shname)
pm.attrColorSliderGrp(at=shname + '.color')
- テキスト
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.text(label='ラベル 1')
pm.text(label='ラベル 2')
- テキストスクロールリスト
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.textScrollList(allowMultiSelection=True,
append=('テスト 1',
'テスト 2',
'テスト 3',
'テスト 4',
'テスト 5',
'テスト 6'),
selectItem='テスト 2',
showIndexedItem=4)
- タイムポート
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.timePort()
- ツールボタン
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.toolCollection()
pm.toolButton(tool='selectSuperContext',
toolImage1=('selectSuperContext', 'aselect.xpm'))
pm.toolButton(tool='moveSuperContext',
toolImage1=('moveSuperContext', 'move_M.xpm'))
pm.toolButton(tool='scaleSuperContext',
toolImage1=('scaleSuperContext', 'scale_M.xpm'))
- attrFieldSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
name = pm.sphere()
pm.attrFieldSliderGrp(label='移動X', min=-10.0, max=10.0, at=name[0] + '.tx')
- attrColorSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
sname = pm.shadingNode('phong', asShader=True)
pm.attrColorSliderGrp(at=sname + '.color')
- attrFieldGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
name = pm.sphere()
pm.attrFieldGrp(label='移動 XYZ', min=-10.0, max=10.0, at=name[0] + '.t')
- attrNavigationControlGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
sname = pm.shadingNode('blinn', asShader=True)
pm.attrNavigationControlGrp(label='バンプマッピング', at=sname + '.normalCamera')
- colorSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.colorSliderGrp(label='RGB', rgb=(1, 0, 0))
- colorIndexSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.colorIndexSliderGrp(label='インデックス カラー', min=1, max=31, value=1)
- colorSliderButtonGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.colorSliderButtonGrp(label='ラベル',
buttonLabel='ボタン',
buttonCommand='球体',
rgb=(1, 0, 0),
symbolButtonDisplay=True,
columnWidth=(5, 25),
image='navButtonUnconnected.xpm')
- floatSlider
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatSlider()
- floatSlider2
import pymel.core as pm
with pm.window():
with pm.columnLayout():
name = pm.sphere()
pm.scale([2.0, 3.0, 1.0]);
pm.floatField('myFloatField1', value=2.0)
pm.floatSlider2('myFloatSlider2')
pm.floatField('myFloatField2', value=3.0)
pm.floatSlider2('myFloatSlider2', e=True,
positionControl1='myFloatField1', positionControl2='myFloatField2',
polarity=1, max=5,
value1=2.0, value2=3.0,
changeCommand1='setAttr ' + name[0] + '.sx',
changeCommand2='setAttr ' + name[0] + '.sy')
- floatSliderButtonGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatSliderButtonGrp(label='ラベル', field=True,
buttonLabel='ボタン', symbolButtonDisplay=True,
columnWidth=(5, 40), image='sphere.xpm')
- floatSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatSliderGrp(label='ラベル', field=True, min=0.0, max=10.0, value=2.0)
- floatScrollBar
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatScrollBar()
- intSlider
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.intSlider()
- intSliderGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.intSliderGrp(label='ラベル', field=True, min=0, max=10, value=2)
- intScrollBar
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.intScrollBar(min=10, max=100, value=0, step=1, largeStep=10)
- floatField
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatField(min=1.0, max=10.0, value=2.0)
- floatFieldGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.floatFieldGrp(numberOfFields=3,
label='Value', extraLabel='mm',
value1=0.3, value2=0.5, value3=0.1)
- intField
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.intField(min=1, max=10, value=2)
- intFieldGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.intFieldGrp(numberOfFields=3,
label='Value', extraLabel='mm',
value1=3, value2=2, value3=1)
- nameField
import pymel.core as pm
with pm.window():
with pm.autoLayout():
sname = pm.sphere()
pm.nameField(object=sname[0])
- scrollField
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.scrollField(text='scrollField')
- cmdShell
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.cmdShell()
- textField
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.textField(text='text', font='boldLabelFont')
- textFieldButtonGrp
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.textFieldButtonGrp(label='ラベル', text='textFieldButtonGrp', buttonLabel='ボタン')
- メニュー
import pymel.core as pm
with pm.window(menuBar=True, width=150):
pm.menu(label='Menu', tearOff=True)
pm.menuItem(label='menu1')
pm.menuItem(label='menu2')
pm.menuItem(label='menu3')
pm.menuItem(divider=True)
pm.menuItem(label='menu4')
pm.menu(label='Help', helpMenu=True)
pm.menuItem(label='help')
with pm.autoLayout():
pm.button(label='ボタン')
- オプションメニュー
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.optionMenu(label='Menu')
pm.menuItem(label='test1')
pm.menuItem(label='test2')
pm.menuItem(label='test3')
- ポップアップメニュー
import pymel.core as pm
with pm.window():
with pm.autoLayout():
pm.button()
pm.popupMenu()
pm.menuItem(label='test1')
pm.menuItem(label='test2')
pm.menuItem(label='test3')
- columnLayout
import pymel.core as pm
with pm.window():
with pm.columnLayout():
pm.button()
pm.button()
pm.button()
- formLayout
import pymel.core as pm
with pm.window():
with pm.formLayout() as form:
b1 = pm.button(label='ボタン1')
b2 = pm.button(label='ボタン2')
b3 = pm.button(label='ボタン3')
b4 = pm.button(label='ボタン4')
form.attachForm(b1, 'top', 5)
form.attachForm(b1, 'left', 5)
form.attachPosition(b1, 'right', 0, 55)
form.attachControl(b1, 'bottom', 15, b2)
form.attachNone(b2, 'top')
form.attachForm(b2, 'left', 10)
form.attachForm(b2, 'right', 10)
form.attachForm(b2, 'bottom', 10)
form.attachForm(b3, 'top', 5)
form.attachPosition(b3, 'left', 0, 70)
form.attachForm(b3, 'right', 5)
form.attachControl(b3, 'bottom', 25, b4)
form.attachNone(b4, 'top')
form.attachPosition(b4, 'left', 0, 60)
form.attachForm(b4, 'right', 5)
form.attachControl(b4, 'bottom', 35, b2)
- frameLayout
import pymel.core as pm
with pm.window():
with pm.autoLayout():
with pm.frameLayout(label='フレーム1', labelAlign='top'):
with pm.autoLayout():
pm.button()
pm.button()
with pm.frameLayout(label='フレーム2', labelAlign='center'):
with pm.autoLayout():
pm.button()
pm.button()
- gridLayout
import pymel.core as pm
with pm.window():
with pm.gridLayout() as gr:
gr.setNumberOfColumns(3)
gr.setCellWidth(80)
gr.setCellHeight(30)
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
- menuBarLayout
import pymel.core as pm
with pm.window():
with pm.autoLayout():
with pm.menuBarLayout():
pm.menu(label='File')
pm.menuItem(label='New')
pm.menuItem(label='Open')
pm.menuItem(label='Close')
pm.menu(label='Help', helpMenu=True)
pm.menuItem(label='About...')
pm.button()
pm.button()
- paneLayout
import pymel.core as pm
with pm.window():
with pm.paneLayout(configuration='quad'):
pm.button()
with pm.autoLayout():
pm.button()
pm.button()
with pm.horizontalLayout():
pm.button()
pm.button()
pm.text(label='paneLayout')
- rowColumnLayout
import pymel.core as pm
with pm.window():
with pm.rowColumnLayout(numberOfRows=3, rowHeight=((1, 30), (2, 50))):
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
pm.button()
- rowLayout
import pymel.core as pm
with pm.window():
with pm.rowLayout(numberOfColumns=3, columnWidth3=(80, 85, 80)):
pm.button()
pm.button()
pm.button()
- scrollLayout
import pymel.core as pm
with pm.window():
with pm.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16):
with pm.autoLayout():
for i in range(10):
pm.text(label='ラベル ' + str(i));
- shelfLayout
import pymel.core as pm
with pm.window():
with pm.shelfLayout():
pm.iconTextButton(style='iconOnly' ,image1='sphere.xpm')
pm.iconTextButton(style='iconOnly' ,image1='cone.xpm')
pm.iconTextButton(style='iconOnly' ,image1='cube.xpm')
- shelfTabLayout
import pymel.core as pm
with pm.window():
with pm.shelfTabLayout(image='smallTrash.xpm', imageVisible=True):
with pm.shelfLayout('Shelf1'):
with pm.autoLayout():
pm.iconTextButton(style='iconOnly', image1='sphere.xpm')
with pm.shelfLayout('Shelf2'):
with pm.autoLayout():
pm.iconTextButton(style='iconOnly', image1='cone.xpm')
- tabLayout
import pymel.core as pm
with pm.window():
with pm.tabLayout() as tabs:
with pm.autoLayout() as auto1:
pm.button(label='ボタン1')
with pm.autoLayout() as auto2:
pm.button(label='ボタン2')
pm.tabLayout(tabs, edit=True, tabLabel=((auto1, "タブ 1"), (auto2, "タブ 2")))
- colorEditor
色の値を u' 0 0 0 1' という形の文字列で返します。
pm.colorEditor()
- confirmDialog
押されたボタンの値を返すモーダルダイアログ
pm.confirmDialog(message='本当によろしいですか ?', button=('実行', '中止'), defaultButton='実行', cancelButton='キャンセル', dismissString='中止')
- fileDialog2
ファイルを選択するためのダイアログ
選択されたファイル名を返します。
pm.fileDialog2()
- fontDialog
フォントを選択するためのダイアログ
pm.fontDialog()
返り値は ui.FontDialog('Times New Roman|wt:50|sz:28|sl:n|st:100') などの形
- プログレスバー
import pymel.core as pm
def progressBar1():
percent = 0
pm.progressWindow(title='Waiting 10 seconds',
progress=percent,
status='Sleeping: 0%',
isInterruptable=True)
while(True):
if pm.progressWindow(q=True, isCancelled=True):
break
if pm.progressWindow(q=True, progress=True) >= 100:
break
percent += 10
pm.progressWindow(e=True, progress=percent,
status='Doing : ' + str(percent) + '%')
pm.pause(seconds=1)
pm.progressWindow(endProgress=True)
progressBar1()
- レイアウトダイアログ
返り値は"作成"、"適用"、"中止"のいずれか
import pymel.core as pm
def checkboxPrompt():
form = pm.setParent(q=True)
pm.formLayout(form, e=True, width=300)
t = pm.text(l='以下のいずれかのボタンを押してください')
b1 = pm.button(l='Abort', c='pm.layoutDialog(dismiss="作成")')
b2 = pm.button(l='Skip', c='pm.layoutDialog(dismiss="適用")')
b3 = pm.button(l='Continue', c='pm.layoutDialog(dismiss="中止")')
cb1 = pm.checkBox(l='操作を覚えておく')
spacer = 5
top = 5
edge = 5
pm.formLayout(form, edit=True,
attachForm=((t, 'top', top), (t, 'left', edge), (t, 'right', edge),
(b1, 'left', edge), (b3, 'right', edge),
(cb1, 'left', edge), (cb1, 'bottom', spacer)),
attachNone=((t, 'bottom'), (b1, 'bottom'),
(b2, 'bottom'), (b3, 'bottom'), (cb1, 'right')),
attachControl=((b1, 'top', spacer, t), (b2, 'top', spacer, t),
(b3, 'top', spacer, t), (cb1, 'top', spacer, b1)),
attachPosition=((b1, 'right', spacer, 33), (b2, 'left', spacer, 33),
(b2, 'right', spacer, 66), (b3, 'left', spacer, 66)))
pm.layoutDialog(ui=checkboxPrompt)
- プロンプトダイアログ
pm.promptDialog(title='PromptDialog', message='本当によろしいですか ?', button=('実行', '中止'), defaultButton='実行', cancelButton='中止', dismissString='中止')