本文整理汇总了Python中maya.cmds.optionMenuGrp函数的典型用法代码示例。如果您正苦于以下问题:Python optionMenuGrp函数的具体用法?Python optionMenuGrp怎么用?Python optionMenuGrp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionMenuGrp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setTwinMatchAttrsFromUI
def setTwinMatchAttrsFromUI():
'''
UI method for Pose Match setup tools
Setup pose twin attributes from UI
'''
# Get selection
sel = mc.ls(sl=True,type=['transform','joint'])
if not sel: return
# Window
win = 'matchRulesUI'
if not mc.window(win,q=True,ex=True): raise UserInputError('Pose Match UI does not exist!!')
# Pivot
pivotObj = str(mc.textFieldButtonGrp('matchRulesPivotTFB',q=True,text=True))
# Axis
axis = str(mc.optionMenuGrp('matchRulesAxisOMG',q=True,v=True)).lower()
# Mode
mode = mc.optionMenuGrp('matchRulesModeOMG',q=True,sl=True) - 1
# Search/Replace
search = str(mc.textFieldGrp('matchRulesSearchTFG',q=True,text=True))
replace = str(mc.textFieldGrp('matchRulesReplaceTFG',q=True,text=True))
# Set match rules attributes
glTools.common.match.Match().setTwinMatchAttrs(sel,pivotObj,axis,mode,search,replace)
示例2: doOptions
def doOptions(input_referenceObject, input_rotateOrder, input_axis, input_referenceAxis, input_normalizeAxes):
"""This is the function called when the apply or create button is clicked"""
try:
# validate selection
utils.dg.validateSelection(type='transform', exact=1)
# validate reference object
referenceObject = cmds.textFieldGrp(input_referenceObject, q=True, tx=True)
if len(referenceObject) > 0: utils.dg.verifyNode(referenceObject)
# call the command
if len(referenceObject) > 0:
cmds.am_exposeTransform(
ref=referenceObject,
ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)],
a=cmds.floatFieldGrp(input_axis, q=True, v=True),
ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True),
na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
else:
cmds.am_exposeTransform(
ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)],
a=cmds.floatFieldGrp(input_axis, q=True, v=True),
ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True),
na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
except: raise
示例3: gui
def gui() :
import maya.cmds as m
if m.window("peelMocap", ex=True) : m.deleteUI("peelMocap")
win = m.window("peelMocap", width=400, height=400)
form = m.formLayout()
c1 = m.columnLayout()
m.optionMenuGrp("peelMocapMarkerset", l="Markerset:")
m.menuItem("motive")
m.menuItem("mocapclub")
m.textFieldButtonGrp("peelMocapMarkerPrefix", l="Marker Prefix:", bl="Verify", bc=gui_verify)
m.textFieldGrp("peelMocapMarkerStatus", en=False, l="" )
m.textScrollList("peelMocapTSL")
m.button(l="Select Markers", c=gui_select)
m.button(l="Draw Lines", c=gui_drawLines)
m.button(l="Test Solver", c=gui_createSolverTest)
m.button(l="Create Solver", c=gui_createSolver)
m.setParent(form)
c2 = m.columnLayout()
m.optionMenuGrp("peelMocapBoneset", l="Boneset:")
m.menuItem("fbx")
m.textFieldButtonGrp("peelMocapBonePrefix", l="Bone Prefix:", bl="Verify", bc=gui_verifyBones)
m.textFieldGrp("peelMocapBoneStatus", en=False, l="" )
m.formLayout(form, e=True, attachForm=[ ( c1, "top", 1 ) , ( c1, "left", 1) , (c1, "bottom", 1),
( c2, "top", 1 ) , ( c2, "right", 1) , (c2, "bottom", 1) ],
attachControl= [ (c1, "right", 1, c2 ) ])
m.showWindow(win)
示例4: __init__
def __init__(self) :
#check to see if the window exists:
if cmds.window("Box2DTool", exists = True):
cmds.deleteUI("Box2DTool")
#create the window:
window = cmds.window("Box2DTool", title = 'Box2D Tool', sizeable = False)
#create the main layout:
cmds.columnLayout(columnWidth = 300, adjustableColumn = False, columnAttach = ('both', 10))
#make dockable:
allowedAreas = ['right', 'left']
cmds.dockControl( 'Box2D Tool', area='left', content=window, allowedArea=allowedAreas )
self.dim=cmds.floatFieldGrp('dim', numberOfFields=2, label='Dimension', extraLabel='pixel', value1=5, value2=1 )
self.dim=cmds.floatFieldGrp('friction', numberOfFields=1, label='Friction', value1=0.2 )
self.dim=cmds.floatFieldGrp('restitution', numberOfFields=1, label='restitution', value1=0.0 )
self.dim=cmds.floatFieldGrp('density', numberOfFields=1, label='density', value1=0.0 )
cmds.separator()
self.dim=cmds.floatFieldGrp('rotation', numberOfFields=1, label='rotation', value1=0.0 )
cmds.separator()
cmds.optionMenuGrp( "bodyType",l='Body Type' )
cmds.menuItem(label='b2_staticBody');
cmds.menuItem(label='b2_kinematicBody');
cmds.menuItem(label='b2_dynamicBody');
cmds.button(label = "PlaceBlock", w = 100, h = 25, c = self.placeBlock)
cmds.separator()
cmds.button( label='Export', command=self.export )
示例5: pupMaya2mental
def pupMaya2mental(mentalVersion):
destPath = os.getenv('DEST_PATH_WIN')
rootPath, shadersPath = {
3.8:('c:/Program Files/Autodesk/mrstand3.8.1-adsk2011/bin', destPath + '/mental3.8.1'),
3.11:('c:/Program Files/Autodesk/mrstand3.11.1-adsk2014/bin', destPath + '/mental3.11.1')
}[mentalVersion]
os.putenv('RAY_COMMAND', '"' + rootPath + '/ray.exe"')
os.putenv('MR_VERSION', str( mentalVersion ) )
miModulesPaths, binModulesPaths = modulesPath.getMiBinString()
#os.putenv('MI_RAY_INCPATH', shadersPath + '/mi;' + miModulesPaths)
#os.putenv('MI_LIBRARY_PATH', shadersPath + '/bin;' + binModulesPaths)
#os.putenv('MI_ROOT', rootPath)
mel.eval('pup_maya_2_mental(3);')
mc.checkBoxGrp('pup_m2mrOverrideEnv', e=True, v1=1)
mc.textFieldGrp('pup_m2mrMiRoot', e=True, tx= rootPath )
mc.textFieldGrp('pup_m2mrMiInclude', e=True, tx= shadersPath + '/mi;' + miModulesPaths )
mc.textFieldGrp('pup_m2mrMiLib', e=True, tx= shadersPath + '/bin;' + binModulesPaths )
mc.textFieldGrp('pup_m2mrMiDir', e=True, tx= "C:/Temp/" )
mc.optionMenuGrp('pup_m2mrVerboseM', e=True, sl=5)
#mc.textFieldGrp('pup_m2mrCommandLine', e=True, tx= '-finalgather_passes 0 -memory 1000000' )
mc.textFieldGrp('pup_m2mrCommandLine', e=True, tx= '-memory 1000000' )
mc.checkBoxGrp('pup_m2mrUniqueMI', e=True, v1=1)
mc.optionMenuGrp('pup_m2mrPriority', e=True, sl=3)
示例6: setOptionMenuList
def setOptionMenuList(OMG,itemList,add=False):
'''
Set the list of items for the specified optionMenuGrp control
@param OMG: OptionMenuGrp to set the item list for
@type OMG: str
@param itemList: List of items to add to optionMenuGrp
@type itemList: list
@param add: Add to existing menu items
@type add: bool
'''
# Check optionMenuGrp
if not mc.optionMenuGrp(OMG,q=True,ex=True):
raise UIError('OptionMenu "'+OMG+'" does not exist!')
# Get existing items
exItemList = mc.optionMenuGrp(OMG,q=True,ill=True)
# Add items
for item in itemList:
mc.setParent(OMG)
mc.menuItem(l=item)
# Remove previous items
if exItemList:
for item in exItemList:
mc.deleteUI(item)
示例7: attachToMeshFromUI
def attachToMeshFromUI(close=False):
'''
Execute attachToMesh() from UI
'''
# Window
window = 'attachToMeshUI'
if not mc.window(window,q=True,ex=1): raise UIError('SnapToSurface UI does not exist!!')
# Get UI data
mesh = mc.textFieldGrp('attachToMeshTFB',q=True,text=True)
# Check surface
if not glTools.utils.mesh.isMesh(mesh):
raise Exception('Object "'+surface+'" is not a valid nurbs surface!!')
# Transform
obj = mc.textFieldGrp('attachToMeshTransformTFB',q=True,text=True)
# Prefix
pre = mc.textFieldGrp('attachToMeshPrefixTFG',q=True,text=True)
# Orient
orient = mc.checkBoxGrp('attachToMeshOrientCBG',q=True,v1=True)
# Orient Options
normAx = str.lower(str(mc.optionMenuGrp('attachToMeshNormOMG',q=True,v=True)))
tanAx = str.lower(str(mc.optionMenuGrp('attachToMeshTanOMG',q=True,v=True)))
# Execute command
glTools.utils.attach.attachToMesh(mesh=mesh,transform=obj,useClosestPoint=True,orient=orient,normAxis=normAx,tangentAxis=tanAx,prefix=pre)
# Cleanup
if close: mc.deleteUI(window)
示例8: stretchyIkSplineFromUI
def stretchyIkSplineFromUI(close=False):
'''
'''
# Window
window = 'stretchyIkSplineUI'
if not mc.window(window,q=True,ex=1): raise UIError('StretchyIkSpline UI does not exist!!')
# Get UI data
ik = mc.textFieldButtonGrp('stretchyIkSplineTFB',q=True,text=True)
pre = mc.textFieldGrp('stretchyIkSplinePrefixTFG',q=True,text=True)
scaleAxis = str.lower(str(mc.optionMenuGrp('stretchyIkSplineAxisOMG',q=True,v=True)))
scaleAttr = mc.textFieldButtonGrp('stretchyIkSplineScaleAttrTFB',q=True,text=True)
blendCtrl = mc.textFieldButtonGrp('stretchyIkSplineBlendCtrlTFB',q=True,text=True)
blendAttr = mc.textFieldGrp('stretchyIkSplineBlendAttrTFG',q=True,text=True)
method = mc.optionMenuGrp('stretchyIkSplineMethodOMG',q=True,sl=True)-1
minPercent = mc.floatSliderGrp('stretchyIkSplineMinPFSG',q=True,v=True)
maxPercent = mc.floatSliderGrp('stretchyIkSplineMaxPFSG',q=True,v=True)
# Execute command
if method: # Parametric
glTools.builder.stretchyIkSpline_parametric.StretchyIkSpline_parametric().build(ikHandle=ik,scaleAttr=scaleAttr,blendControl=blendCtrl,blendAttr=blendAttr,scaleAxis=scaleAxis,minPercent=minPercent,maxPercent=maxPercent,prefix=pre)
else: # Arc Length
glTools.builder.stretchyIkSpline_arcLength.StretchyIkSpline_arcLength().build(ikHandle=ik,scaleAttr=scaleAttr,blendControl=blendCtrl,blendAttr=blendAttr,scaleAxis=scaleAxis,prefix=pre)
# Cleanup
if close: mc.deleteUI(window)
示例9: snapToSurfaceFromUI
def snapToSurfaceFromUI(close=False):
'''
Execute snapToSurface() from UI
'''
# Window
window = 'snapToSurfaceUI'
if not mc.window(window,q=True,ex=1): raise UIError('SnapToSurface UI does not exist!!')
# Get UI data
surface = mc.textFieldGrp('snapToSurfaceTFB',q=True,text=True)
# Check surface
if not glTools.utils.surface.isSurface(surface):
raise UserInputError('Object "'+surface+'" is not a valid nurbs surface!!')
# Orient
orient = mc.checkBoxGrp('snapToSurfaceOrientCBG',q=True,v1=True)
# Orient Options
tanU = str.lower(str(mc.optionMenuGrp('snapToSurfaceUAxisOMG',q=True,v=True)))
tanV = str.lower(str(mc.optionMenuGrp('snapToSurfaceVAxisOMG',q=True,v=True)))
align = str.lower(str(mc.optionMenuGrp('snapToSurfaceAlignToOMG',q=True,v=True)))
# Get User Selection
sel = mc.ls(sl=True,fl=True)
# Execute Command
glTools.utils.surface.snapPtsToSurface(surface,sel)
# Orient
if orient:
for obj in sel:
try:
glTools.utils.surface.orientToSurface(surface=surface,obj=obj,useClosestPoint=True,tangentUAxis=tanU,tangentVAxis=tanV,alignTo=align)
except:
print('Object "'+obj+'" is not a valid transform!! Unable to orient!')
# Cleanup
if close: mc.deleteUI(window)
示例10: createCNCWindow
def createCNCWindow(preFileDir):
"""该函数实现创建布料窗体的创建
Description:
无
Arguments:
presetName:某个正确的布料预设路径
Returns:
无
"""
createNClothWin = cmds.window(title = "Create NCloth", iconName = "CN", widthHeight = (420, 80))
cNFormLayout = cmds.formLayout()
nucleusButton = mel.eval('nucleusSolverButton("")')
cmds.optionMenuGrp(nucleusButton, edit = True, cw = [1,50])
cButtonRowLayout = cmds.rowLayout(numberOfColumns = 2, columnAttach = [(1, "right", 0),(2, "right", 0)], columnWidth=[(1, 280), (2, 80)])
createNButton = cmds.button(label = "Create", width = 75, command = (lambda x:createNClothP(preFileDir, createNClothWin)))
closeNButton = cmds.button(label = "Close", width = 75, command = ('cmds.deleteUI(\"' + createNClothWin + '\", window=True)'))
cmds.setParent("..")
cmds.formLayout(cNFormLayout, edit=True,
attachForm=[(nucleusButton, "top", 12), (nucleusButton, "left", 8), (nucleusButton, "right", 8),
(cButtonRowLayout, "bottom", 12),(cButtonRowLayout, "left", 24), (cButtonRowLayout, "right", 24)],
attachControl=[(cButtonRowLayout, "top", 12, nucleusButton)])
cmds.setParent("..")
cmds.showWindow(createNClothWin)
示例11: cmdCreateRivet
def cmdCreateRivet(self, *args ):
meshName = cmds.textFieldGrp( self.tf_meshName, q=1, tx=1 )
centerIndicesStr = cmds.textFieldGrp( self.tf_centerIndices, q=1, tx=1 )
aimIndicesStr = cmds.textFieldGrp( self.tf_aimIndices, q=1, tx=1 )
upIndicesStr = cmds.textFieldGrp( self.tf_upIndices, q=1, tx=1 )
aimPivIndicesStr = cmds.textFieldGrp( self.tf_aimPivIndices, q=1, tx=1 )
upPivIndicesStr = cmds.textFieldGrp( self.tf_upPivIndices, q=1, tx=1 )
centerIndices = []
aimPivIndices = []
aimIndices = []
upPivIndices = []
upIndices = []
for indexStr in centerIndicesStr.split( ',' ):
centerIndices.append( int( indexStr ) )
for indexStr in aimIndicesStr.split( ',' ):
aimIndices.append( int( indexStr ) )
for indexStr in upIndicesStr.split( ',' ):
upIndices.append( int( indexStr ) )
if aimPivIndicesStr:
for indexStr in aimPivIndicesStr.split( ',' ):
aimPivIndices.append( int( indexStr ) )
if upPivIndicesStr:
for indexStr in upPivIndicesStr.split( ',' ):
upPivIndices.append( int( indexStr ) )
aimIndex = cmds.optionMenuGrp( self.op_aimAxis, q=1, select=1 )-1
upIndex = cmds.optionMenuGrp( self.op_upAxis, q=1, select=1 )-1
print aimIndex, upIndex
cmdModel.createRivet( meshName, centerIndices, aimPivIndices, aimIndices, upPivIndices, upIndices, aimIndex, upIndex )
示例12: makeDropDown
def makeDropDown( scrollListName ):
"""Creates file type selector"""
cmds.optionMenuGrp(scrollListName+'TypeSelect', label='File Type ' )#, changeCommand= lambda *args:changeFileType(), bgc=[1.0,1.0,0.0]
cmds.menuItem(label='FBX')
cmds.menuItem(label='OBJexport')
cmds.menuItem(label='mayaAscii')
cmds.menuItem(label='mayaBinary')
示例13: cmdCreate
def cmdCreate(self, *args ):
newSystemType = cmds.rowColumnLayout( self.columnNewSystem, q=1, vis=1 )
assignSystemType = cmds.rowColumnLayout( self.columnAssignSystem, q=1, vis=1 )
newCurve = cmds.checkBox( self.check, q=1, v=1 )
sels = self.popupCurves.getFieldTexts()
if newSystemType:
ctlName = self.popupController.getFieldText()
addName = cmds.textFieldGrp( self.addName, q=1, tx=1 )
if not newCurve:
hairSystem = sgRigCurve.makeDynamicCurveKeepSrc( sels, addName )
else:
hairSystem = sgRigCurve.makeDynamicCurve( sels, addName )
sgRigAttribute.connectHairAttribute( ctlName, hairSystem )
elif assignSystemType:
addName = cmds.textFieldGrp( self.addName, q=1, tx=1 )
menuItems = cmds.optionMenuGrp( self.option, q=1, itemListLong=1 )
selectIndex = cmds.optionMenuGrp( self.option, q=1, sl=1 )-1
menuItemLabel = cmds.menuItem( menuItems[selectIndex], q=1, label=1 )
if not newCurve:
hairSystem = sgRigCurve.makeDynamicCurveKeepSrc( sels, addName )
else:
hairSystem = sgRigCurve.makeDynamicCurve( sels, addName )
示例14: attachToSurfaceFromUI
def attachToSurfaceFromUI(close=True):
"""
Execute attachToSurface() from UI
@param close:
"""
# Window
window = 'attachToSurfaceUI'
if not cmds.window(window, q=True, ex=1): raise UIError('AttachToSurface UI does not exist!!')
# Get UI data
surf = cmds.textFieldGrp('attachToSurfaceTFB', q=True, text=True)
# Check surface
if not glTools.utils.surface.isSurface(surf):
raise UserInputError('Object "' + surf + '" is not a valid nurbs surface!!')
trans = cmds.textFieldGrp('attachToSurfaceTransformTFB', q=True, text=True)
pre = cmds.textFieldGrp('attachToSurfacePrefixTFG', q=True, text=True)
uParam = cmds.floatFieldGrp('attachToSurfaceParamTFB', q=True, v1=True)
vParam = cmds.floatFieldGrp('attachToSurfaceParamTFB', q=True, v2=True)
closePnt = cmds.checkBoxGrp('attachToSurfaceClosePntCBG', q=True, v1=True)
uAttr = cmds.textFieldGrp('attachToSurfaceUAttrTFG', q=True, text=True)
vAttr = cmds.textFieldGrp('attachToSurfaceVAttrTFG', q=True, text=True)
# Orient
orient = cmds.checkBoxGrp('attachToSurfaceOrientCBG', q=True, v1=True)
# Orient Options
tanU = str.lower(str(cmds.optionMenuGrp('attachToSurfaceUAxisOMG', q=True, v=True)))
tanV = str.lower(str(cmds.optionMenuGrp('attachToSurfaceVAxisOMG', q=True, v=True)))
align = str.lower(str(cmds.optionMenuGrp('attachToSurfaceAlignToOMG', q=True, v=True)))
# Execute command
result = glTools.utils.attach.attachToSurface(surface=surf, transform=trans, uValue=uParam, vValue=vParam,
useClosestPoint=closePnt, orient=orient, uAxis=tanU, vAxis=tanV,
uAttr=uAttr, vAttr=vAttr, alignTo=align, prefix=pre)
# Cleanup
if close: cmds.deleteUI(window)
示例15: stretchyIkLimbUI
def stretchyIkLimbUI():
'''
UI for stretchyIkLimb()
'''
# Window
window = 'stretchyIkLimbUI'
if mc.window(window,q=True,ex=1): mc.deleteUI(window)
window = mc.window(window,t='Stretchy IK Limb')
# Layout
FL = mc.formLayout()
# UI Elements
#---
# IK Handle
handleTFB = mc.textFieldButtonGrp('stretchyIkLimbTFB',label='IK Handle',text='',buttonLabel='Load Selected')
# Prefix
prefixTFG = mc.textFieldGrp('stretchyIkLimbPrefixTFG',label='Prefix', text='')
# Control
controlTFB = mc.textFieldButtonGrp('stretchyIkLimbControlTFB',label='Control Object',text='',buttonLabel='Load Selected')
# Scale Axis
axisList = ['X','Y','Z']
scaleAxisOMG = mc.optionMenuGrp('stretchyIkLimbAxisOMG',label='Joint Scale Axis')
for axis in axisList: mc.menuItem(label=axis)
mc.optionMenuGrp(scaleAxisOMG,e=True,sl=1)
# Scale Attr
scaleAttrTFB = mc.textFieldButtonGrp('stretchyIkLimbScaleAttrTFB',label='Scale Attribute',text='',buttonLabel='Load Selected')
# Separator
SEP = mc.separator(height=10,style='single')
# Buttons
createB = mc.button('stretchyIkLimbCreateB',l='Create',c='glTools.ui.ik.stretchyIkLimbFromUI(False)')
cancelB = mc.button('stretchyIkLimbCancelB',l='Cancel',c='mc.deleteUI("'+window+'")')
# UI callback commands
mc.textFieldButtonGrp(handleTFB,e=True,bc='glTools.ui.utils.loadTypeSel("'+handleTFB+'","'+prefixTFG+'",selType="ikHandle")')
mc.textFieldButtonGrp(controlTFB,e=True,bc='glTools.ui.utils.loadObjectSel("'+controlTFB+'")')
mc.textFieldButtonGrp(scaleAttrTFB,e=True,bc='glTools.ui.utils.loadChannelBoxSel("'+scaleAttrTFB+'")')
# Form Layout - MAIN
mc.formLayout(FL,e=True,af=[(handleTFB,'top',5),(handleTFB,'left',5),(handleTFB,'right',5)])
mc.formLayout(FL,e=True,ac=[(prefixTFG,'top',5,handleTFB)])
mc.formLayout(FL,e=True,af=[(prefixTFG,'left',5),(prefixTFG,'right',5)])
mc.formLayout(FL,e=True,ac=[(controlTFB,'top',5,prefixTFG)])
mc.formLayout(FL,e=True,af=[(controlTFB,'left',5),(controlTFB,'right',5)])
mc.formLayout(FL,e=True,ac=[(scaleAxisOMG,'top',5,controlTFB)])
mc.formLayout(FL,e=True,af=[(scaleAxisOMG,'left',5),(scaleAxisOMG,'right',5)])
mc.formLayout(FL,e=True,ac=[(scaleAttrTFB,'top',5,scaleAxisOMG)])
mc.formLayout(FL,e=True,af=[(scaleAttrTFB,'left',5),(scaleAttrTFB,'right',5)])
mc.formLayout(FL,e=True,ac=[(SEP,'top',5,scaleAttrTFB)])
mc.formLayout(FL,e=True,af=[(SEP,'left',5),(SEP,'right',5)])
mc.formLayout(FL,e=True,ac=[(createB,'top',5,SEP)])
mc.formLayout(FL,e=True,af=[(createB,'left',5),(createB,'bottom',5)])
mc.formLayout(FL,e=True,ap=[(createB,'right',5,50)])
mc.formLayout(FL,e=True,ac=[(cancelB,'top',5,SEP)])
mc.formLayout(FL,e=True,af=[(cancelB,'right',5),(cancelB,'bottom',5)])
mc.formLayout(FL,e=True,ap=[(cancelB,'left',5,50)])
# Show Window
mc.showWindow(window)