本文整理汇总了Python中maya.cmds.textFieldButtonGrp函数的典型用法代码示例。如果您正苦于以下问题:Python textFieldButtonGrp函数的具体用法?Python textFieldButtonGrp怎么用?Python textFieldButtonGrp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了textFieldButtonGrp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jointPerVertexUI
def jointPerVertexUI():
"""
UI for jointPerVertex()
"""
# Window
win = "jntPerVtxUI"
if cmds.window(win, q=True, ex=1):
cmds.deleteUI(win)
win = cmds.window(win, t="Create Joint Per Vertex")
# Layout
cl = cmds.columnLayout()
# UI Elements
prefixTFG = cmds.textFieldGrp("jntPerVtx_prefixTFG", label="Prefix", text="")
suffixTFG = cmds.textFieldGrp("jntPerVtx_suffixTFG", label="Suffix", text="jnt")
oriSurfaceTFB = cmds.textFieldButtonGrp(
"jntPerVtx_oriSurfaceTFB", label="Orient Surface", text="", buttonLabel="Load Selected"
)
# Buttons
createB = cmds.button("jntPerVtx_createB", l="Create", c="glTools.tools.jointPerVertex.jointPerVertexFromUI(False)")
cancelB = cmds.button("jntPerVtx_cancelB", l="Cancel", c='cmds.deleteUI("' + win + '")')
# UI callbacks
cmds.textFieldButtonGrp(oriSurfaceTFB, e=True, bc='glTools.ui.utils.loadObjectSel("' + oriSurfaceTFB + '","")')
# Show Window
cmds.showWindow(win)
示例2: loadDirectoryPath
def loadDirectoryPath(textField,caption='Load Directory',startDir=None):
'''
Select a file path to load into a specified textField.
@param textField: TextField UI object to load file path to
@type textField: str
@param caption: File selection UI caption string
@type caption: str
@param startDir: Directory to start browsing from. In None, use the default or last selected directory.
@type startDir: str
'''
# Get File Path
dirPath = mc.fileDialog2( dialogStyle=2,
fileMode=3,
caption=caption,
okCaption='Load',
startingDirectory=startDir )
# Check File Path
if not dirPath:
print('Invalid directory path!')
return
# Load File Path to TextField
if mc.textField(textField,q=True,ex=True):
mc.textField(textField,e=True,text=dirPath[0])
elif mc.textFieldGrp(textField,q=True,ex=True):
mc.textFieldGrp(textField,e=True,text=dirPath[0])
elif mc.textFieldButtonGrp(textField,q=True,ex=True):
mc.textFieldButtonGrp(textField,e=True,text=dirPath[0])
else:
print('UI element "'+textField+'" is of type "'+mc.objectTypeUI(textField)+'"! Expected textField, textFieldGrp or textFieldButtonGrp.')
return
# Return Result
return dirPath[0]
示例3: addMultiAttr
def addMultiAttr():
#Create a variable for the window name
winName = 'blend'
winTitle = 'rh_addMultiAttr'
#Delete the window if it exists
if cmds.window(winName, exists=True):
cmds.deleteUI(winName, window=True)
#Build the main window
cmds.window(winName, title=winTitle, sizeable=True)
cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()')
cmds.columnLayout(adjustableColumn=True)
cmds.textFieldGrp('Attr',l='Attribute:',text='')
cmds.columnLayout(adjustableColumn=True)
cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0)
cmds.columnLayout(adjustableColumn=True)
cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0)
cmds.columnLayout(adjustableColumn=True)
cmds.button(label='Contact', command='Connect()')
cmds.columnLayout(adjustableColumn=True)
#Show the window
cmds.showWindow(winName)
cmds.window(winName, edit=True, width=300, height=120)
示例4: get_ui_values
def get_ui_values():
global engine_path, folder, file_name, export_batch, resolution_x, resolution_y, exposure, gamma, \
ray_number, time, seed, export_animation, start_frame, end_frame, export_normals, invert_normals, check_Z, materials
engine_path = cmds.textFieldButtonGrp(engine_field, query=True, text=True)
folder = cmds.textFieldButtonGrp(directory_field, query=True, text=True)
file_name = cmds.textFieldGrp(file_field, query=True, text=True)
export_batch = cmds.checkBoxGrp(batch_field, query=True, value1=True)
resolution_x = cmds.intFieldGrp(resolution_field, query=True, value1=True)
resolution_y = cmds.intFieldGrp(resolution_field, query=True, value2=True)
exposure = cmds.floatSliderGrp(exposure_field, query=True, value=True)
gamma = cmds.floatSliderGrp(gamma_field, query=True, value = True)
ray_number = cmds.intSliderGrp(rays_field, query=True, value=True)
seed = cmds.intSliderGrp(seed_field, query=True, value=True)
time = cmds.intSliderGrp(time_field, query=True, value=True)
export_animation = cmds.checkBoxGrp(animation_field, query=True, value1=True)
start_frame = cmds.intFieldGrp(frame_range_field, query=True, value1=True)
end_frame = cmds.intFieldGrp(frame_range_field, query=True, value2=True)
export_normals = cmds.checkBoxGrp(normals_export_field, query=True, value1=True)
invert_normals = cmds.checkBoxGrp(normals_invert_field, query=True, value1=True)
check_Z = cmds.checkBoxGrp(check_Z_field, query = True, value1=True)
materials = []
for mat in range(5):
materials.append(cmds.floatFieldGrp(eval('material_%i_field' % (mat)), query=True, value=True))
示例5: cacheFilePath
def cacheFilePath(self, *args):
filename = mc.file(q=1, sn=1)
scenename = filename.rsplit('_', 4)[1]
shotname = filename.rsplit('_', 3)[1]
cachePath = self.basePath + '/' + scenename + '/' + shotname
mc.textFieldButtonGrp(self.txtProp, e = True, text = cachePath)
return cachePath
示例6: linkShaders
def linkShaders(self, *args):
links = self.getLinksFromDB()
if links == None:
return
selection = cmds.ls(sl=True)
if len(selection) > 0:
selection = cmds.listRelatives(selection, allDescendents=True, noIntermediate=True)
# If shader file is available import it
shaderPath = cmds.textFieldButtonGrp("tfbShaderPath", q=True, tx=True)
if len(shaderPath) > 0:
cmds.file(shaderPath, i=True)
cmds.textFieldButtonGrp("tfbShaderPath", e=True, tx="")
# Link shaders
for link in links:
mesh = link[0]
shader = link[1]
if cmds.checkBox("cbSubstring", q=True, value=True):
substring = cmds.textField("tfSubstring", q=True, text=True)
mesh = substring + mesh
if cmds.objExists(mesh):
cmds.select(mesh)
cmds.hyperShade(assign=shader)
print "'" + mesh + "' linked"
print "Finished linking."
示例7: locatorCurveUI
def locatorCurveUI():
'''
UI for locatorCurve()
'''
# Window
window = 'locatorCurveUI'
if mc.window(window,q=True,ex=1): mc.deleteUI(window)
window = mc.window(window,t='Locator Curve')
# Layout
cl = mc.columnLayout()
# UI Elements
#---
# Curve
curveTFB = mc.textFieldButtonGrp('locatorCurveTFB',label='Source Curve',text='',buttonLabel='Load Selected')
# Prefix
prefixTFG = mc.textFieldGrp('locatorCurvePrefixTFG',label='Prefix', text='')
# Scale
scaleFSG = mc.floatSliderGrp('locatorCurveScaleFSG',label='Locator Scale',field=True,minValue=0.0,maxValue=1.0,fieldMinValue=0.0,fieldMaxValue=10.0,value=0.05,pre=3)
# Edit Points
editPointCBG = mc.checkBoxGrp('locatorCurveEditPointCBG',numberOfCheckBoxes=1,label='Use Edit Points',v1=False)
# Buttons
createB = mc.button('locatorCurveCreateB',l='Create',c='glTools.ui.curve.locatorCurveFromUI(False)')
cancelB = mc.button('locatorCurveCancelB',l='Cancel',c='mc.deleteUI("'+window+'")')
# TFB commands
mc.textFieldButtonGrp(curveTFB,e=True,bc='glTools.ui.utils.loadCurveSel("'+curveTFB+'","'+prefixTFG+'")')
# Show Window
mc.showWindow(window)
示例8: import2dTrackUI
def import2dTrackUI():
"""
"""
# Build UI Window
window = 'import2dTrackUI'
if cmds.window(window, q=True, ex=True): cmds.deleteUI(window)
window = cmds.window(window, title='Import 2D Track', wh=[500, 350])
# Build UI Elements
cmds.columnLayout(adjustableColumn=True)
perspCamListTSL = cmds.textScrollList('importTrack_camListTSL', numberOfRows=8, ams=False)
fileTFB = cmds.textFieldButtonGrp('importTrack_fileTFB', label='2D Track File', buttonLabel='Browse')
cmds.textFieldButtonGrp(fileTFB, e=True, bc='glTools.ui.utils.loadFilePath("' + fileTFB + '",fileFilter="*.*")')
cmds.textFieldGrp('importTrack_nameTFG', label="Point Name", text='trackPoint1')
cmds.floatFieldGrp('importTrack_widthFFG', numberOfFields=1, label='Source Pixel Width', value1=2348)
cmds.floatFieldGrp('importTrack_heightFFG', numberOfFields=1, label='Source Pixel Height', value1=1566)
cmds.button(label='Import Track',
c='import glTools.tools.import2dTrack;reload(glTools.tools.import2dTrack);glTools.tools.import2dTrack.import2dTrack()')
cmds.button(label='Close', c='cmds.deleteUI("' + window + '")')
# Build Camera List
camList = cmds.listCameras(p=True)
for cam in camList: cmds.textScrollList(perspCamListTSL, e=True, a=cam)
# Show Window
cmds.showWindow(window)
示例9: snapToClosestVertexUI
def snapToClosestVertexUI():
'''
UI for snapToClosestVertex()
'''
# Window
window = 'snapToClosestVtxUI'
if mc.window(window,q=True,ex=1): mc.deleteUI(window)
window = mc.window(window,t='Snap To Closest Vertex')
# Layout
FL = mc.formLayout(numberOfDivisions=100)
# ===============
# - UI Elements -
# ===============
# Mesh
meshTFB = mc.textFieldButtonGrp('snapToMeshVtxTFB',label='Target Mesh',text='',buttonLabel='Load Selected')
# UI callback commands
mc.textFieldButtonGrp(meshTFB,e=True,bc='glTools.ui.utils.loadMeshSel("'+meshTFB+'")')
# Buttons
snapB = mc.button('snapToMeshSnapB',l='Snap To Vertex',c='glTools.ui.mesh.snapToClosestVertexFromUI(False)')
cancelB = mc.button('snapToMeshCancelB',l='Cancel',c='mc.deleteUI("'+window+'")')
# Form Layout - MAIN
mc.formLayout(FL,e=True,af=[(meshTFB,'top',5),(meshTFB,'left',5),(meshTFB,'right',5)])
mc.formLayout(FL,e=True,ac=[(snapB,'bottom',5,cancelB)],af=[(snapB,'left',5),(snapB,'right',5)])
mc.formLayout(FL,e=True,af=[(cancelB,'left',5),(cancelB,'right',5),(cancelB,'bottom',5)])
# Show Window
mc.showWindow(window)
示例10: multObjExport
def multObjExport():
uiWindow_objLoopExport = cmds.window('uiWindow_objLoopExport', title="Mass OBJ exporter", iconName='uiWindow_objLoopExport', widthHeight=(330, 160) )
cmds.columnLayout('uiColWrapper', w = 375, adjustableColumn=False, parent = 'uiWindow_objLoopExport' )
cmds.text( label='Settings', align='left', parent = 'uiColWrapper')
cmds.textFieldButtonGrp('Dir', label='Directory Path', cw3 = [80,190,50], text='(browse for directory)', buttonLabel='browse', buttonCommand=browseIt, parent = 'uiColWrapper')
cmds.button('startExport', label = "Export Selected", parent = 'uiColWrapper', width = 322, command = startExport)
cmds.showWindow( uiWindow_objLoopExport )
示例11: 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)
示例12: __init__
def __init__(self): #(Initialization)
### Initialize, definitions
if(mc.window("ms_orientObject",exists=True)):
mc.deleteUI("ms_orientObject",window=True)
mc.window("ms_orientObject",title="Orient Object v1.0",rtf=True)
mc.columnLayout()
mc.text(" ")
mc.rowLayout(nc=4,cw4=(25,130,150,200) )
mc.text(" ")
mc.text("Orient object A to object B.")
mc.text("Unparents during operation, so ")
mc.text("constraints should not be applied yet.")
mc.setParent("..")
mc.text(" ")
mc.separator(w=500)
self.aObjFld = mc.textFieldButtonGrp( label='Object A:',bl='Load',bc=self.loadAObj,text='pCube1')
self.bObjFld = mc.textFieldButtonGrp( label='Object B:',bl='Load',bc=self.loadBObj,text='inside_cube_small')
mc.separator(w=500)
mc.rowLayout(nc=2,cw2=(200,300))
mc.text(" ")
mc.button(label="-=Match Orientation=-",c=self.orient)
mc.setParent("..")
mc.showWindow("ms_orientObject")
示例13: getChannel
def getChannel(tfbg, *args):
"""gets the selected channel of the selected objects"""
obj = ""
channel = ""
cBox = mel.eval('$temp=$gChannelBoxName')
sel = cmds.ls(sl=True, l=True)
if sel:
if not len(sel)==1:
cmds.warning("You have to select ONE node!")
else:
obj = sel[0]
else:
cmds.warning("You have to select ONE node!")
if sel:
channels = cmds.channelBox(cBox, q=True, sma=True, ssa=True, sha=True, soa=True)
if channels:
if not len(channels) == 1:
cmds.warning("You have to select ONE channel!")
else:
channel = channels[0]
else:
cmds.warning("You have to select ONE channel!")
if obj and channel:
full = "%s.%s"%(obj, channel)
cmds.textFieldButtonGrp(widgets[tfbg], e=True, tx=full)
示例14: jointPerVertexUI
def jointPerVertexUI():
'''
UI for jointPerVertex()
'''
# Window
win = 'jntPerVtxUI'
if mc.window(win,q=True,ex=1): mc.deleteUI(win)
win = mc.window(win,t='Create Joint Per Vertex')
# Layout
cl = mc.columnLayout()
# UI Elements
prefixTFG = mc.textFieldGrp('jntPerVtx_prefixTFG',label='Prefix', text='')
suffixTFG = mc.textFieldGrp('jntPerVtx_suffixTFG',label='Suffix', text='jnt')
oriSurfaceTFB = mc.textFieldButtonGrp('jntPerVtx_oriSurfaceTFB',label='Orient Surface',text='',buttonLabel='Load Selected')
# Buttons
createB = mc.button('jntPerVtx_createB',l='Create',c='glTools.tools.jointPerVertex.jointPerVertexFromUI(False)')
cancelB = mc.button('jntPerVtx_cancelB',l='Cancel',c='mc.deleteUI("'+win+'")')
# UI callbacks
mc.textFieldButtonGrp(oriSurfaceTFB,e=True,bc='glTools.ui.utils.loadObjectSel("'+oriSurfaceTFB+'","")')
# Show Window
mc.showWindow(win)
示例15: setShaderPath
def setShaderPath(self, *args):
fileFilters = "Maya File(*.mb *.ma)"
path = cmds.fileDialog2(fileMode=1, caption="Set Shader Path", dialogStyle=2, okCaption="Save", startingDirectory=self.basedir, fileFilter=fileFilters)
if path == None:
return
cmds.textFieldButtonGrp("tfbShaderPath", e=True, tx=path[0])