本文整理汇总了Python中maya.cmds.text函数的典型用法代码示例。如果您正苦于以下问题:Python text函数的具体用法?Python text怎么用?Python text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: selectedFilesFromFolder
def selectedFilesFromFolder(self, *args):
ctrlPath = '|'.join([self.window, 'groupBox_4', 'lineEdit_2']);
folder = cmds.textField(ctrlPath, query=True, text=True);
self.selectedFiles = []
self.filesToCreate = 0
self.filesCreated = 0
self.createdErrors = 0
ctrlPath = '|'.join([self.window, 'groupBox_4', 'checkBox']);
recursive = cmds.checkBox(ctrlPath, query=True, value=True);
if os.path.isdir(folder):
if recursive:
for root, dirs, files in os.walk(folder):
for texture in files:
if (isImage(texture)):
self.selectedFiles.append(os.path.join(root, texture))
self.filesToCreate += 1
else:
files = os.listdir(folder)
for texture in files:
if (isImage(texture)):
self.selectedFiles.append(os.path.join(folder, texture))
self.filesToCreate += 1
updateProgressMessage(self.window, self.filesCreated, self.filesToCreate, 0)
ctrlPath = '|'.join([self.window, 'groupBox_3', 'label_10']);
cmds.text(ctrlPath, edit=True, label="");
示例2: __enter__
def __enter__(self):
'''
Initialize the UI
'''
if mc.window(self.name, exists=True):
mc.deleteUI(self.name)
mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
if self.menu:
self.createMenu()
self.form = mc.formLayout()
self.column = mc.columnLayout(adj=True)
mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2,
columnAlign2=('right','left'),
columnAttach=[(1, 'both', 0), (2, 'both', 8)] )
#if we can find an icon, use that, otherwise do the text version
if self.icon:
mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
else:
mc.text(label=' _ _ |\n| | | |')
if not self.menu:
mc.popupMenu(button=1)
mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
mc.text(label=self.info)
mc.setParent('..')
mc.separator(height=8, style='single')
return self
示例3: build
def build(self):
if mc.window( self.win, ex=1 ): mc.deleteUI( self.win )
if mc.windowPref( self.win, ex=1 ): mc.windowPref( self.win, remove=1 )
mc.window(self.win, title=self.title, wh=(410,378))
mc.columnLayout( 'mainColumn', adj=True )
mc.separator( h=10 )
mc.rowLayout( numberOfColumns=2, columnWidth2=(200, 200), columnAttach=[(1, "both", 5),(2 ,"both", 5)] )
mc.columnLayout( adj=True, columnAlign="center" )
mc.text( l=self.textsk )
self.skcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True )
mc.setParent('..')
mc.columnLayout( adj=True, columnAlign="center" )
mc.text( l=self.textqp )
self.qpcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True )
mc.setParent( '..' )
mc.setParent('..')
mc.separator ( h=10 )
mc.rowLayout( numberOfColumns=4, columnWidth4=(100, 100, 100, 100), columnAttach=[(1, "both", 1),(2 ,"both", 1), (3 ,"both", 1), (4 ,"both", 1)] )
mc.button( l=self.buttonsk, c=self.selSKItem )
mc.button( l=self.buttonAllSk, c=self.mainSK )
mc.button( l=self.buttonqp, c=self.selQPItem )
mc.button( l=self.buttonAllQp, c=self.mainQP )
mc.setParent('..')
mc.columnLayout( adj=True, columnAlign="center" )
mc.separator ( h=10 )
mc.setParent('..')
self.addSKList()
示例4: enterTimecodeUI
def enterTimecodeUI(self, buttonlabel='set', buttonfunc=None):
'''
generic UI to enter timecode
:param buttonlabel' = label to add to the button
:param buttonfunc' = function to bind to the button on exit
'''
self.win='Timecode_UI'
if cmds.window(self.win, exists=True):
cmds.deleteUI(self.win, window=True)
cmds.window(self.win, title=self.win)
cmds.columnLayout(adjustableColumn=True)
cmds.text(label='Timecode Reference')
cmds.separator(h=10, style='in')
cmds.rowColumnLayout(nc=8)
cmds.text(label=' smpte : ')
cmds.textField('tchrs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tchrs'))
cmds.text(label=' : ')
cmds.textField('tcmins', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcmins'))
cmds.text(label=' : ')
cmds.textField('tcsecs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcsecs'))
cmds.text(label=' : ')
cmds.textField('tcfrms', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcfrms'))
cmds.setParent('..')
cmds.button(label=buttonlabel, command=lambda x:self.__uicb_gatherTimecode(buttonfunc))
cmds.showWindow(self.win)
示例5: transfertSelectionToTarget_window
def transfertSelectionToTarget_window():
"""
This definition creates the 'Transfert Selection To Target' main window.
"""
cmds.windowPref(enableAll=False)
if (cmds.window("transfertSelectionToTarget_window", exists=True)):
cmds.deleteUI("transfertSelectionToTarget_window")
cmds.window("transfertSelectionToTarget_window",
title="Transfert Selection To Target",
width=320)
spacing = 5
cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)
cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
cmds.text(label="Target:")
sources_textField = cmds.textField("target_textField")
cmds.button("pickTarget_button", label="Pick Target!", command=pickTarget_button_OnClicked)
cmds.setParent(topLevel=True)
cmds.separator(style="single")
cmds.button("transfertSelection_button", label="Transfert Selection!", command=transfertSelection_button_OnClicked)
setUnsetContextHotkeys()
scriptJob = cmds.scriptJob(uiDeleted=("transfertSelectionToTarget_window", setUnsetContextHotkeys), runOnce=True)
cmds.showWindow("transfertSelectionToTarget_window")
cmds.windowPref(enableAll=True)
示例6: add
def add(self, driverName, angleValues=[] ):
if not angleValues:
angleValues = [0,0,0]
defaultBgc = [ .1, .1, .1 ]
onBgc = [ .9, .9, .2 ]
enList = [0,0,0]
bgcList = [None,None,None]
for i in range( 3 ):
if math.fabs( angleValues[i] ) >= self._minValue:
bgcList[i] = onBgc
enList[i] = 1
else:
bgcList[i] = defaultBgc
enList[i] = 0
widthList = uifnc.setWidthByPerList( [70,15,15,15] , self._width )
cmds.rowColumnLayout( nc=4, cw=[(1,widthList[0]),(2,widthList[1]),(3,widthList[2]),(4,widthList[3])] )
cmds.text( l= driverName+' : ', al='right' )
cmds.floatField( precision=2, v=angleValues[0], bgc= bgcList[0] )
cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle0 : %3.2f' %angleValues[0] ) )
cmds.floatField( precision=2, v=angleValues[1], bgc= bgcList[1] )
cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle1 : %3.2f' %angleValues[1] ) )
cmds.floatField( precision=2, v=angleValues[2], bgc= bgcList[2] )
cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle2 : %3.2f' %angleValues[2] ) )
self.driverScrollAddPopupCmd()
cmds.setParent( '..' )
示例7: OnSelectionChange
def OnSelectionChange( self ):
self.SelectedNodes = mel.eval( "ls -sl" )
self.ActiveManip = None
# ... informacion del frame seleccionado ...
if ( ( self.SelectedNodes != None ) and ( len( self.SelectedNodes ) == 1 ) ):
selectManip = None
if ( self.TranslationManips != None ):
selectManip = next( ( manip for manip in self.TranslationManips if manip.GetGizmo() == self.SelectedNodes[ 0 ] ), None )
if ( selectManip != None ):
sequence = next( ( seq for seq in self.SequenceInfo if seq.GetNode() == self.ActiveNode ), None )
frameInfo = sequence.GetFrameInfo( selectManip.GetFrame() )
self.ActiveManip = selectManip
cmds.checkBox( self.cXKey, edit = True, value = frameInfo.HasTranslationKeyAxis( 0 ) )
cmds.checkBox( self.cYKey, edit = True, value = frameInfo.HasTranslationKeyAxis( 1 ) )
cmds.checkBox( self.cZKey, edit = True, value = frameInfo.HasTranslationKeyAxis( 2 ) )
cmds.text( self.txtSelectedFrame, edit = True, label = selectManip.GetFrame() + self.StartFrame )
# ...
self.EnableKeyInfo( ( selectManip != None ) )
else:
self.EnableKeyInfo( False )
示例8: AverageUI
def AverageUI(self):
import maya.cmds as cmds
import maya.mel as mel
import sys
if cmds.window('AverageTool',exists=True):
cmds.deleteUI('AverageTool')
cmds.window('AverageTool')
grid=cmds.gridLayout( numberOfColumns=2, cellWidthHeight=(120, 150) )
column=cmds.columnLayout()
cmds.button('Creat',c='creat()',h=100)
cmds.button('Key',c='key()',h=50)
cmds.columnLayout(column,edit=1,columnAttach=('both',0),adj=1,co=('both',50),columnWidth=120)
cmds.setParent(column)
cmds.setParent( '..' )
cmds.frameLayout( label='Average', borderStyle='in' )
cmds.columnLayout()
cmds.rowLayout( numberOfColumns=3, columnWidth3=(35, 30, 35), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
cmds.intField('min',minValue=0,value=0)
cmds.text('To')
cmds.intField('max',minValue=0, value=0)
cmds.setParent( '..' )
cmds.setParent( '..' )
cmds.frameLayout( label='Iterations', borderStyle='out' )
cmds.intField('iterations',minValue=0,maxValue=10,value=0)
cmds.frameLayout( label='Key', borderStyle='out' )
cmds.button('Delect',c='Delect()')
cmds.showWindow()
示例9: copyCrvShapeUI
def copyCrvShapeUI():
if cmds.window('copyCrvShapeWin', exists=True):
cmds.deleteUI('copyCrvShapeWin')
cmds.window('copyCrvShapeWin', t='CopyCurve', rtf=True)
cmds.columnLayout('mainCL', adj=True)
cmds.text(l='Search for', align='center')
cmds.textField('searchTF')
cmds.textField('searchTF', e=True, tx='_L_')
cmds.separator()
cmds.text(align='center', l='Replace with')
cmds.textField('replaceTF')
cmds.textField('replaceTF', e=True, tx='_R_')
cmds.separator()
cmds.button('copyBTN', l='copy', c=partial(copyCrvShape))
cmds.showWindow('copyCrvShapeWin')
cmds.window('copyCrvShapeWin', e=True, w=220, h=98)
示例10: create
def create(self):
if cmds.window( WinMain.name, q=1, ex=1 ):
cmds.deleteUI( WinMain.name )
cmds.window( WinMain.name, title=WinMain.title )
form = cmds.formLayout()
textExplanation = cmds.text( l='1.컨트롤러 선택 \n2.컨트롤할 타겟들 선택'.decode( 'utf-8' ), al='center', h=50, bgc=[.3,.3,.3], font='fixedWidthFont' )
textAttr = cmds.text( l='Attribute Name', h=25 )
fieldAttrName = cmds.textField( tx='show', h=25)
buttonConnect = cmds.button( l='Connect', h=30, c=Cmd.connect )
cmds.formLayout( form, e=1,
af=[(textExplanation, 'top', 0), (textExplanation, 'left', 0), (textExplanation, 'right', 0),
(textAttr, 'left', 5), (fieldAttrName, 'right', 5),
(buttonConnect, 'left', 0), (buttonConnect, 'right', 0)],
ac=[(textAttr, 'top', 5, textExplanation),
(fieldAttrName, 'top', 5, textExplanation),
(fieldAttrName, 'left', 5, textAttr),
(buttonConnect, 'top', 5, textAttr)] )
cmds.window( WinMain.name, e=1, width=WinMain.width, height=WinMain.height )
WinMain.fieldAttrName = fieldAttrName
示例11: _showUI
def _showUI(self):
if cmds.window(self.win, exists=True):
cmds.deleteUI(self.win, window=True)
cmds.window(self.win, title=self.win, widthHeight=(400, 220))
cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
cmds.separator(h=15, style='none')
cmds.text(l='Select Audio to Offset')
cmds.separator(h=15, style='in')
cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
cmds.button(label='<< Offset',
ann='Nudge selected Audio Backwards',
command=partial(self.offsetSelectedBy,'negative'))
cmds.floatField('AudioOffsetBy', value=10)
cmds.button(label='Offset >>',
ann='Nudge selected Audio Forwards',
command=partial(self.offsetSelectedBy,'positive'))
cmds.setParent('..')
cmds.separator(h=15, style='in')
cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
cmds.button(label='Offset Range to Start at:',
ann='offset the selected range of audionodes such that they start at the given frame',
command=self.offsetSelectedTo)
cmds.floatField('AudioOffsetToo', value=10)
cmds.setParent('..')
cmds.separator(h=15, style='in')
cmds.button(label='Ripple selected',
ann="Ripple offset the selected audio nodes so they're timed one after another",
command=self.offsetRipple)
cmds.separator(h=15, style='none')
cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
cmds.showWindow(self.win)
cmds.window(self.win, e=True, widthHeight=(290, 190))
示例12: show
def show( self ) :
oSrch = 'LFT'
oRep = 'RGT'
oMul = 0
if mc.window( self.win , exists=True ) :
oSrch = mc.textField( '%sSrchTF'%self.ui , q=True , tx=True )
oRep = mc.textField( '%sRepTF'%self.ui , q=True , tx=True )
oMul = mc.floatField( '%sMultFF'%self.ui , q=True , v=True )
mc.deleteUI( self.win )
mc.window( self.win , t='pkWeightPuller' , rtf=True )
mc.columnLayout( '%sMainCL'%self.ui , adj=True )
mc.text( l='Search for' , align='center' )
mc.textField( '%sSrchTF'%self.ui , tx=oSrch )
mc.text( l='Replace with' , align='center' )
mc.textField( '%sRepTF'%self.ui , tx=oRep )
mc.button( '%sSwapBUT'%self.ui , l='Swap' , c=partial( self.swap ) )
mc.floatField( '%sMultFF'%self.ui , minValue=0 , maxValue=1 , v=oMul )
mc.button( '%sBUT'%self.ui , l='Pull' , c=partial( self.pull ) )
mc.showWindow( self.win )
mc.window( self.win , e=True , w=180 )
mc.window( self.win , e=True , h=180 )
示例13: __init__
def __init__(self):
self.name = "rsSubstituteAttribute"
self.title = "rs Substitute Attribute"
i_windowSize = (300, 110)
if (cmds.window(self.name, q=1, exists=1)):
cmds.deleteUI(self.name)
self.window = cmds.window(self.name, title=self.title)
s_winColPro2 = cmds.columnLayout(adjustableColumn=True, parent=self.window)
i_colum3 = (i_windowSize[0] / 6, i_windowSize[0] * 4 / 6, i_windowSize[0] / 6)
s_winRowField1 = cmds.rowLayout(numberOfColumns=3, adjustableColumn3=2, columnWidth3=(i_colum3), columnAlign=(1, 'center'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=s_winColPro2)
cmds.text(label='Source', align='center', parent=s_winRowField1)
self.sourceText = cmds.textField(cmds.textField(), edit=True, parent=s_winRowField1)
cmds.button(label='Pick up', c=self.rsPickUpSource, parent=s_winRowField1)
s_winRowField2 = cmds.rowLayout(numberOfColumns=3, adjustableColumn3=2, columnWidth3=(i_colum3), columnAlign=(1, 'center'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=s_winColPro2)
cmds.text(label='Target', align='center', parent=s_winRowField2)
self.targetText = cmds.textField(cmds.textField(), edit=True, parent=s_winRowField2)
cmds.button(label='Pick up', c=self.rsPickUpTarget, parent=s_winRowField2)
cmds.separator(height=5, style="none", hr=True, parent=s_winColPro2)
i_colum = i_windowSize[0] / 3
s_winRow1 = cmds.rowLayout(numberOfColumns=3, adjustableColumn3=2, columnWidth3=(5, i_colum, i_colum), columnAlign=(1, 'center'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=s_winColPro2)
cmds.separator(height=5, style="none", hr=True, parent=s_winRow1)
self.delAttr = cmds.checkBox("rsDelSourceAttr", label='Delete Source Attribute', align='right', v=True, parent=s_winRow1)
cmds.separator(height=5, style="none", hr=True, parent=s_winColPro2)
self.rsSubs = cmds.button(label='Substitute or Clone', w=100, c=self.rsSubs, parent=s_winColPro2)
cmds.window(self.window, e=1, w=430, h=103)
cmds.showWindow(self.window)
cmds.window(self.window, edit=True, widthHeight=(i_windowSize))
示例14: deleteTx
def deleteTx(self, *args):
ctrlPath = '|'.join([self.window, 'radioButton']);
selection = cmds.radioButton(ctrlPath, query=True, select=True);
self.deletedFiles = 0
ctrlPath = '|'.join([self.window, 'groupBox_3', 'label_10']);
if selection:
self.selectedFilesFromList()
else:
self.selectedFilesFromFolder()
if not self.selectedFiles:
cmds.text(ctrlPath, edit=True, label="Deleted: {0}".format(self.deletedFiles));
return
for texture in self.selectedFiles:
if not texture:
continue;
if 'udim' in os.path.basename(texture):
udims = getUdims(texture)
for udim in udims:
txFile = os.path.splitext(udim)[0]+".tx"
if os.path.isfile(txFile):
os.remove(txFile)
self.deletedFiles += 1
else:
txFile = os.path.splitext(texture)[0]+".tx"
if os.path.isfile(txFile):
os.remove(txFile)
self.deletedFiles += 1
cmds.text(ctrlPath, edit=True, label="Deleted: {0}".format(self.deletedFiles));
self.updateList()
示例15: build
def build(self):
if mc.windowPref(self.win, exists=1):
mc.windowPref(self.win, remove=1)
if mc.window(self.win,exists=1):
mc.deleteUI(self.win)
mc.window( self.win, title=self.title, widthHeight=(500, 210) )
cl1 = mc.columnLayout( columnAttach=('both', 2), rowSpacing=3, columnWidth=500, adjustableColumn = True)
mc.radioCollection()
self.mouth = mc.radioButton( l='user import', select=1, p=cl1 )
self.autoR = mc.radioButton( l='auto import', p=cl1 )
mc.separator()
mc.frameLayout('selected')
mc.rowLayout(numberOfColumns=3, columnWidth3=(80, 75, 150), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
mc.text(l='Mode')
mc.columnLayout()
mc.radioCollection()
self.prop = mc.radioButton( l='Prop', select=1 )
self.character = mc.radioButton( l='Character' )
mc.setParent( '..' )
mc.setParent( '..' )
self.numText = mc.floatFieldGrp( l='Num' )
self.txtProp = mc.textFieldButtonGrp( label='File Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
#mc.separator()
#self.txtCharacter = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
#mc.separator()
mc.separator(p=cl1)
mc.button( 'importR', l='Import Reference File', p=cl1 )
mc.setParent( '..' )