コード例 #1
2
ファイル: lcObjTools.py プロジェクト: kotchin/mayaSettings
def lcObj_exportObjs(*args, **kwargs):
  ''' Export .obj files from selected geometry, either as one combined file or as individual files per object.  Will recognize and convert poly smooth preview to geometry for export '''
  global prefix
  path = pm.textField(prefix+'_textField_export_path', query=True, text=True)
  objPrefix = pm.textField(prefix+'_textField_prefix', query=True, text=True)
  if objPrefix:
    objPrefix+='_'

  if path:

    sel = pm.ls(sl=True)

    if sel:
      sel = geometry.filterForGeometry(sel)
      print sel

      #undo is the easiest way to work on geometry temporarily
      pm.undoInfo(openChunk=True)

      if pm.checkBox(prefix+'_checkBox_use_smooth', query=True, v=True):
        for obj in sel:
          pm.select(obj)
          #find the objects currently displayed as smooth and create converted poly copies
          if pm.displaySmoothness(q=True, polygonObject=True)[0] == 3:
            pm.mel.performSmoothMeshPreviewToPolygon()

      if pm.checkBox(prefix+'_checkBox_export_indi', query=True, v=True):
        #export objects individually
        for obj in sel:
          pm.select(obj)
          name = str(obj)
          exportString = path+'/'+objPrefix+name+'.obj'
          pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)

      else:
        #export as one object
        pm.select(sel)
        name = ''
        while name == '':
          dialog = pm.promptDialog(title='OBJ Name', message='Enter Name:', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
          if dialog == 'OK':
            name = pm.promptDialog(query=True, text=True)
            if name:
              exportString = path+'/'+objPrefix+name+'.obj'
              pm.exportSelected(exportString, force=True, options='groups=1;ptgroups=1;materials=0;smoothing=1;normals=1', type='OBJexport', pr=True, es=True)
            else:
              pm.warning("You didn't type a name for your obj")
          if dialog == 'Cancel':
            break

      pm.undoInfo(closeChunk=True)
      pm.undo()
      pm.select(clear=True)

  else:
    pm.warning('Did you specify a path?')
コード例 #2
0
	def _setConn():
		mode = 'LAN' if mode_mqsb.isChecked() else 'local'
		host = pm.textField(tcHost_txt, q= 1, tx= 1)
		port = pm.textField(tcPort_txt, q= 1, tx= 1)
		if port and ((mode == 'LAN' and host) or mode == 'local'):
			beam.setCoord(int(port), host= host)
			return True
コード例 #3
0
ファイル: crm_ui.py プロジェクト: myCodeTD/pkmel
	def __init__(self, baseUi, parent):
		BaseUi.__init__(self, parent)
		self.uiparent = parent
		self.baseUi = baseUi
		self.tmpJnts = []
		self.attrCtrl = None

		#ui
		try:
			pm.deleteUI(self.rigCol)
		except: pass

		with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol:
			with pm.rowColumnLayout(nc=2, co=[(1, 'left', 130), (2, 'left', 5)]):
				pm.text(l='Finger Name')
				with pm.optionMenu(w=60) as self.fingerNameMenu:
					pm.menuItem(l='index')
					pm.menuItem(l='middle')
					pm.menuItem(l='ring')
					pm.menuItem(l='pinky')
					pm.menuItem(l='thumb')
			with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]):
				pm.text(l='attrCtrl')
				self.attrCtrlTxtFld = pm.textField(w=230, ed=False)
				self.loadAttrCtrlButt = pm.button(l='<<', c=pm.Callback(self.loadAttrCtrl))
				pm.text(l='tmpJnts')
				self.tmpJntsTxtFld = pm.textField(w=230, ed=False)
				self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts))

		self.baseUi.clearElemSideTxtFld()
コード例 #4
0
ファイル: jo_varFk.py プロジェクト: kyuhoChoi/mayaTools
def insertFirstSelected( *args ):
    sel = pm.selected()
    if len(sel) > 0:
        pm.textField('input_inputCurve', edit = True, text = sel[0])
    else: 
        pm.textField('input_inputCurve', edit = True, text = 'Draw a curve, 1 Joint per CV.')
        pm.warning('Nothing is selected.')
コード例 #5
0
ファイル: pbUDK.py プロジェクト: cmcpasserby/pbUDK
    def __init__(self, opts):
        self.opts = opts
        with pm.frameLayout('Export Meshes (.FBX)', collapsable=True, cl=False, bs='out'):
            with pm.columnLayout(width=250):
                pm.text(l='Export List:')
                pm.separator(height=4)
                self.meshList = pm.textScrollList(height=250, width=250, ams=True, dkc=self._remove)
                with pm.rowColumnLayout(nc=3, cw=[(1, 82), (2, 82), (3, 82)]):
                    pm.button(l='Add', c=self._add)
                    pm.button(l='Remove', c=self._remove)
                    pm.button(l='Clear', c=self._clear)

                with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2,124)]):
                    self.prefix = pm.checkBox(label='Prefix', value=self.opts['prefix'], cc=self.save)
                    self.suffix = pm.checkBox(label='Suffix', value=self.opts['suffix'], cc=self.save)
                    self.prefix_text = pm.textField(en=self.prefix.getValue(), text=self.opts['prefix_text'], cc=self.save)
                    self.suffix_text = pm.textField(en=self.suffix.getValue(), text=self.opts['suffix_text'], cc=self.save)

                pm.text(l='Export Path:')
                with pm.rowColumnLayout(nc=2, cw=[(1, 215), (2, 32)]):
                    self.fbxPath = pm.textField(text=self.opts['fbxPath'], cc=self._pathRefreash)
                    pm.button(l='...', c=self._path)

                with pm.rowColumnLayout(nc=3):
                    self.center = pm.checkBox(label='Move to Orgin', v=self.opts['center'], cc=self.save)
                    self.child = pm.checkBox(label='Export Childern', v=self.opts['child'], cc=self.save)
                    pm.button(l='FBXPreset', c=self._fbxPreset)

                with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2, 124)]):
                    pm.button(l='Selected', c=self._selected)
                    pm.button(l='All', c=self._all)

        self._refresh()
コード例 #6
0
    def __init__(self):
        if pm.window('optionVarEditor', exists=True):
            pm.deleteUI('optionVarEditor')

        with pm.window(title='optionVarEditor', widthHeight=(502, 552), s=False) as window:
            with pm.columnLayout():
                with pm.rowColumnLayout(nc=2, cw=[(1, 250), (2, 250)]):
                    # List Column
                    with pm.columnLayout():
                        self.search = pm.textField(width=248, cc=self.refresh, ec=self.refresh)
                        self.scrollList = pm.textScrollList(height=500, width=250, selectCommand=self._select, ams=True)
                    # Attr Column
                    with pm.columnLayout():
                        pm.text(l='optionVar Name:')
                        self.name = pm.textField(tx='Name', ed=False, width=248)
                        pm.text(l='optionVar Value:')
                        self.value = pm.textField(tx='value', width=248)
                # Buttons
                with pm.rowColumnLayout(nc=3, cw=[(1, 166), (2, 166), (3, 166)]):
                    pm.button(label='Create', c=self._create)
                    pm.button(label='Edit', c=self._edit)
                    pm.button(label='Delete', c=self._delete)

        self.refresh()

        # Render Window
        window.show()
コード例 #7
0
ファイル: previs.py プロジェクト: eoyilmaz/anima
    def create_shots(with_cameras):
        cnt = 0
        while pm.textField('%s%s' % (shot_name_name, str(cnt)), ex=1):
            cnt += 1

        seqs = [seq for seq in pm.ls(type='sequencer') if seq.referenceFile() is None]
        if len(pm.ls(type='sequencer')) != 1:
            raise RuntimeError('There must be 1 sequencer in a scene.')

        seq = seqs[0]
        for i in range(0, cnt):
            shot_node_name = pm.textField('%s%s' % (shot_name_name, str(i)), q=1, text=1)
            start_frame = pm.intField('%s%s' % (start_frame_name, str(i)), q=1, v=1)
            end_frame = pm.intField('%s%s' % (end_frame_name, str(i)), q=1, v=1)
            shot_num = pm.textField('%s%s' % (shot_num_name, str(i)), q=1, text=1)
            shot = pm.createNode('shot', n=shot_node_name)
            shot.setAttr('startFrame', start_frame)
            shot.setAttr('sequenceStartFrame', start_frame)
            shot.setAttr('endFrame', end_frame)
            shot.setAttr('shotName', shot_num)

            seq.add_shot(shot)

            if with_cameras:
                camera_name = '%s%s' % (pm.textField('camera_prefix_name', q=1, text=1), str(i+1))
                cam = pm.mel.eval('camera -n "%s";' % camera_name)
                pm.PyNode(cam[1]).setAttr('farClipPlane', 1000000)
                pm.PyNode(cam[1]).setAttr('focalLength', 35)
                pm.PyNode(cam[0]).attr('scaleX').lock()
                pm.PyNode(cam[0]).attr('scaleY').lock()
                pm.PyNode(cam[0]).attr('scaleZ').lock()
                shot.set_camera(pm.PyNode(cam[1]))
コード例 #8
0
ファイル: pymhud.py プロジェクト: danimanimal/PYMHUD
 def __init_window__(self):
     self.window = pm.window(menuBar=False, widthHeight=[200, 100], title="PYMHUD by Daniel S�nchez Quir�s")
     self.columna = pm.columnLayout(adjustableColumn=True)
     # Name row
     self.row1 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Name:", al="left", parent=self.row1)
     self.nameQ = pm.textField(parent=self.row1)
     pm.checkBox(
         label="", parent=self.row1, offCommand=Callback(self.nameHud, False), onCommand=Callback(self.nameHud, True)
     )
     # Scene row
     self.row2 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Scene Name:", al="left")
     self.sceneNameQ = pm.textField(parent=self.row2)
     pm.checkBox(
         label="",
         parent=self.row2,
         offCommand=Callback(self.sceneHud, False),
         onCommand=Callback(self.sceneHud, True),
     )
     # Date row
     self.row3 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Date:", al="left")
     pm.checkBox(
         label="", parent=self.row3, offCommand=Callback(self.dateHud, False), onCommand=Callback(self.dateHud, True)
     )
     # rame counter row
     self.row4 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Frame Counter:", al="left")
     pm.checkBox(label="", parent=self.row4, offCommand=Callback(self.frameHud), onCommand=Callback(self.frameHud))
     pm.showWindow(self.window)
コード例 #9
0
ファイル: skin_swcUI.py プロジェクト: loichuss/maya
 def __renameBySearchUI__(self):
     """create UI to rename by search and replace methode"""
     # check if we have an object to work with
     if self.objSwc != None:
         # get selected item
         boneName = self.boneUI['tslBoneR'].getSelectItem()[-1]
         
         # window creation
         windowName = 'SkinSaveLoadBoneSearch'
         title      = 'Search and Replace Name'
         
         # creating the window
         if (pmc.window(windowName, exists = True)):
             pmc.deleteUI(windowName)
         
         self.boneSearchUI['window']    = pmc.window(windowName, title = title, width=self.boneSearchSize[0], height=self.boneSearchSize[1], resizeToFitChildren=False, sizeable=False, retain=True )
         self.boneSearchUI['layMain']   = pmc.columnLayout( width=self.boneSearchSize[0], height=self.boneSearchSize[1] )
         self.boneSearchUI['layChoice'] = pmc.rowLayout( numberOfColumns=4, columnWidth4=((self.boneSearchSize[0])/2-45, 10, (self.boneSearchSize[0])/2-45, 25), height=self.boneSearchSize[1] )
         self.boneSearchUI['txtSearch'] = pmc.textField( text=boneName, editable=True, width=(self.boneSearchSize[0])/2-45 )
         pmc.text( label=' > ', width=10 )
         self.boneSearchUI['txtReplace']= pmc.textField( text='', editable=True, width=(self.boneSearchSize[0])/2-45 )
         self.boneSearchUI['btnChoice'] = pmc.button( label='ok', annotation='Press it to rename the bones', width=25  )
         
         # add command
         self.boneSearchUI['btnChoice'].setCommand(pmc.Callback( self.__renameBySearch__ ))
         
         # show window
         self.boneSearchUI['window'].show()
         
         # replace properly the window at the middle of the father window
         self.boneSearchUI['window'].setTopLeftCorner([self.boneUI['window'].getTopEdge()+self.boneUI['window'].getHeight()/2-self.boneSearchSize[1]/2, self.boneUI['window'].getLeftEdge()+self.boneUI['window'].getWidth()/2-self.boneSearchSize[0]/2])
コード例 #10
0
ファイル: ecSDKMirror.py プロジェクト: coxevan/tech_art_tools
    def __init__(self):
        self.window = 'sdkflip'
        self.title = 'ec Set Driven Key Utility'
        self.width_height = (312, 289)

        if py.window(self.window, exists=True):
            py.deleteUI(self.window)
        py.window(self.window, title=self.title, wh=self.width_height, sizeable=False)
        py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
        py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip")
        py.columnLayout("objCol", p="objRow")
        self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol")
        py.columnLayout("objbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt"))
        py.columnLayout("tarCol", p="objRow")
        self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol")
        py.columnLayout("tarbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt"))
        py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip")
        py.rowLayout("scrollRow", p="scrollFrame")
        self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow")
        py.rowLayout("comRow", numberOfColumns=4, p="sdkflip")
        py.text("preText", l="Target Prefix", p="comRow")
        self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow")
        py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True))
        py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False))

        py.showWindow(self.window)
コード例 #11
0
ファイル: gui.py プロジェクト: jenosavel/jhRigBuilder
    def rebuild(self):

        children = self._container.getChildArray()

        if children:
            for child in self._container.getChildArray():
                pm.deleteUI(child)

        self._fields = []

        with self._container:

            for index in range(self._attribute.numElements()):

                name = self._attribute[index].get()

                if not name:
                    continue

                self._fields.append(LinkField(
                    attribute = self._attribute[index],
                    *self._fieldArgs,
                    **self._fieldKwargs
                ))

            if not self._fields:
                pm.textField(text = '', editable = False, *self._fieldArgs, **self._fieldKwargs)
コード例 #12
0
def replaceString(*args):
    
    fileNodes = pc.ls(exactType='file')
    
    # Get the search string
    searchString = pc.textField(uiWidgets['searchField'], q=1, text=1)
    
    # Get the replace string
    replaceString = pc.textField(uiWidgets['replaceField'], q=1, text=1)
    
    if len(searchString) == 0 or len(replaceString) == 0:
        pc.confirmDialog(t="Error", message="Either the search or the replace string is empty. Try again.", icon='critical')
        exit(1)
    
    fileModified = 0
        
    for node in fileNodes:
    
        filePath = str(node.fileTextureName.get())
        print "Found a file node: %s" % node
        print "Current path is: %s" % filePath
        
        if str(searchString) in filePath:
            print "Found an occurence of the search string."
            print type(filePath)
            newFilePath = filePath.replace(searchString,replaceString)
            print "Setting new path to: %s" % newFilePath
            
            node.fileTextureName.set(newFilePath)
            fileModified += 1
    
    pc.confirmDialog(t="Success", message=str(fileModified)+" file(s) has been modified.")
コード例 #13
0
	def role_mqsb_switch(status, *args):
		pm.rowLayout(srcAddr, e= 1, vis= 1 if status else 0)
		pm.rowLayout(disAddr, e= 1, vis= 0 if status else 1)
		pm.textField(tcHost_txt, e= 1, tx= '', ed= 1 if status else 0)
		pm.textField(tcPort_txt, e= 1, tx= '', ed= 1 if status else 0)
		pm.columnLayout(remap_Area, e= 1, en= 1 if status else 0)
		pm.columnLayout(exect_Area, e= 1, en= 1 if status else 0)
コード例 #14
0
ファイル: skin_swcUI.py プロジェクト: loichuss/maya
 def __selectGrp__(self):
     """get the current selection as SWC group to work with"""
     obj = various.checkObj(pmc.ls(sl=True)[-1], type=['transform'])
     if obj != None:
         if len(obj.getShapes())==0:
             pmc.textField(self.mainUI['txtChoice'], edit=True, text=obj.name())
         else:
             vp.vPrint('%s is not an empty group' % obj, 1)
コード例 #15
0
ファイル: lcObjTools.py プロジェクト: kotchin/mayaSettings
def lcObj_setExportPath(*args, **kwargs):
  ''' browse a folder path and update text field '''
  global prefix
  path = pm.textField(prefix+'_textField_export_path', query=True, text=True)
  filter = "Wavefront Obj (*.obj)"
  path = pm.fileDialog2(ds=1, caption='Obj Export Location', dir=path, fileFilter=filter, fileMode=3)
  if path:
    pm.textField(prefix+'_textField_export_path', edit=True, text=path[0])
コード例 #16
0
	def pasteAddr(*args):
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, clr= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, pst= 1)
		addr = pm.cmdScrollFieldExecuter(copypasteField, q= 1, t= 1)
		host = addr.split(':')[0] if ':' in addr else ''
		port = addr.split(':')[1] if ':' in addr else ''
		pm.textField(tcHost_txt, e= 1, tx= host)
		pm.textField(tcPort_txt, e= 1, tx= port)
コード例 #17
0
ファイル: lcPath.py プロジェクト: kotchin/mayaSettings
    def browsePathTextField(cls, textField, filter, caption, *args, **kwargs):
      ''' '''
      path = pm.textField(textField, query=True, text=True)
      path = pm.fileDialog2(ds=1, caption=caption, dir=path, fileFilter=filter, fileMode=3)
      if path:
        pm.textField(textField, edit=True, text=path[0])

      return path
コード例 #18
0
ファイル: importCache.py プロジェクト: satishgoda/EHM_tools
	def getCharacterName( self, obj, *args ):
		if not obj:
			objs = pm.ls( sl=True )
			if objs:
				obj = objs[-1]
		else:
			obj = pm.ls( obj )[-1]
		pm.textField( self.exportModeRBG, e=True, text = self.getNameSpace( obj ) )    
コード例 #19
0
	def copyAddr(*args):
		host = pm.textField(tcHost_txt, q= 1, tx= 1)
		port = pm.textField(tcPort_txt, q= 1, tx= 1)
		addr = host + ':' + port
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, clr= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, t= addr)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, sla= 1)
		pm.cmdScrollFieldExecuter(copypasteField, e= 1, cp= 1)
コード例 #20
0
ファイル: importCache.py プロジェクト: satishgoda/EHM_tools
	def browse(self,*args):
		defaultPath = pm.textField( self.cacheFolderTextField, q=True, text=True ) # if user has enterd a path in the field, browse from that path
		if not defaultPath: # else use current open file path in browse window
			defaultPath=currentFilePath
			
		cacheFolder = pm.fileDialog2( caption='Choose Geometry Cache Folder', fileMode=2, startingDirectory=defaultPath, fileFilter='xml' )
		
		if cacheFolder:	
			pm.textField( self.cacheFolderTextField, edit=True, text=cacheFolder[0] ) 	
コード例 #21
0
def lcTextureToolsUI(dockable=False, *args, **kwargs):
  ''' '''
  ci = 0 #color index iterator
  windowName = 'lcTextureTools'
  shelfCommand = 'import lct.src.lcTextureTools.lcTextureTools as lcTxT\nreload(lcTxT)\nlcTxT.lcTextureToolsUI()'
  icon = basePath+'lcTextureTools.png'
  winWidth  = 204
  winHeight = 174

  mainWindow = lcWindow(windowName=windowName, width=winWidth, height=winHeight, icon=icon, shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
  mainWindow.create()

  #
  pm.columnLayout(prefix+'_columLayout_main')

  #
  pm.rowColumnLayout(nc=1, cw=([1,201]) )
  pm.iconTextButton(w=200, h=25, style='iconOnly', image=iconBasePath+'renameNodes.png', annotation='Renames all file nodes based on the attached file name with a tx_ suffix', command=lambda *args: texture.renameAllTextureNodes() )
  pm.setParent('..')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadAll.png', annotation='Reloads all the file texture nodes', command=lambda *args: texture.reloadTextures() )
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadTextures()', iconBasePath+'reloadAllTextures.png', 'Reload All Textures') )
  pm.setParent('..')
  pm.rowColumnLayout(nc=2, cw=([1,75], [2,25]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'reloadChanged.png', annotation='Reloads only the changed file texture nodes based on timestamp', command=lambda *args: texture().reloadChangedTextures() )
  pm.iconTextButton(w=25, h=25, style='iconOnly', image=iconBasePath+'addToShelf.png', highlightImage=iconBasePath+'addToShelf_over.png', annotation='Add to Shelf', command=lambda *args: shelf.makeShelfButton('Reload Changed Textures', 'from lct.src.core.lcTexture import Texture as texture\ntexture().reloadChangedTextures()', iconBasePath+'reloadChangedTextures.png', 'Reload Changed Textures') )
  pm.setParent('..')
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) )
  pm.textField(prefix+'_textField_new_path', w=150)
  pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getColorRGB(ci), annotation='Choose a new directory', w=50, command=lambda *args: path.browsePathTextField(prefix+'_textField_new_path', '', 'Browse New Texture Directory') )
  ci+=1
  pm.setParent(prefix+'_columLayout_main')

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathAll.png', annotation='Repath all file texture nodes', command=lambda *args: lcTxT_repath_all() )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'pathSelected.png', annotation='Repath selected file texture nodes', command=lambda *args: lcTxT_repath_selected() )
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  pm.rowColumnLayout(nc=2, cw=([1,100], [2,100]) )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openAll.png', annotation='Open all file texture nodes in default associated program', command=lambda *args: lcTxT_open_all() )
  pm.iconTextButton(w=100, h=25, style='iconOnly', image=iconBasePath+'openSelected.png', annotation='Open selected file texture nodes in default associated program', command=lambda *args: lcTxT_open_selected() )
  pm.setParent(prefix+'_columLayout_main')
  pm.separator(style='in', h=5)

  #
  mainWindow.show()
コード例 #22
0
ファイル: psd_driver.py プロジェクト: adamfok/afok_toolset
    def create_psd_driver_cmd (self, *args):
        prefix = pm.textField(self.widgets['psd_prefix_textField'], q=True, text=True)
        base_obj = pm.textField(self.widgets['psd_base_obj_textField'], q=True, text=True)
        parent_obj = pm.textField(self.widgets['psd_parent_obj_textField'], q=True, text=True)
        target_obj = pm.textField(self.widgets['psd_target_obj_textField'], q=True, text=True)
        start_angle = pm.intField(self.widgets['psd_start_angle_intField'], q=True, v=True)

        create_psd_driver(prefix=prefix, start_angle=start_angle, base_object=base_obj, target_object=target_obj, parent_object=parent_obj)
            
        return
コード例 #23
0
ファイル: extension.py プロジェクト: eoyilmaz/anima
 def text(self, value=None):
     """returns or sets the text field value
     """
     from pymel.core import textField
     if value is not None:
         # set the value
         textField(self, e=1, tx=value)
     else:
         # get the value
         return textField(self, q=1, tx=1)
コード例 #24
0
ファイル: Disperser.py プロジェクト: sundae24/Maya
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,cal=[(1,'right')], cw=[(1,80),(2,200),(3,100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ', v=10, cw3=[80,80,220],
                                       min=1, max=500, fmx=5000, f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(l='Random',
                                         onc=lambda *args: self.rotationRange.setEnable(True),
                                         ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ', nf=3, v1=30, v2=30, v3=30,
                                              cw4=[80,100,100,100], en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(l='Random',
                                           onc=lambda *args: self.scaleRange.setEnable(True),
                                           ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent( '..' )
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ', nf=2, v1=1, v2=1,
                                           cw3=[80,100,100], en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
コード例 #25
0
ファイル: shotAssembler.py プロジェクト: kiryha/AnimationDNA
def baseUI (): 
    if pm.window('ASSEMBLER', exists = 1):
        pm.deleteUI('ASSEMBLER')
    baseWin = pm.window('ASSEMBLER', t = 'Shot Assembler', w = 280, h = 100)
    with baseWin:
        mainLayout = pm.columnLayout()
        inputLayout = pm.rowColumnLayout(nc=6, parent = mainLayout) 
        pm.text (l = '  PART  ')
        partField = pm.textField(tx = 'REEL_01', w= 60, h = 30)
        pm.text (l = '    SEQ ')
        sequenceField = pm.textField(tx = '010', w= 45, h = 30)
        pm.text (l = '    SHOT ')
        shotField = pm.textField(tx = '010', w= 45, h = 30)
        pm.separator(h = 5 , style = 'none')        
        createLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) 
        ANM = pm.button(l = 'CREATE\r\nANIMATION SCENE', w = 140, h= 55)
        RND = pm.button(l = 'CREATE\r\nRENDER SCENE', w = 140, h= 55)
        ANM.setCommand(pm.Callback (shotAssemble, partField, sequenceField, shotField, listANM, actANM))
        RND.setCommand(pm.Callback (shotAssemble, partField, sequenceField, shotField, listRND, actRND)) 
        OPANM = pm.button(l = 'OPEN ANIMATION SCENE', w = 140, h = 25)
        OPRND = pm.button(l = 'OPEN RENDER SCENE', w = 140 )
        OPANM.setCommand(pm.Callback (dna.shotOpen, partField, sequenceField, shotField, listANM ))
        OPRND.setCommand(pm.Callback (dna.shotOpen, partField, sequenceField, shotField, listRND )) 
        pm.separator(h = 6 , style = 'none')

        editLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout) 
        check =  pm.button(l = 'CHECK SCENE', w = 280, h= 45)
        check.setCommand(pm.Callback (dna.checkScene))
        
        addLayout = pm.rowColumnLayout(nc = 3, parent = mainLayout)
        add_A = pm.button(l = 'ADD ASSSETS', w = 90, h= 30)
        del_A = pm.button(l = 'DEL ASSETS', w = 90)
        upd = pm.button(l = 'UPDATE REFS', w = 100)
        add_A.setCommand(pm.Callback (dna.addAsset))
        del_A.setCommand(pm.Callback (dna.delAsset))
        upd.setCommand(pm.Callback (dna.updateRefs))
             
        updLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout)
        fixALL = pm.button(l = 'FIX ALL', w = 240, h = 30)
        snv =    pm.button(l = 'SNV', w = 40)
        fixALL.setCommand(pm.Callback (dna.fixAll))
        snv.setCommand(pm.Callback (saveNext))
        pm.separator(h = 8 , style = 'none')
        
        addLayout = pm.rowColumnLayout(nc=2, parent = mainLayout)  
        pm.text (l = '   ADD ASSETS:        ')
        assetListField = pm.textField(tx = 'BENDER', w= 180, h = 30)
          
        createLayout = pm.rowColumnLayout(nc =2, parent = mainLayout)
        addANM = pm.button(l = 'FOR AMIMATION', w = 140, h= 50)
        addRND = pm.button(l = 'FOR RENDER', w = 140)
        addANM.setCommand(pm.Callback (refDataList, assetListField, 'RIG' ))
        addRND.setCommand(pm.Callback (refDataList, assetListField, 'GEO' )) 

    baseWin.show()  
コード例 #26
0
ファイル: dataPublisher.py プロジェクト: kiryha/AnimationDNA
def textPublisher(assetName, key, value, type, assetField, fieldGEO, fieldRIG, fieldFUR, fieldMAT, fieldEDA):
    pm.textField(assetField, edit = True, tx = assetName) 
    if key == 'GEO':
        pm.textField(fieldGEO, edit = True, tx = value) 
    elif key =='RIG':
        pm.textField(fieldRIG, edit = True, tx = value) 
    #elif key =='FUR':
        #pm.textField(fieldFUR, edit = True, tx = value) 
    elif key =='MAT':
        pm.textField(fieldMAT, edit = True, tx = value)
    elif key =='EDA':
        pm.textField(fieldEDA, edit = True, tx = value) 
コード例 #27
0
ファイル: tsl_gui.py プロジェクト: creuter23/fs-tech-artist
def gui():
    win = pm.window()
    main = pm.columnLayout()
    global tsl, filter_field, add_field
    tsl = TSL()
    pm.rowColumnLayout(nc=2, cw=[[1,125], [2,75]])
    add_field = pm.textField()
    pm.button(label='Add', c=pm.Callback(add_items))    
    filter_field = pm.textField(cc=pm.Callback(filter))
    pm.button(label='Clear', c=pm.Callback(tsl.limit,''))
    
    win.show()
コード例 #28
0
ファイル: animManager.py プロジェクト: kiryha/AnimationDNA
def baseUI(*args):
    
    if pm.window('ANMManager', q = 1, ex = 1):
        pm.deleteUI('ANMManager')
    win = pm.window('ANMManager', t= 'Animation manager', rtf=True, w = 280 )
    with win:
        mainLayout = pm.columnLayout() 
        
        inputLayout = pm.rowColumnLayout(nc=6, parent = mainLayout) 
        pm.text (l = '  PART  ')
        partField = pm.textField(tx = 'REEL_01', w= 60, h = 30)
        pm.text (l = '    SEQ ')
        sequenceField = pm.textField(tx = '010', w= 45, h = 30)
        pm.text (l = '    SHOT ')
        shotField = pm.textField(tx = '010', w= 45, h = 30)
        pm.separator(h = 5 , style = 'none')        
        createLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout) 
        OPANM = pm.button(l = 'OPEN ANIMATION SCENE', w = 280, h = 35)
        OPANM.setCommand(pm.Callback (dna.shotOpen, partField, sequenceField, shotField, listANM ))
        pm.separator(h = 6 , style = 'none')  
                           
        PBLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout) 
        playblast = pm.button(l = 'PLAYBLAST', w = 280, h= 50)       
        playblast.setCommand(pm.Callback (PB, 'mov'))
        pm.separator(h = 5, style = 'none')
        
        camLayout = pm.rowColumnLayout(nc = 10, parent = mainLayout) # 12, 18, 27, 40, 65, 75, 100, 135, 180
        for i in listLens:
            LB = pm.button(l = str(i), w = 25, h= 40)
            LB.setCommand(pm.Callback (lens, i))
        lockCAM = pm.button(l = 'LCM', w = 55)
        lockCAM.setCommand(pm.Callback (lockCam))
        pm.separator(h = 8, style = 'none')
        
        editLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout) 
        check =  pm.button(l = 'CHECK SCENE', w = 280, h= 45)
        check.setCommand(pm.Callback (dna.checkScene))
        
        addLayout = pm.rowColumnLayout(nc = 3, parent = mainLayout)
        add_A = pm.button(l = 'ADD ASSSETS', w = 90, h= 30)
        del_A = pm.button(l = 'DEL ASSETS', w = 90)
        upd = pm.button(l = 'UPDATE REFS', w = 100)
        add_A.setCommand(pm.Callback (dna.addAsset))
        del_A.setCommand(pm.Callback (dna.delAsset))
        upd.setCommand(pm.Callback (dna.updateRefs))       
        updLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout)
        fixALL = pm.button(l = 'FIX ALL', w = 240, h = 30)
        snv =    pm.button(l = 'SNV', w = 40)
        fixALL.setCommand(pm.Callback (dna.fixAll))
        snv.setCommand(pm.Callback (saveNext))
   
    win.show()    
コード例 #29
0
ファイル: aw_exporter.py プロジェクト: AndresMWeber/aw
    def __init__(self, title, widthHeight, tabs_names, frameLayoutPerTab, collapseStyle=0, descr=''):
        super(Exporter, self).__init__(title, widthHeight, tabs_names, frameLayoutPerTab)
        self.localProject = os.environ[ 'MAYA_PROJECT' ]
        self.localUser=os.environ[ 'USER' ]
        self.path = os.path.join(self.localProject+ "/export/GEO")
        self.scene_name = cmds.file(q=True, sn=True, shn=True).split('.')[0]
        self.folder_path = os.path.join(self.path, 'OBJ', self.localUser, self.scene_name)
        self.type = 'OBJ'
        self.extension = 'obj'
        self.curFr=1001
        # GUI BUILDING #
        self.fl = self.frameLayouts[0][0].columnLayout
        col = pm.columnLayout(p=self.fl, h=self.wh[1]/2)
        flow_1=pm.flowLayout(p=col, w=self.wh[0])
        self.type_om = win.AW_optionMenu(label="File Type",
                                         options=['OBJ','ZBRUSH', 'MUDBOX', 'FBX', 'MB', 'MA', 'ALEMBIC'],
                                         parent=flow_1,
                                         cc=self._updateDirectory)
        self.autoCheck = pm.checkBox(l='Auto-detect Folder', p=flow_1, v=1)
        
        pm.flowLayout(p=col, w=self.wh[0])
        pm.text(l='Directory:')
        self.path_tf=pm.textField(w=self.wh[0]/1.3,cc=self._update_path_tf)
        pm.button(label='Browse',w=80, c=self._browser, bgc=self.col_fls[1])
        
        self.path_tf.setText(self.folder_path)

        flow_3 = pm.flowLayout(w=self.wh[0], p=col)
        self.combined_cb = pm.checkBox(l='Export Per Object', v=1, cc=self._change_combined_cb, p=flow_3)
        pm.text(l='Combined Name:',p=flow_3,w=200)
        self.combined_tf = pm.textField(tx='', p=flow_3,w=300, editable=False)
        
        flow_4 = pm.flowLayout(w=self.wh[0],p=col)
        self.framesCheck = pm.checkBox(l='Frame Range', w=200,p=flow_4, v=0, cc=self._framesCallback)
        self.fr_st = pm.textField(editable=False,w=100,tx=str(int(pm.playbackOptions(ast=True, q=True))),p=flow_4)
        self.fr_end = pm.textField(editable=False,w=100,tx=str(int(pm.playbackOptions(aet=True, q=True))),p=flow_4)
        
        pm.text(l='\n', p=col)
        flow_col = pm.flowLayout(p=col, w=self.wh[0])
        col_1 = pm.columnLayout(p=flow_col, w=self.wh[0]/2)
        col_2 = pm.columnLayout(p=flow_col, w=self.wh[0]/2)
        self.export_btn = pm.button(label='Export', bgc=self.col_fls[4], c=self._export, p=col_1, w=self.wh[0]/4)
        
        flow_5 = pm.flowLayout(w=self.wh[0],p=col_2)
        self.recursiveCheck = pm.checkBox(l='Check all folders inside', v=1, p=flow_5)
        self.list_btn = pm.button(label='List Files in Directory', bgc=self.col_fls[5], c=partial(self._getDirectoryFiles,True), p=flow_5, w=self.wh[0]/4)
        
        self.import_btn = pm.button(label='Import Directory', bgc=self.col_fls[5], c=self._customImport, p=col_2, w=self.wh[0]/2.5)
        pm.text(l='\n',p=col)
        pm.button(label='Swap Namespace with Name', bgc=self.col_fls[6], c=self._swapNamespace, p=col_2,w=self.wh[0]/2.5)
コード例 #30
0
ファイル: aw_msvExp.py プロジェクト: AndresMWeber/aw
	def objExp(self):
		finished=0
		# Query selection and store in variable
		sel=pm.ls()
		if len(sel) != 0:
			test=str(pm.textField('combName',q=1,text=1))
			path_here=str(pm.textField("pathName", q=1,text=1))
			if (test == "Object Export Name") and (pm.optionMenu("modelType", q=1,v=1) == "Combined"):
				pm..error("Please enter a unique object name with no space.\n")
				
			if not os.path.isdir( path_here ):
				os.mkdir( path_here )
				# Create export user geo directory
				print "Created user export geo directory: " + path_here + "\n"
			else:
				print "User directory already exists: " + path_here + " ...skipping\n"
				# Create template for object name
				
			if pm.optionMenu('exportType',q=1,v=1) == "FBX":
				os.mkdir( (path_here + "FBX/") )
				print "    Created FBX Directory: " + (path_here + "FBX/") + "\n"
				
			if pm.optionMenu('exportType',q=1,v=1) == "OBJ":
				os.mkdir( (path_here + "OBJ/") )
				print "    Created OBJ Directory: " + (path_here + "OBJ/") + "\n"
				
			if pm.optionMenu('exportType',q=1,v=1) == "PROXY":
				os.mkdir( (path_here + "renderProxy/") )
				print "    Created render proxy Directory: " + (path_here + "renderProxy/") + "\n"
				
			i=0
			if pm.optionMenu("modelType", q=1,v=1) == "Separate":
				for obj in sel:
					self.exporter(obj, path_here)
					i+=1
					
				finished=1
				
			if pm.optionMenu("modelType", q=1,v=1) == "Combined":
				self.exporterCombined(sel, path_here)
				i+=1
				finished=1
				
			if finished:
				print "Sequence creation finished!\n" + str(i) + " geometry(ies) exported.\n"
				
			
		
		else:
			print "Select something numbnuts!"
コード例 #31
0
ファイル: rope.py プロジェクト: divyanshuarora-92/submodule
def build_rope(*args):
    DEF_nb = pm.intField("nbDeformers", q=True, v=True)
    ropeName = pm.textField("RopeName", q=True, text=True)
    keepRatio = pm.checkBox("keepRatio", q=True, v=True)
    rope(DEF_nb, ropeName, keepRatio)
コード例 #32
0
    def initializeModelTab(self, tabHeight, tabWidth):
        columnWidth = 120
        moduleSpecific_scrollHeight = 120
        scrollHeight = tabHeight - moduleSpecific_scrollHeight - 20

        self.UIElements["modelColumn"] = pm.columnLayout(adj=True, rs=3)
        self.UIElements["m1"] = pm.rowColumnLayout(numberOfColumns=3,
                                                   ro=[(1, "both", 2),
                                                       (2, "both", 2),
                                                       (3, "both", 2)],
                                                   columnAttach=[
                                                       (1, "both", 3),
                                                       (2, "both", 3),
                                                       (3, "both", 3)
                                                   ],
                                                   columnWidth=[
                                                       (1, columnWidth),
                                                       (2, columnWidth),
                                                       (3, columnWidth)
                                                   ])

        # Pivots
        pm.button(label="Origin Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="zero"))
        pm.button(label="Min Y Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="minY"))
        pm.button(label="Center Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="center"))

        pm.button(label="Copy Pivot",
                  command=lambda a: mo_alignUtils.copyPivot(pm.selected()))
        pm.button(label="Min Z Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="minZ"))
        pm.button(label="Min X Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="minX"))

        # Mesh Combine
        pm.button(
            label="Seperate",
            command=lambda a: mo_meshUtils.separateGeo(objArray=pm.selected(),
                                                       geoSuffix='geo',
                                                       grpSuffix='grp',
                                                       grp=1,
                                                       centerPivot=1))
        pm.button(label="Combine",
                  command=lambda a: mo_meshUtils.combineGeo(pm.selected()))
        pm.button(label="Move to Orig",
                  command=lambda a: mo_alignUtils.moveToZero(pm.selected()))

        # Mesh Reduce
        pm.button(
            label="Reduce 25",
            command=lambda a: mo_meshUtils.meshReduce(meshes=[], percent=25))
        pm.button(
            label="Reduce 50",
            command=lambda a: mo_meshUtils.meshReduce(meshes=[], percent=50))
        pm.button(
            label="Reduce 90",
            command=lambda a: mo_meshUtils.meshReduce(meshes=[], percent=90))

        # Selection
        pm.button(label="toShell", command=lambda a: mo_meshUtils.toShell())
        pm.textField("amount_input", width=columnWidth * 0.3)
        pm.button(label="random Faces",
                  command=lambda a: mo_meshUtils.selectRandomFaces(
                      pm.selected(),
                      amount=int(pm.textField("amount_input", q=1, text=1))))

        pm.button(label="Zero Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="zero"))
        pm.button(label="Min Y Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="minY"))
        pm.button(label="Center Pivot",
                  command=lambda a: mo_alignUtils.movePivot(pm.selected(),
                                                            moveto="center"))

        # Shader assign
        pm.textField("shaderName", width=columnWidth * 0.3)
        pm.optionMenu(width=columnWidth * 0.3)
        pm.menuItem(label='Blinn')
        pm.menuItem(label='Lmbert')
        pm.button(label="Assign Shader",
                  command=lambda a: mo_shaderUtils.assignNewMaterial(
                      name=pm.textField("shaderName", q=1, text=1),
                      color=[0.5, 0.5, 0.5],
                      shader="blinn",
                      target=pm.selected()))

        pm.button(label="CopyPaste Mat",
                  command=lambda a: mo_shaderUtils.copyPasteMaterial(
                      objects=pm.selected()))
        pm.button(label="CopyPaste Mat",
                  command=lambda a: mo_shaderUtils.copyPasteMaterial(
                      objects=pm.selected()))
        pm.button(label="CopyPaste Mat",
                  command=lambda a: mo_shaderUtils.copyPasteMaterial(
                      objects=pm.selected()))

        # Tempimport/Export
        pm.textField("tempExportPath",
                     width=columnWidth * 0.3,
                     text=mo_UI.getHomeDir(subfolder='maya/tempExport'))
        pm.button(label="Temp Export",
                  command=lambda a: mo_fileSystemUtils.tempExportSelected(
                      path=pm.textField("tempExportPath", q=1, text=1)))
        pm.button(label="Temp Import",
                  command=lambda a: mo_fileSystemUtils.tempImport(
                      path=pm.textField("tempExportPath", q=1, text=1)))

        pm.button(label="Temp Export UI",
                  command=lambda a: tempExportLibraryOpen())

        # "C:\Users\dellPC\Documents\maya\tempExport"

        pm.setParent(self.UIElements["modelColumn"])
        return self.UIElements["modelColumn"]
コード例 #33
0
 def removeSelectionSetWin(self):
     setInput = pm.textField("setName", q=1, tx=1)
     if pm.objExists(setInput):
         pm.sets(setInput, remove=pm.selected())
コード例 #34
0
    def display(cls):
        """
        creates and displays a window

        """
        # window UI
        window_name = cls.WINDOW_NAME
        title = "Images Importer"

        if pm.window(window_name, ex=True):
            pm.deleteUI(window_name)
            pm.windowPref(window_name, remove=1)

        main_window = pm.window(window_name,
                                t=title,
                                iconName='icon_Name',
                                wh=(280, 190),
                                s=1,
                                tb=1)

        form = pm.formLayout(numberOfDivisions=100)

        sep0 = pm.separator(style="in", h=3)
        rows = pm.rowColumnLayout(numberOfColumns=2,
                                  columnWidth=[(1, 110), (2, 130)])
        pm.text(label='Image Card Prefix: ', al="right")
        cls.img_pref_input = pm.textField(tx="img_")
        pm.setParent('..')

        sep1 = pm.separator(style="in", h=3)
        cls.cb_alpha = pm.checkBox(l="Alpah Channel", al="center")
        cls.cb_scale = pm.checkBox(
            l="Scale Ratio",
            al="center",
            changeCommand=
            "from image_card_importer.image_card_importer_tool import window_ui\n"
            "window_ui.cb_scale_toggled()")
        cls.size_mult_input = pm.textField(tx="2", enable=0)
        cls.cb_seq = pm.checkBox(l="Image Sequence", al="center")

        sep2 = pm.separator(style="in", h=3)
        btn_notes_txt = pm.text(
            label='Please select image files to import as cards',
            al="center",
            font="obliqueLabelFont")
        btn_import = pm.button(l="Import Images", al="center", h=30, w=150)
        btn_import.setCommand(
            "from image_card_importer.image_card_importer_tool import window_ui\nwindow_ui.import_button()"
        )

        pm.formLayout(form,
                      edit=True,
                      attachForm=[
                          (sep0, 'left', 5),
                          (sep0, 'right', 5),
                          (sep0, 'top', 0),
                          (rows, 'left', 10),
                          (rows, 'right', 10),
                          (cls.cb_alpha, 'left', 20),
                          (btn_notes_txt, 'left', 40),
                          (cls.cb_scale, 'left', 20),
                          (sep1, 'left', 5),
                          (sep1, 'right', 5),
                          (sep2, 'left', 5),
                          (sep2, 'right', 5),
                          (btn_import, 'left', 65),
                      ],
                      attachControl=[
                          (rows, 'top', 10, sep0),
                          (cls.cb_alpha, 'top', 10, sep1),
                          (cls.cb_seq, 'top', 10, sep1),
                          (cls.cb_seq, 'left', 12, cls.cb_alpha),
                          (cls.cb_scale, 'top', 10, cls.cb_seq),
                          (cls.size_mult_input, 'top', 10, cls.cb_seq),
                          (cls.size_mult_input, 'left', 30, cls.cb_scale),
                          (sep1, 'top', 10, rows),
                          (sep2, 'top', 10, cls.cb_scale),
                          (btn_notes_txt, 'top', 10, sep2),
                          (btn_import, 'top', 10, btn_notes_txt),
                      ])

        pm.showWindow(main_window)

        pm.columnLayout()
コード例 #35
0
 def getName(self, name_):
     getName = pm.textField(name_,q=1,tx=1)
     if getName:
         return getName
     
     return None
コード例 #36
0
 def updateTextfield(self, name, text):
     pm.textField(name, e=1, text=text)
コード例 #37
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
def _build_hotkeys_frame(parent_layout):
    hotkeys_frame = pm.frameLayout(label="Hotkeys", collapsable=True)
    hotkeys_column = pm.columnLayout(adj=True, columnAttach=('both', 5))
    pm.separator(height=5, style='none')

    # Toggle IK/FK mode Hotkey
    toggle_mode_cmd_name = 'mimic_toggleIkFkMode'
    toggle_mode_annotation_str = 'Toggles Mimic Robot plugin IK/FK mode'
    toggle_mode_command_str = 'import mimic_utils; ' \
                              'mimic_utils.toggle_ik_fk_ui()'

    pm.rowLayout(numberOfColumns=4,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', 0),
                 columnWidth=[(1, 72), (3, 45), (4, 50)],
                 height=20)

    # Find hotkey assignment, if one exists, to populate the ui
    toggle_mode_hotkey_name = toggle_mode_cmd_name + 'Hotkey'
    toggle_mode_key = mimic_utils.find_hotkey(toggle_mode_hotkey_name)
    if not toggle_mode_key:
        toggle_mode_key = ' key'

    pm.text(label='Toggle IK/FK:')
    pm.textField("t_toggleIkFk", font=FONT, placeholderText=toggle_mode_key)

    pm.button(label='Create',
              width=45,
              height=20,
              command=pm.Callback(mimic_utils.assign_hotkey,
                                  toggle_mode_cmd_name,
                                  toggle_mode_annotation_str,
                                  toggle_mode_command_str))

    pm.button(label='Remove',
              width=50,
              height=20,
              command=pm.Callback(mimic_utils.remove_hotkey,
                                  toggle_mode_cmd_name))

    pm.setParent('..')
    pm.separator(height=3, style='none')

    # Keyframe IK/FK Hotkey
    key_ik_fk_cmd_name = 'mimic_keyIkFk'
    key_ik_fk_annotation_str = 'Keys Mimic robot IK/FK attributes'
    key_ik_fk_command_str = 'import mimic_utils; ' \
                            'mimic_utils.key_ik_fk()'

    pm.rowLayout(numberOfColumns=4,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', 0),
                 columnWidth=[(1, 72), (3, 45), (4, 50)],
                 height=20)

    # Find hotkey assignment, if one exists, to populate the ui
    key_IkFk_hotkey_name = key_ik_fk_cmd_name + 'Hotkey'
    key_IkFk_key = mimic_utils.find_hotkey(key_IkFk_hotkey_name)
    if not key_IkFk_key:
        key_IkFk_key = ' key'

    pm.text(label='Key IK/FK:')
    pm.textField("t_keyIkFk", font=FONT, placeholderText=key_IkFk_key)

    pm.button(label='Create',
              width=45,
              height=20,
              command=pm.Callback(mimic_utils.assign_hotkey,
                                  key_ik_fk_cmd_name,
                                  key_ik_fk_annotation_str,
                                  key_ik_fk_command_str))
    pm.button(label='Remove',
              width=50,
              height=20,
              command=pm.Callback(mimic_utils.remove_hotkey,
                                  key_ik_fk_cmd_name))

    pm.setParent(hotkeys_column)
    pm.separator(height=8, style='none')
    pm.setParent(parent_layout)
コード例 #38
0
ファイル: gtags.py プロジェクト: Wizard-collab/Wizard
pm.frameLayout(l='Guerilla Tags Tool', mw=5, mh=5)
pm.columnLayout(adj=True)
pm.separator(style='none', h=5)

pm.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 20), (2, 200), (3, 19)])
pm.iconTextButton(style='iconAndTextVertical',
                  height=19,
                  width=19,
                  noBackground=True,
                  image1='mGuerilla.png',
                  command=tagGuerillaAuto,
                  annotation='AutoTags your selection for guerilla')

tagGuerillaText = pm.textField(aie=1,
                               ec=tagGuerilla,
                               placeholderText='add one more tag',
                               bgc=(0.16862745098039217, 0.16862745098039217,
                                    0.16862745098039217))
addMoreTagButton = pm.iconTextButton(
    l='on',
    style='iconOnly',
    image1='addClip.png',
    height=19,
    width=19,
    ebg=False,
    command=switchGuerillatagOption,
    annotation='Switch between Add mode and Replace mode')

pm.setParent('..')

pm.separator(style='none', h=5)
コード例 #39
0
ファイル: gui.py プロジェクト: campbellwmorgan/charactercrowd
    def setupUI(self, parent, width):
        """
        Creates the UI for setting up a mesh
        """
        setupContainer = pm.frameLayout(p=parent, l="Init", cll=1, cl=1)
        setupManual = pm.frameLayout(p=setupContainer,
                                     l="a) Setup New Mesh",
                                     cll=1,
                                     cl=1,
                                     mw=10,
                                     mh=20)
        # reference text items to show when something selected
        self.mainCharacter = pm.text(label="No Character Selected",
                                     p=setupManual,
                                     al="left",
                                     w=width)
        self.parentVis = pm.text(label="No Visibility Node Selected",
                                 p=setupManual,
                                 al="left",
                                 w=width)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)
        self.selectedKeyable = pm.text(label="No Keyables Selected",
                                       p=setupManual,
                                       al="left",
                                       w=width)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)
        self.selectedMeshes = pm.text(label="No Meshes Selected",
                                      p=setupManual,
                                      al="left",
                                      w=width)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)

        self.parentButton = pm.button(label="Select Parent Node",
                                      p=setupManual,
                                      command=self.selectParent)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)
        self.parentButton = pm.button(label="Select Parent Visibility Node",
                                      p=setupManual,
                                      command=self.selectParentVis)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)
        self.keyableButton = pm.button(label="Select Keyable Nodes",
                                       p=setupManual,
                                       command=self.selectKeyable)
        pm.separator(p=setupManual, h=10, w=width, st="single", hr=1)
        self.meshesButton = pm.button(label="Select Meshes",
                                      p=setupManual,
                                      command=self.selectMeshes)
        pm.separator(p=setupManual, h=50, w=width, st="single", hr=1)

        pm.text(label="Create Unique Prefix:", p=setupManual)
        self.uniquePrefixField = pm.textField(p=setupManual, w=width, h=20)
        pm.separator(p=setupManual, h=20, w=width, st="single", hr=1)
        pm.button(label="Store", p=setupManual, command=self.storePrefix)

        load = pm.frameLayout(p=setupContainer,
                              l="b) Load Existing",
                              cll=1,
                              cl=1,
                              mw=10,
                              mh=20)

        pm.button(label="Load from Selected",
                  p=load,
                  command=self.loadFromSelected)

        setupContainer.setCollapse(True)
        return setupContainer
コード例 #40
0
ファイル: speedrig.py プロジェクト: williamyap912/S-S-Rig
def squash_stretch_IK(*args):

    list_loc = pm.ls(sl=True)
    list_loc_number = len(list_loc)

    if pm.objExists('IK_spline_stretch_squash_bind_grp'):

        print 'group already exist'

    else:

        pm.group(em=True, n='IK_spline_stretch_squash_bind_grp', w=True)

    if pm.objExists('IK_spline_stretch_squash_IK_handle_grp'):

        print 'group already exist'

    else:

        pm.group(em=True, n='IK_spline_stretch_squash_IK_handle_grp', w=True)

    if pm.objExists('IK_spline_stretch_squash_curve_grp'):

        print 'group already exist'

    else:

        pm.group(em=True, n='IK_spline_stretch_squash_curve_grp', w=True)

    if pm.objExists('IK_spline_stretch_squash_loc_grp'):

        print 'group already exist'

    else:

        pm.group(em=True, n='IK_spline_stretch_squash_loc_grp', w=True)

    if pm.objExists('IK_spline_stretch_squash_joint_ctrl_grp'):

        print 'group already exist'

    else:

        pm.group(em=True, n='IK_spline_stretch_squash_joint_ctrl_grp', w=True)
    '''
    Retreiving data entry
    '''

    intFieldData_num_joint = pm.intField(intFieldEntry_num_joint,
                                         editable=True,
                                         query=True,
                                         value=True)
    textFieldData_ik_spline_name = pm.textField(textFieldEntry_ik_spline_name,
                                                editable=True,
                                                query=True,
                                                text=True)

    for loc_seq in range(1, list_loc_number + 1):

        if loc_seq == list_loc_number:

            print(list_loc[list_loc_number - 1]), 'is the final locator'

            pm.delete(list_loc[list_loc_number - 1])

            break

        elif (intFieldData_num_joint % 2) > 0:

            print 'Input joint number is odd number'

            break

        else:

            if pm.objExists('{0}_{1}_IK_spline_loc_grp'.format(
                    textFieldData_ik_spline_name, loc_seq)):

                print 'Naming error - system with same name exist'

                break

            else:

                pm.group(em=True,
                         n='{0}_{1}_IK_spline_loc_grp'.format(
                             textFieldData_ik_spline_name, loc_seq),
                         w=True)
                pm.parent(
                    '{0}_{1}_IK_spline_loc_grp'.format(
                        textFieldData_ik_spline_name, loc_seq),
                    'IK_spline_stretch_squash_loc_grp')

            loc_first = list_loc[loc_seq - 1]
            loc_second = list_loc[loc_seq]

            loc_first_X = pm.getAttr(loc_first.translateX)
            loc_first_Y = pm.getAttr(loc_first.translateY)
            loc_first_Z = pm.getAttr(loc_first.translateZ)

            loc_second_X = pm.getAttr(loc_second.translateX)
            loc_second_Y = pm.getAttr(loc_second.translateY)
            loc_second_Z = pm.getAttr(loc_second.translateZ)

            loc_mid_tranX = loc_first_X + ((loc_second_X - loc_first_X) / 2)
            loc_mid_tranY = loc_first_Y + ((loc_second_Y - loc_first_Y) / 2)
            loc_mid_tranZ = loc_first_Z + ((loc_second_Z - loc_first_Z) / 2)

            loc_mid = pm.spaceLocator(n='{0}_{1}_02_trans_loc'.format(
                textFieldData_ik_spline_name, loc_seq))
            pm.setAttr('{0}.tx'.format(loc_mid), (loc_mid_tranX))
            pm.setAttr('{0}.ty'.format(loc_mid), (loc_mid_tranY))
            pm.setAttr('{0}.tz'.format(loc_mid), (loc_mid_tranZ))

            if loc_seq == 1:

                pm.rename(
                    loc_first,
                    '{0}_{1}_01_trans_loc'.format(textFieldData_ik_spline_name,
                                                  loc_seq))
                pm.rename(
                    loc_second,
                    '{0}_{1}_01_trans_loc'.format(textFieldData_ik_spline_name,
                                                  loc_seq + 1))

            else:
                pm.rename(
                    loc_second,
                    '{0}_{1}_01_trans_loc'.format(textFieldData_ik_spline_name,
                                                  loc_seq + 1))

            curve_path = pm.curve(d=1,
                                  p=[(loc_first_X, loc_first_Y, loc_first_Z),
                                     (loc_mid_tranX, loc_mid_tranY,
                                      loc_mid_tranZ),
                                     (loc_second_X, loc_second_Y, loc_second_Z)
                                     ])
            '''
            Method on reconstruct curve and rename
            '''
            pm.rebuildCurve(curve_path,
                            ch=1,
                            rpo=1,
                            rt=0,
                            end=1,
                            kr=0,
                            kcp=0,
                            kep=1,
                            kt=0,
                            s=intFieldData_num_joint,
                            d=3,
                            tol=0.0001)
            name_curve = pm.rename(
                curve_path,
                '{0}_{1}_ik_spline_curve'.format(textFieldData_ik_spline_name,
                                                 loc_seq))

            pre_joint = ''
            root_joint = ''

            for i in range(0, intFieldData_num_joint):

                user_default_unit = pm.currentUnit(query=True, linear=True)
                pm.currentUnit(linear='cm')
                pm.select(cl=True)
                new_joint = pm.joint()
                mot_path = pm.pathAnimation(new_joint, c=curve_path, fm=True)
                pm.cutKey(mot_path + '.u')
                pm.setAttr(mot_path + '.u',
                           i * (1.0 / (intFieldData_num_joint - 1)))
                pm.delete('{0}.{1}'.format(new_joint, 'tx'), icn=True)
                pm.delete('{0}.{1}'.format(new_joint, 'ty'), icn=True)
                pm.delete('{0}.{1}'.format(new_joint, 'tz'), icn=True)
                pm.currentUnit(linear='{0}'.format(user_default_unit))
                renaming_item = pm.ls(sl=True)

                if i == 0:

                    pre_joint = new_joint
                    root_joint = new_joint
                    pm.rename(
                        renaming_item, '{0}_{1}_{2:02d}_IK_spline_bind'.format(
                            textFieldData_ik_spline_name, loc_seq, i + 1))
                    continue

                elif i == intFieldData_num_joint - 1:

                    pm.rename(
                        renaming_item,
                        '{0}_{1}_{2:02d}_IK_spline_waste'.format(
                            textFieldData_ik_spline_name, loc_seq, i + 1))

                else:

                    pm.rename(
                        renaming_item, '{0}_{1}_{2:02d}_IK_spline_bind'.format(
                            textFieldData_ik_spline_name, loc_seq, i + 1))

                pm.parent(new_joint, pre_joint)
                pre_joint = new_joint

            pm.joint(root_joint,
                     e=True,
                     zso=True,
                     oj='xyz',
                     ch=True,
                     sao='yup')

            stretch_squash_ik_handle = pm.ikHandle(
                sol='ikSplineSolver',
                pcv=False,
                ccv=False,
                c=curve_path,
                roc=True,
                ns=2,
                sj=('{0}_{1}_01_IK_spline_bind'.format(
                    textFieldData_ik_spline_name, loc_seq)),
                ee=('{0}_{1}_{2:02d}_IK_spline_bind'.format(
                    textFieldData_ik_spline_name, loc_seq,
                    intFieldData_num_joint - 1)),
                n='{0}_{1}_IK_spline'.format(textFieldData_ik_spline_name,
                                             loc_seq))

            pre_joint = ''
            root_joint = ''

            for i in range(0, 3):

                user_default_unit = pm.currentUnit(query=True, linear=True)
                pm.currentUnit(linear='cm')
                pm.select(cl=True)
                new_joint = pm.joint()
                mot_path = pm.pathAnimation(new_joint, c=curve_path, fm=True)
                pm.cutKey(mot_path + '.u')
                pm.setAttr(mot_path + '.u', i * (1.0 / 2))
                pm.delete('{0}.{1}'.format(new_joint, 'tx'), icn=True)
                pm.delete('{0}.{1}'.format(new_joint, 'ty'), icn=True)
                pm.delete('{0}.{1}'.format(new_joint, 'tz'), icn=True)
                pm.currentUnit(linear='{0}'.format(user_default_unit))
                renaming_item = pm.ls(sl=True)

                if i == 0:

                    pre_joint = new_joint
                    root_joint = new_joint
                    pm.rename(
                        renaming_item,
                        '{0}_{1}_{2:02d}_IK_spline_joint_ctrl'.format(
                            textFieldData_ik_spline_name, loc_seq, i + 1))

                else:

                    pm.rename(
                        renaming_item,
                        '{0}_{1}_{2:02d}_IK_spline_joint_ctrl'.format(
                            textFieldData_ik_spline_name, loc_seq, i + 1))

                for n in renaming_item:
                    pm.group(em=True, name='empty')
                    pm.parent('empty', n)
                    pm.setAttr('empty.translateX', 0)
                    pm.setAttr('empty.translateY', 0)
                    pm.setAttr('empty.translateZ', 0)
                    pm.setAttr('empty.rotateX', 0)
                    pm.setAttr('empty.rotateY', 0)
                    pm.setAttr('empty.rotateZ', 0)
                    pm.parent('empty', world=True)
                    pm.parent(n, 'empty')

                for n in renaming_item:

                    newname = n.split('_')
                    number_name = len(newname)

                    new_name_first = newname[0] + '_'

                    for i in range(0, number_name):

                        if i > number_name - 3 or i == number_name - 3:

                            new_name = new_name_first
                            print 'naming error'

                            break

                        else:

                            if i < number_name - 3:

                                new_name_second = newname[i + 1] + '_'
                                new_name = new_name_first + new_name_second
                                new_name_first = new_name

                            else:

                                break

                    pm.rename('empty', new_name + 'joint_ctrl_pad')

            stretch_squash_joint_ctrl_grp = pm.group(
                '{0}_{1}_01_IK_spline_joint_ctrl_pad'.format(
                    textFieldData_ik_spline_name, loc_seq),
                '{0}_{1}_02_IK_spline_joint_ctrl_pad'.format(
                    textFieldData_ik_spline_name, loc_seq),
                '{0}_{1}_03_IK_spline_joint_ctrl_pad'.format(
                    textFieldData_ik_spline_name, loc_seq),
                n='{0}_{1}_IK_spline_joint_ctrl_grp'.format(
                    textFieldData_ik_spline_name, loc_seq))

            loc_first_rot = pm.duplicate(loc_first,
                                         n='{0}_{1}_01_rot_loc'.format(
                                             textFieldData_ik_spline_name,
                                             loc_seq))
            loc_mid_rot = pm.duplicate(loc_mid,
                                       n='{0}_{1}_02_rot_loc'.format(
                                           textFieldData_ik_spline_name,
                                           loc_seq))
            loc_second_trans = pm.duplicate(loc_second,
                                            n='{0}_{1}_03_trans_loc'.format(
                                                textFieldData_ik_spline_name,
                                                loc_seq))
            loc_second_rot = pm.duplicate(loc_second,
                                          n='{0}_{1}_03_rot_loc'.format(
                                              textFieldData_ik_spline_name,
                                              loc_seq))

            pm.parent(loc_first_rot, loc_first)
            pm.parent(loc_mid_rot, loc_mid)
            pm.parent(loc_second_rot, loc_second_trans[0])

            pm.select(loc_first, loc_mid, loc_second_trans[0])
            list_loc_trans = pm.ls(sl=True)
            number_loc_trans = len(list_loc_trans)

            for n in list_loc_trans:

                pm.group(em=True, name='empty')
                pm.parent('empty', n)
                pm.setAttr('empty.translateX', 0)
                pm.setAttr('empty.translateY', 0)
                pm.setAttr('empty.translateZ', 0)
                pm.setAttr('empty.rotateX', 0)
                pm.setAttr('empty.rotateY', 0)
                pm.setAttr('empty.rotateZ', 0)
                pm.parent('empty', world=True)
                pm.parent(n, 'empty')

                newname = n.split('_')
                number_name = len(newname)

                new_name_first = newname[0] + '_'

                for i in range(0, number_name):

                    if i > number_name - 1 or i == number_name - 1:

                        new_name = new_name_first
                        print 'naming error'

                        break

                    else:

                        if i < number_name - 1:

                            new_name_second = newname[i + 1] + '_'
                            new_name = new_name_first + new_name_second
                            new_name_first = new_name

                        else:

                            break

                pm.rename('empty', new_name + 'pad')

            pm.parent(
                '{0}_{1}_01_trans_loc_pad'.format(textFieldData_ik_spline_name,
                                                  loc_seq),
                '{0}_{1}_02_trans_loc_pad'.format(textFieldData_ik_spline_name,
                                                  loc_seq),
                '{0}_{1}_03_trans_loc_pad'.format(textFieldData_ik_spline_name,
                                                  loc_seq),
                '{0}_{1}_IK_spline_loc_grp'.format(
                    textFieldData_ik_spline_name, loc_seq))

            pm.aimConstraint(loc_first, loc_mid_rot)
            pm.aimConstraint(loc_mid, loc_first_rot)
            pm.aimConstraint(loc_mid, loc_second_rot)
            pm.pointConstraint(loc_first, loc_second_trans[0],
                               (loc_mid + '_pad'))

            pm.pointConstraint(loc_first,
                               '{0}_{1}_01_IK_spline_joint_ctrl'.format(
                                   textFieldData_ik_spline_name, loc_seq),
                               mo=True)
            pm.pointConstraint(loc_mid,
                               '{0}_{1}_02_IK_spline_joint_ctrl'.format(
                                   textFieldData_ik_spline_name, loc_seq),
                               mo=True)
            pm.pointConstraint(loc_second_trans[0],
                               '{0}_{1}_03_IK_spline_joint_ctrl'.format(
                                   textFieldData_ik_spline_name, loc_seq),
                               mo=True)
            pm.orientConstraint(loc_first_rot,
                                '{0}_{1}_01_IK_spline_joint_ctrl'.format(
                                    textFieldData_ik_spline_name, loc_seq),
                                mo=True)
            pm.orientConstraint(loc_mid_rot,
                                '{0}_{1}_02_IK_spline_joint_ctrl'.format(
                                    textFieldData_ik_spline_name, loc_seq),
                                mo=True)
            pm.orientConstraint(loc_second_rot,
                                '{0}_{1}_03_IK_spline_joint_ctrl'.format(
                                    textFieldData_ik_spline_name, loc_seq),
                                mo=True)

            curve_length_node = pm.createNode('curveInfo',
                                              n='{0}curve_length_{1}'.format(
                                                  new_name, loc_seq))
            pm.connectAttr('{0}.worldSpace[0]'.format(curve_path),
                           '{0}.inputCurve'.format(curve_length_node))
            curve_arc_length = pm.getAttr(
                '{0}.arcLength'.format(curve_length_node))

            ratio_curve_stretch = pm.createNode(
                'multiplyDivide',
                n='{0}ratio_curve_stretch_{1}'.format(new_name, loc_seq))
            pm.setAttr('{0}.operation'.format(ratio_curve_stretch), 2)
            pm.connectAttr('{0}.arcLength'.format(curve_length_node),
                           '{0}.input1X'.format(ratio_curve_stretch))
            pm.setAttr('{0}.input2X'.format(ratio_curve_stretch),
                       curve_arc_length)

            ratio_curve_squash = pm.createNode(
                'multiplyDivide',
                n='{0}ratio_curve_squash_{1}'.format(new_name, loc_seq))
            pm.setAttr('{0}.operation'.format(ratio_curve_squash), 2)
            pm.connectAttr('{0}.arcLength'.format(curve_length_node),
                           '{0}.input2X'.format(ratio_curve_squash))
            pm.setAttr('{0}.input1X'.format(ratio_curve_squash),
                       curve_arc_length)

            exp_squash = pm.createNode('multiplyDivide',
                                       n='{0}exp_squash_{1}'.format(
                                           new_name, loc_seq))
            pm.setAttr('{0}.operation'.format(exp_squash), 2)
            pm.setAttr('{0}.input2X'.format(exp_squash),
                       intFieldData_num_joint - 1)

            for number_joint in range(0, intFieldData_num_joint - 1):

                pm.connectAttr(
                    '{0}.outputX'.format(ratio_curve_stretch),
                    '{0}_{1}_{2:02d}_IK_spline_bind.scaleX'.format(
                        textFieldData_ik_spline_name, loc_seq,
                        number_joint + 1))

                exp_squash_plus = pm.createNode(
                    'plusMinusAverage',
                    n='{0}exp_squash_plus_0{1}_{2}'.format(
                        new_name, number_joint + 1, loc_seq))
                pm.setAttr('{0}.input1D[0]'.format(exp_squash_plus), 1)

                if number_joint < (intFieldData_num_joint / 2):

                    pm.setAttr('{0}.operation'.format(exp_squash_plus), 1)

                else:

                    pm.setAttr('{0}.operation'.format(exp_squash_plus), 2)

                if number_joint == 0:

                    print 'do nothing'

                elif number_joint > 0:

                    pm.connectAttr('{0}.outputX'.format(exp_squash),
                                   '{0}.input1D[1]'.format(exp_squash_plus))
                    pm.connectAttr(
                        '{0}exp_squash_plus_0{1}_{2}.output1D'.format(
                            new_name, number_joint, loc_seq),
                        '{0}.input1D[0]'.format(exp_squash_plus))

                power_curve_squash = pm.createNode(
                    'multiplyDivide',
                    n='{0}power_curve_squash_0{1}_{2}'.format(
                        new_name, number_joint + 1, loc_seq))
                pm.setAttr('{0}.operation'.format(power_curve_squash), 3)
                pm.connectAttr('{0}.outputX'.format(ratio_curve_squash),
                               '{0}.input1X'.format(power_curve_squash))
                pm.connectAttr('{0}.output1D'.format(exp_squash_plus),
                               '{0}.input2X'.format(power_curve_squash))

                pm.connectAttr(
                    '{0}.outputX'.format(power_curve_squash),
                    '{0}_{1}_{2:02d}_IK_spline_bind.scaleY'.format(
                        textFieldData_ik_spline_name, loc_seq,
                        number_joint + 1))
                pm.connectAttr(
                    '{0}.outputX'.format(power_curve_squash),
                    '{0}_{1}_{2:02d}_IK_spline_bind.scaleZ'.format(
                        textFieldData_ik_spline_name, loc_seq,
                        number_joint + 1))

            pm.skinCluster(
                '{0}_{1}_01_IK_spline_joint_ctrl'.format(
                    textFieldData_ik_spline_name,
                    loc_seq), '{0}_{1}_02_IK_spline_joint_ctrl'.format(
                        textFieldData_ik_spline_name,
                        loc_seq), '{0}_{1}_03_IK_spline_joint_ctrl'.format(
                            textFieldData_ik_spline_name, loc_seq),
                '{0}_{1}_ik_spline_curve'.format(textFieldData_ik_spline_name,
                                                 loc_seq))

            pm.parent(curve_path, 'IK_spline_stretch_squash_curve_grp')
            pm.parent(
                '{0}_{1}_01_IK_spline_bind'.format(
                    textFieldData_ik_spline_name, loc_seq),
                'IK_spline_stretch_squash_bind_grp')
            pm.parent(
                '{0}_{1}_IK_spline'.format(textFieldData_ik_spline_name,
                                           loc_seq),
                'IK_spline_stretch_squash_IK_handle_grp')
            pm.parent(stretch_squash_joint_ctrl_grp,
                      'IK_spline_stretch_squash_joint_ctrl_grp')
コード例 #41
0
    def ui(self):
        template = pm.uiTemplate('ExampleTemplate', force=True)
        template.define(pm.button, width=200, height=25)
        template.define(pm.frameLayout,
                        borderVisible=False,
                        labelVisible=False)

        with template:
            with pm.formLayout():
                pm.dockControl("adb_Module", content=self.win, a="left")
                with pm.columnLayout(adj=True, rs=1):
                    with pm.columnLayout(adj=True, rs=4):
                        self.docString = pm.checkBox(l='Doc String')
                    with pm.frameLayout(cll=True,
                                        bgc=(0.202, 0.202, 0.202),
                                        labelVisible=True,
                                        cl=False,
                                        label="INFORMATION"):
                        with pm.columnLayout(adj=True, rs=4):
                            pm.button(label="Print List",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(adb.List))
                            pm.button(label="Print Type",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.Type))
                            pm.button(label="Print Type PyMel",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.TypePymel))

                    with pm.frameLayout(cll=True,
                                        bgc=(0.202, 0.202, 0.202),
                                        labelVisible=True,
                                        cl=False,
                                        label="RIGGING"):
                        with pm.columnLayout(adj=True, rs=4):
                            pm.button(label="Pv Guide",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self._pvGuide))
                            pm.button(label="Find Constraint Driver",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.consDriver))
                            pm.button(label="Find Constraint Target",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.consTarget))
                            pm.button(label="DrivenKeys to Remap Value",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.DkToRv))
                            pm.button(label="Rivet From Face",
                                      backgroundColor=colordic['grey1'],
                                      c=lambda *args: adbRivet.
                                      rivet_from_faces(scale=0.2))
                            pm.button(label="Sticky From Face",
                                      backgroundColor=colordic['grey1'],
                                      c=lambda *args: adbRivet.
                                      sticky_from_faces(scale=0.2))

                            def proxyPlane(axis):
                                if axis == "                       - X AXIS -":
                                    adbProxy.plane_proxy(
                                        pm.selected(), 'proxy_plane', 'x')
                                elif axis == "                       - Y AXIS -":
                                    adbProxy.plane_proxy(
                                        pm.selected(), 'proxy_plane', 'y')
                                elif axis == "                       - Z AXIS -":
                                    adbProxy.plane_proxy(
                                        pm.selected(), 'proxy_plane', 'z')
                                elif axis == "               - Create Proxy Plane -":
                                    pass
                                else:
                                    pm.warning('Choice None Existant')

                            pm.optionMenu(w=200, h=30, cc=proxyPlane)
                            pm.menuItem(
                                label="               - Create Proxy Plane -")
                            pm.menuItem(
                                label="                       - X AXIS -")
                            pm.menuItem(
                                label="                       - Y AXIS -")
                            pm.menuItem(
                                label="                       - Z AXIS -")

                            def mirrorChoice(axis):
                                if axis == "                       - X AXIS -":
                                    adbTransform.Transform(
                                        pm.selected()).mirror(axis='x')
                                elif axis == "                       - Y AXIS -":
                                    adbTransform.Transform(
                                        pm.selected()).mirror(axis='y')
                                elif axis == "                       - Z AXIS -":
                                    adbTransform.Transform(
                                        pm.selected()).mirror(axis='z')
                                elif axis == "               - Choose Axis Mirror -":
                                    pass
                                else:
                                    pm.warning('Choice None Existant')

                            pm.optionMenu(w=200, h=30, cc=mirrorChoice)
                            pm.menuItem(
                                label="               - Choose Axis Mirror -")
                            pm.menuItem(
                                label="                       - X AXIS -")
                            pm.menuItem(
                                label="                       - Y AXIS -")
                            pm.menuItem(
                                label="                       - Z AXIS -")

                        with pm.rowLayout(adj=True, numberOfColumns=2):
                            pm.button(label="Get Node Type",
                                      backgroundColor=colordic['green3'],
                                      c=pm.Callback(self.NodeType),
                                      w=20,
                                      h=25)
                            self.nodeName = pm.textField(
                                pht="Name the animation node",
                                tx='animCurve',
                            )
                        with pm.columnLayout(adj=True, rs=4):
                            pm.button(label="DrivenKeys to Remap Value",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self.DkToRv))

                        pm.separator(h=2)

                        with pm.rowLayout(adj=True, numberOfColumns=1):
                            pm.text(
                                label="Follicules Options",
                                h=20,
                            )

                        with pm.rowLayout(adj=True, numberOfColumns=4):
                            pm.text(label="Number")
                            self.folli = pm.floatField(v=5,
                                                       precision=1,
                                                       showTrailingZeros=0)
                            pm.text(label=" Radius ")
                            self.radius = pm.floatField(v=1,
                                                        precision=2,
                                                        showTrailingZeros=0)

                        self.folli_ctrl = pm.checkBox(l='With Controls',
                                                      v=True)
                        pm.button(label="Create Follicules",
                                  backgroundColor=colordic['grey1'],
                                  c=pm.Callback(self.Folli))
                        pm.button(label="Add Controls",
                                  backgroundColor=colordic['grey1'],
                                  c=pm.Callback(self._addControls))

                    with pm.frameLayout(cll=True,
                                        bgc=(0.202, 0.202, 0.202),
                                        labelVisible=True,
                                        cl=False,
                                        label="OUTPUT WINDOW"):
                        with pm.columnLayout(adj=True, rs=5):
                            pm.text(label="Output Window", h=20)
                            self.outputWin = pm.textScrollList(w=150, h=60)
                            pm.button(
                                label="Refresh",
                                backgroundColor=colordic['grey2'],
                                c=lambda *args: pm.textScrollList(
                                    self.outputWin, edit=True, removeAll=True),
                                h=25)

                    with pm.frameLayout(cll=True,
                                        bgc=(0.202, 0.202, 0.202),
                                        labelVisible=True,
                                        cl=False,
                                        label="SKINNING"):
                        with pm.columnLayout(adj=True, rs=4):
                            pm.button(label="Reset Skin",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(adb.resetSkin))
                            pm.button(label="Replace Lattice",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(
                                          adb.find_and_replace_lattices))
                            pm.button(label="Blend Two Groups",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self._blend2grps))
                            pm.button(label="Wrap",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self._wrap))
                            pm.button(label="Wrap SetUp",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self._wrapSetup))

                    with pm.frameLayout(cll=True,
                                        bgc=(0.202, 0.202, 0.202),
                                        labelVisible=True,
                                        cl=False,
                                        label="CONTROLS"):
                        with pm.columnLayout(adj=True, rs=4):
                            pm.button(label="Get Curve Information",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(adb.GetCurveShape))
                            pm.button(label="Combine Shapes",
                                      backgroundColor=colordic['grey1'],
                                      c=lambda *agrs: adb.CombineShape(
                                          oNurbs=pm.selected()))
                            pm.button(label="Replace Shape",
                                      backgroundColor=colordic['grey1'],
                                      c=pm.Callback(self._ReplaceShape))
コード例 #42
0
    def build(self):
        """Constructs gui
        """
        if pm.window('goz', exists=True):
            pm.deleteUI('goz', window=True)

        self.gui_window = pm.window('goz',
                                    title="gozbruh",
                                    rtf=True,
                                    width=1000,
                                    height=700)

        pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

        main_layout = pm.frameLayout(label='gozbruh Options', cll=False)
        pm.setParent(main_layout)
        #======================================================================
        # GENERAL
        #======================================================================
        #########SHARED
        pm.setParent(main_layout)
        general_framelayout = pm.frameLayout(label='General Options',
                                             cll=False)
        pm.setParent(general_framelayout)

        general_rcl = pm.rowColumnLayout(nc=2)
        pm.setParent(general_rcl)
        pm.text(label='Shared Dir\t')
        self.user_shared_dir = pm.textField(text=utils.get_shared_dir(),
                                            width=200)

        #======================================================================
        # SERVER
        #======================================================================
        pm.setParent(main_layout)
        #########ZBRUSH
        zbrush_layout = pm.frameLayout(label='ZBrush', cll=False)
        pm.setParent(zbrush_layout)
        zbrush_rcl = pm.rowColumnLayout(nc=2)
        zbrush_host, zbrush_port = utils.get_net_info(utils.ZBRUSH_ENV)
        pm.text(label='ZBrush Host\t')
        self.user_zbrush_host = pm.textField(text=zbrush_host, width=200)
        pm.text(label='ZBrush Port\t')
        self.user_zbrush_port = pm.textField(text=zbrush_port, width=200)

        pm.setParent(zbrush_layout)
        self.send_btn = pm.button(label="Send Selection to ZBrush")
        self.conn_btn = pm.button(label="Check Connection to ZBrush")
        self.zbrush_status_ui = pm.text(label='Status: not connected',
                                        height=30,
                                        enableBackground=True,
                                        backgroundColor=(1.0, 0.0, 0.0))

        #########MAYA
        pm.setParent(main_layout)
        pm.text(' ')
        maya_layout = pm.frameLayout(label='Maya', cll=False)
        pm.setParent(maya_layout)
        maya_rcl = pm.rowColumnLayout(nc=2)
        maya_host, maya_port = utils.get_net_info(utils.MAYA_ENV)
        pm.text(label='Maya Host\t')
        self.user_maya_host = pm.textField(text=maya_host, width=200)
        pm.text(label='Maya Port\t')
        self.user_maya_port = pm.textField(text=maya_port, width=200)

        pm.setParent(maya_layout)
        self.listen_btn = pm.button(label="Listen for Meshes from ZBrush")
        self.maya_status_ui = pm.text(label='Status: not listening',
                                      height=30,
                                      enableBackground=True,
                                      backgroundColor=(1.0, 0.0, 0.0))

        #======================================================================
        # MORE OPTIONS
        #======================================================================
        pm.setParent(main_layout)
        pm.text(' ')
        more_framelayout = pm.frameLayout(label='Maya-Specific Options',
                                          cll=False)
        pm.setParent(more_framelayout)
        more_rcl = pm.rowColumnLayout(nc=3)
        pm.text(label='Import Visual Smooth', width=200)
        self.smooth_radio_col = pm.radioCollection()
        self.smooth_radio_off = pm.radioButton(
            label='Off', onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 0)))
        self.smooth_radio_on = pm.radioButton(
            label='On', onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 1)))
        import_smooth = 0
        if pm.optionVar(ex='gozbruh_smooth'):
            import_smooth = pm.optionVar(q='gozbruh_smooth')
        pm.radioCollection(self.smooth_radio_col,
                           e=True,
                           sl=self.smooth_radio_on
                           if import_smooth else self.smooth_radio_off)

        pm.text(label='Import Delete Old Mesh', width=200)
        self.delete_radio_col = pm.radioCollection()
        self.delete_radio_off = pm.radioButton(
            label='Off', onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 0)))
        self.delete_radio_on = pm.radioButton(
            label='On', onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 1)))
        import_delete = 0
        if pm.optionVar(ex='gozbruh_delete'):
            import_delete = pm.optionVar(q='gozbruh_delete')
        pm.radioCollection(self.delete_radio_col,
                           e=True,
                           sl=self.delete_radio_on
                           if import_delete else self.delete_radio_off)

        pm.setParent(main_layout)
        self.retain_btn = pm.button(label="Save Settings", height=50)
        pm.text('\t')
        self.remove_btn = pm.button(label="Default Settings")

        self.gui_window.show()
コード例 #43
0
ファイル: Disperser.py プロジェクト: sundae24/Maya
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,
                           cal=[(1, 'right')],
                           cw=[(1, 80), (2, 200), (3, 100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ',
                                       v=10,
                                       cw3=[80, 80, 220],
                                       min=1,
                                       max=500,
                                       fmx=5000,
                                       f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1, 'right')], cw=[(1, 80), (2, 300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(
            l='Random',
            onc=lambda *args: self.rotationRange.setEnable(True),
            ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ',
                                              nf=3,
                                              v1=30,
                                              v2=30,
                                              v3=30,
                                              cw4=[80, 100, 100, 100],
                                              en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1, 'right')], cw=[(1, 80), (2, 300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(
            l='Random',
            onc=lambda *args: self.scaleRange.setEnable(True),
            ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent('..')
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ',
                                           nf=2,
                                           v1=1,
                                           v2=1,
                                           cw3=[80, 100, 100],
                                           en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
コード例 #44
0
    def launch(self, *args, **kwargs):
        """launch renderer command
        """
        # do nothing if there is no window (called externally)
        if not self.window:
            return

        # warn the user about the ignore settings
        try:
            dAO = pm.PyNode('defaultArnoldRenderOptions')

            ignore_attrs = [
                'ignoreSubdivision', 'ignoreDisplacement', 'ignoreBump',
                'ignoreMotionBlur'
            ]

            attr_values = [(attr, dAO.getAttr(attr)) for attr in ignore_attrs
                           if dAO.getAttr(attr) is True]

            if any(attr_values):
                msg_text = '<br>'.join(
                    map(lambda x: '%s: %s' % (x[0], x[1]), attr_values))

                response = pm.confirmDialog(
                    title='Ignore These Settings?',
                    message=
                    'You have ignored:<br><br>%s<br><br><b>Is that ok?</b>' %
                    msg_text,
                    button=['Yes', 'No'],
                    defaultButton='No',
                    cancelButton='No',
                    dismissString='No')

                if response == 'No':
                    return
        except pm.MayaNodeError:
            # no Arnold
            pass

        # check if rendering with persp camera
        try:
            wrong_camera_names = [
                'perspShape',
                'topShape',
                'sideShape',
                'fontShape',
                'persp1Shape',
                'perspShape1',
            ]
            renderable_cameras = [
                node for node in pm.ls(type='camera')
                if node.getAttr('renderable')
            ]
            if any(
                    map(lambda x: x.name() in wrong_camera_names,
                        renderable_cameras)):
                response = pm.confirmDialog(
                    title='Rendering with Persp?',
                    message=
                    'You are rendering with <b>Persp Camera<b><br><br>Is that ok?</b>',
                    button=['Yes', 'No'],
                    defaultButton='No',
                    cancelButton='No',
                    dismissString='No')

                if response == 'No':
                    return

            if len(renderable_cameras) > 1:
                response = pm.confirmDialog(
                    title='Rendering more than one Camera?',
                    message=
                    'You are rendering <b>more than one camera<b><br><br>Is that ok?</b>',
                    button=['Yes', 'No'],
                    defaultButton='No',
                    cancelButton='No',
                    dismissString='No')

                if response == 'No':
                    return
            elif len(renderable_cameras) == 0:
                pm.confirmDialog(
                    title='No <b>Renderable</b> camera!!!',
                    message='There is no <b>renderable camera<b>!!!',
                    button=['Ok'],
                    defaultButton='Ok',
                    cancelButton='Ok',
                    dismissString='Ok')
                return

        except pm.MayaNodeError:
            # no default render globals node
            pass

        drg = pm.PyNode('defaultRenderGlobals')
        render_engine = drg.getAttr('currentRenderer')
        # RENDERER SPECIFIC CHECKS

        if render_engine == 'redshift':
            # if the renderer is RedShift
            # check if unifiedDisableDivision is 1 which will take too much time
            # to render
            dro = pm.PyNode('redshiftOptions')
            if dro.unifiedDisableDivision.get() == 1:
                response = pm.confirmDialog(
                    title=
                    "Enabled **Don't Automatically Reduce Samples of Other Effects**",
                    message=
                    'It is not allowed to render with the following option is enabled:<br>'
                    '<br>'
                    "Don't Automatically Reduce Samples of Other Effects: Enabled<br>"
                    "<br>"
                    "Please DISABLE it!",
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            # Check dome light backgrounds
            domes_to_fix = []
            rs_domes = pm.ls(type='RedshiftDomeLight')
            if rs_domes:
                for rs_dome in rs_domes:
                    if rs_dome.getAttr('background_enable') == 1 \
                       or rs_dome.getAttr('backPlateEnabled') == 1:
                        domes_to_fix.append(rs_dome.name())

            if domes_to_fix:
                message = 'Some DomeLights have <b>BackGround Render ' \
                          'Enabled</b>:' \
                          '<br><br>%s<br><br>' \
                          'Are you Sure?' % '<br>'.join(domes_to_fix)

                response = pm.confirmDialog(
                    title='Dome Lights with Background Enabled?',
                    message=message,
                    button=['Yes', 'No'],
                    defaultButton='No',
                    cancelButton='No',
                    dismissString='No')
                if response == 'No':
                    return

            # abort on license fail
            dro.abortOnLicenseFail.set(1)

        elif render_engine == 'arnold':
            # check if the samples are too high
            dAO = pm.PyNode('defaultArnoldRenderOptions')

            aa_samples = dAO.AASamples.get()
            diff_samples = dAO.GIDiffuseSamples.get()
            try:
                glossy_samples = dAO.GIGlossySamples.get()
            except AttributeError:
                glossy_samples = dAO.GISpecularSamples.get()
            if int(pm.about(v=1)) >= 2017:
                sss_samples = dAO.GISssSamples.get()
            else:
                sss_samples = dAO.sssBssrdfSamples.get()

            total_diff_samples = aa_samples**2 * diff_samples**2
            total_glossy_samples = aa_samples**2 * glossy_samples**2
            total_sss_samples = aa_samples**2 * sss_samples**2

            max_allowed_diff_samples = 225
            max_allowed_glossy_samples = 100
            max_allowed_sss_samples = 800

            if total_diff_samples > max_allowed_diff_samples:
                pm.confirmDialog(
                    title="Too Much Diffuse Samples!!!",
                    message='You are using too much DIFFUSE SAMPLES (>%s)<br>'
                    '<br>'
                    'Please either reduce AA samples of Diffuse '
                    'Samples!!!' % max_allowed_diff_samples,
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            if total_glossy_samples > max_allowed_glossy_samples:
                pm.confirmDialog(
                    title="Too Much Glossy Samples!!!",
                    message='You are using too much GLOSSY SAMPLES (>%s)<br>'
                    '<br>'
                    'Please either reduce AA samples of Glossy '
                    'Samples!!!' % max_allowed_glossy_samples,
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            if total_sss_samples > max_allowed_sss_samples:
                pm.confirmDialog(
                    title="Too Much SSS Samples!!!",
                    message='You are using too much SSS SAMPLES (>%s)<br>'
                    '<br>'
                    'Please either reduce AA samples of SSS '
                    'Samples!!!' % max_allowed_sss_samples,
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            # check Light Samples
            # check point lights with zero radius but more than one samples
            all_point_lights = pm.ls(type='pointLight')
            ridiculous_point_lights = []
            for point_light in all_point_lights:
                if point_light.aiRadius.get(
                ) < 0.1 and point_light.aiSamples.get() > 1:
                    ridiculous_point_lights.append(point_light)

            if ridiculous_point_lights:
                pm.confirmDialog(
                    title="Unnecessary Samples on Point Lights!!!",
                    message='You are using too much SAMPLES (>1)<br>'
                    '<br>'
                    'on <b>Point lights with zero radius</b><br>'
                    '<br>'
                    'Please reduce the samples to 1',
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            # Check area lights with more than 2 samples
            all_area_lights = pm.ls(type=['areaLight', 'aiAreaLight'])
            ridiculous_area_lights = []
            for area_light in all_area_lights:
                if area_light.aiSamples.get() > 2:
                    ridiculous_area_lights.append(area_light)

            if ridiculous_area_lights:
                pm.confirmDialog(
                    title="Unnecessary Samples on Area Lights!!!",
                    message='You are using too much SAMPLES (>2) on<br>'
                    '<br>'
                    '<b>Area Lights</b><br>'
                    '<br>'
                    'Please reduce the samples to 2',
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

            # Check directional lights with angle == 0 and samples > 1
            all_directional_lights = pm.ls(type='directionalLight')
            ridiculous_directional_lights = []
            dir_sample_attr_name = 'aiSamples'
            # if pm.about(v=1) == "2014":
            #     dir_sample_attr_name = 'aiSamples'

            for directional_light in all_directional_lights:
                if directional_light.aiAngle.get(
                ) == 0 and directional_light.attr(
                        dir_sample_attr_name).get() > 1:
                    ridiculous_directional_lights.append(directional_light)

            if ridiculous_directional_lights:
                pm.confirmDialog(
                    title="Unnecessary Samples on Directional Lights!!!",
                    message='You are using too much SAMPLES (>1) on <br>'
                    '<br>'
                    '<b>Directional lights with zero angle</b><br>'
                    '<br>'
                    'Please reduce the samples to 1',
                    button=['OK'],
                    defaultButton='OK',
                    cancelButton='OK',
                    dismissString='OK')
                return

        # get values
        start_frame = pm.intField('cgru_afanasy__start_frame', q=1, v=1)
        end_frame = pm.intField('cgru_afanasy__end_frame', q=1, v=1)
        frames_per_task = \
            pm.intField('cgru_afanasy__frames_per_task', q=1, v=1)
        by_frame = pm.intField('cgru_afanasy__by_frame', q=1, v=1)
        depend_mask_global = pm.textField('cgru_afanasy__depend_mask_global',
                                          q=1,
                                          text=True)
        hosts_mask = pm.textField('cgru_afanasy__hosts_mask', q=1, text=True)
        hosts_exclude = pm.textField('cgru_afanasy__hosts_exclude',
                                     q=1,
                                     text=True)
        separate_layers = \
            pm.radioButtonGrp('cgru_afanasy__separate_layers', q=1, sl=1)
        pause = pm.checkBox('cgru_afanasy__paused', q=1, v=1)
        life_time = pm.intField('cgru_afanasy__life_time', q=1, v=1)
        annotation = pm.textField('cgru_afanasy__annotation', q=1, text=True)
        submit_multiple_times = pm.intField(
            'cgru_afanasy__submit_multiple_times', q=1, v=1)
        errors_avoid_host = pm.intField('cgru_afanasy__errors_avoid_host',
                                        q=1,
                                        v=1)
        errors_retries = pm.intField('cgru_afanasy__errors_retries', q=1, v=1)
        errors_task_same_host = pm.intField(
            'cgru_afanasy__errors_task_same_host', q=1, v=1)
        errors_forgive_time = pm.intField('cgru_afanasy__errors_forgive_time',
                                          q=1,
                                          v=1)

        # check values
        if start_frame > end_frame:
            temp = end_frame
            end_frame = start_frame
            start_frame = temp

        frames_per_task = max(1, frames_per_task)
        by_frame = max(1, by_frame)

        # store without quota sign
        depend_mask_global = depend_mask_global.replace('"', '')
        hosts_mask = hosts_mask.replace('"', '')
        hosts_exclude = hosts_exclude.replace('"', '')

        # store field values
        pm.optionVar['cgru_afanasy__start_frame_ov'] = start_frame
        pm.optionVar['cgru_afanasy__end_frame_ov'] = end_frame
        pm.optionVar['cgru_afanasy__frames_per_task_ov'] = frames_per_task
        pm.optionVar['cgru_afanasy__by_frame_ov'] = by_frame
        pm.optionVar['cgru_afanasy__depend_mask_global_ov'] = \
            depend_mask_global
        pm.optionVar['cgru_afanasy__hosts_mask_ov'] = hosts_mask
        pm.optionVar['cgru_afanasy__hosts_exclude_ov'] = hosts_exclude
        pm.optionVar['cgru_afanasy__separate_layers_ov'] = separate_layers
        pm.optionVar['cgru_afanasy__life_time_ov'] = life_time
        pm.optionVar['cgru_afanasy__annotation_ov'] = annotation

        pm.optionVar[
            'cgru_afanasy__submit_multiple_times_ov'] = submit_multiple_times
        pm.optionVar['cgru_afanasy__errors_avoid_host_ov'] = errors_avoid_host
        pm.optionVar['cgru_afanasy__errors_retries_ov'] = errors_retries
        pm.optionVar[
            'cgru_afanasy__errors_task_same_host_ov'] = errors_task_same_host
        pm.optionVar[
            'cgru_afanasy__errors_errors_forgive_time_ov'] = errors_forgive_time

        # get paths
        scene_name = pm.sceneName()
        datetime = '%s%s' % (time.strftime('%y%m%d-%H%M%S-'),
                             str(time.time() - int(time.time()))[2:5])

        filename = '%s.%s.mb' % (scene_name, datetime)

        project_path = pm.workspace(q=1, rootDirectory=1)

        # outputs = \
        #     pm.renderSettings(fullPath=1, firstImageName=1, lastImageName=1)

        # get output paths, set the RenderPass token to Beauty,
        # this will at least guarantee to get something
        outputs = \
            pm.renderSettings(
                fullPath=1, firstImageName=1, lastImageName=1,
                leaveUnmatchedTokens=1, customTokenString="RenderPass=Beauty"
            )

        # job_name = os.path.basename(scene_name)
        job_name = self.generate_job_name()

        logger.debug('%ss %se %sr' % (start_frame, end_frame, by_frame))
        logger.debug('scene                 = %s' % scene_name)
        logger.debug('file                  = %s' % filename)
        logger.debug('job_name              = %s' % job_name)
        logger.debug('project_path          = %s' % project_path)
        logger.debug('outputs               = %s' % outputs)
        logger.debug('annotation            = %s' % annotation)
        logger.debug('separate_layers       = %s' % separate_layers)
        logger.debug('errors_avoid_host     = %s' % errors_avoid_host)
        logger.debug('errors_retries        = %s' % errors_retries)
        logger.debug('errors_task_same_host = %s' % errors_task_same_host)
        logger.debug('errors_forgive_time   = %s' % errors_forgive_time)

        if pm.checkBox('cgru_afanasy__close', q=1, v=1):
            pm.deleteUI(self.window)

        stored_log_level = None
        if render_engine == 'arnold':
            # set the verbosity level to warning+info
            aro = pm.PyNode('defaultArnoldRenderOptions')
            stored_log_level = aro.getAttr('log_verbosity')
            aro.setAttr('log_verbosity', 2)
            # set output to console
            aro.setAttr("log_to_console", 1)
        elif render_engine == 'redshift':
            # set the verbosity level to detailed+info
            redshift = pm.PyNode('redshiftOptions')
            stored_log_level = redshift.logLevel.get()
            redshift.logLevel.set(2)

        # save file
        pm.saveAs(filename, force=1, type='mayaBinary')

        # rename back to original name
        pm.renameFile(scene_name)

        # create the render command
        mrc = MayaRenderCommandBuilder(name=job_name,
                                       file_full_path=filename,
                                       render_engine=render_engine,
                                       project=project_path,
                                       by_frame=by_frame)

        # submit renders
        jobs = []
        blocks = []

        #
        # separate_layers:
        # 1 -> None  -> submit one job with a single block with all layers
        # 2 -> Block -> submit one job with multiple blocks
        # 3 -> Job   -> submit multiple jobs with a single block per layer
        #
        if separate_layers in [1, 2]:
            job = af.Job(job_name)
            jobs.append(job)

        if separate_layers in [2, 3]:
            # render each layer separately
            rlm = pm.PyNode('renderLayerManager')
            layers = [
                layer for layer in rlm.connections() if layer.renderable.get()
            ]

            for layer in layers:
                mrc_layer = copy.copy(mrc)
                layer_name = layer.name()
                mrc_layer.name = layer_name
                mrc_layer.render_layer = layer_name

                # create a new block for this layer
                block = af.Block(
                    layer_name,
                    renderer_to_block_type.get(render_engine, 'maya'))

                # Fix the output path for this layer
                # by replacing the "masterLayer" with the layer name
                # without rs_ at the beginning
                layer_outputs = outputs
                if layer_name != 'defaultRenderLayer':
                    layer_outputs[0] = outputs[0].replace(
                        'masterLayer', layer_name.replace('rs_', ''))
                    layer_outputs[1] = outputs[1].replace(
                        'masterLayer', layer_name.replace('rs_', ''))

                outputs_split = afcommon.patternFromDigits(
                    afcommon.patternFromStdC(
                        afcommon.patternFromPaths(
                            layer_outputs[0], layer_outputs[1]))).split(';')

                block.setFiles(outputs_split)

                block.setNumeric(start_frame, end_frame, frames_per_task,
                                 by_frame)
                command = mrc_layer.build_command()

                block.setErrorsAvoidHost(errors_avoid_host)
                block.setErrorsRetries(errors_retries)
                block.setErrorsTaskSameHost(errors_task_same_host)
                block.setErrorsForgiveTime(errors_forgive_time)

                block.setCommand(command)

                if separate_layers == 2:
                    blocks.append(block)
                else:
                    job = af.Job('%s - %s' % (job_name, layer_name))
                    # add blocks
                    job.blocks = [block]
                    jobs.append(job)

        else:
            # create only one block
            block = af.Block('All Layers',
                             renderer_to_block_type.get(render_engine, 'maya'))

            block.setFiles(
                afcommon.patternFromDigits(
                    afcommon.patternFromStdC(
                        afcommon.patternFromPaths(outputs[0],
                                                  outputs[1]))).split(';'))
            block.setNumeric(start_frame, end_frame, frames_per_task, by_frame)
            command = mrc.build_command()
            block.setCommand(command)

            blocks.append(block)

        for job in jobs:
            job.setAnnotation(annotation)
            job.setFolder('input', os.path.dirname(filename))
            job.setFolder('output', os.path.dirname(outputs[0]))
            job.setDependMaskGlobal(depend_mask_global)
            job.setHostsMask(hosts_mask)
            job.setHostsMaskExclude(hosts_exclude)
            if life_time > 0:
                job.setTimeLife(life_time * 3600)
            else:
                job.setTimeLife(240 * 3600)

            job.setCmdPost('deletefiles -s "%s"' % os.path.abspath(filename))
            if pause:
                job.offline()

            # add blocks
            if separate_layers in [1, 2]:
                job.blocks.extend(blocks)

            for i in range(submit_multiple_times):
                orig_job_name = job.data['name']
                job.setName('%s - %03i' % (orig_job_name, i + 1))
                status, data = job.send()

                # restore job name
                job.setName(orig_job_name)
                if not status:
                    pm.PopupError('Something went wrong!')

        # restore log level
        if render_engine == 'arnold':
            aro = pm.PyNode('defaultArnoldRenderOptions')
            aro.setAttr('log_verbosity', stored_log_level)
            # disable set output to console
            aro.setAttr("log_to_console", 0)
        elif render_engine == 'redshift':
            redshift = pm.PyNode('redshiftOptions')
            redshift.logLevel.set(stored_log_level)

            # disable abort on license fail
            redshift.abortOnLicenseFail.set(0)
コード例 #45
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
def _build_fk_tab(parent_layout):
    # Create column Layout with embedded shelf layout in second tab
    fk_tab_layout = pm.columnLayout('fkTab', adjustableColumn=True)

    pm.separator(height=5, style='none')

    pm.gridLayout(numberOfColumns=3,
                  numberOfRows=2,
                  cellWidth=72,
                  cellHeight=44)

    cmd_str = ('import pymel.core as pm; ' \
               'import mimic_utils; ' \
               'pm.setFocus("fkTab");')

    for i in range(6):
        axis = i + 1
        sel_cmd_str = cmd_str + ' mimic_utils.select_fk_axis_handle({})' \
            .format(axis)
        button_img = 'a{}FkIcon.png'.format(axis)
        button_ann = 'Selects Axis {} FK Controller'.format(axis)
        pm.symbolButton(image=button_img,
                        command=sel_cmd_str,
                        annotation=button_ann)
    pm.setParent('..')

    # UI spacing
    pm.separator(height=3, style='none')
    pm.separator(height=11, style='out')

    pm.rowLayout(numberOfColumns=7,
                 adjustableColumn=7,
                 columnAttach=(1, 'left', 3),
                 columnWidth=[(1, 20), (2, 45), (3, 22),
                              (4, 45), (5, 22), (6, 45)],
                 height=20)

    pm.text(label='A1:')
    pm.textField("t_a1",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 1),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 1))

    pm.text(label='  A2:')
    pm.textField("t_a2",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 2),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 2))

    pm.text(label='  A3:')
    pm.textField("t_a3",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 3),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 3))

    # UI spacing
    pm.text(label='')
    pm.setParent('..')
    pm.separator(height=2, style='none')

    pm.rowLayout(numberOfColumns=7,
                 adjustableColumn=7,
                 columnAttach=(1, 'left', 3),
                 columnWidth=[(1, 20), (2, 45), (3, 22),
                              (4, 45), (5, 22), (6, 45)],
                 height=20)

    pm.text(label='A4:')
    pm.textField("t_a4",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 4),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 4))

    pm.text(label='  A5:')
    pm.textField("t_a5",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 5),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 5))

    pm.text(label='  A6:')
    pm.textField("t_a6",
                 font=FONT,
                 rfc=pm.Callback(mimic_utils.select_fk_axis_handle, 6),
                 changeCommand=pm.Callback(mimic_utils.set_axis, 6))

    # UI Spacing
    pm.text(label='')
    pm.setParent('..')
    pm.separator(height=7, style='none')

    # Get and set FK pose buttons
    pm.gridLayout(nc=2, cw=109, ch=25)
    pm.button(label="Get Pose",
              command=mimic_utils.get_fk_pose,
              annotation='Gets selected robot\'s current axis rotation ' \
                         'values\nand prints them above')
    pm.button(label='Set Pose',
              command=mimic_utils.set_fk_pose,
              annotation='Sets selected robot\'s current axis rotation ' \
                         'values\nto the input values above')

    pm.setParent('..')

    # Clear FK pose button
    pm.button(label='Clear',
              command=mimic_utils.clear_fk_pose_ui,
              annotation='Clears axis rotation input fields above')
    pm.separator(height=14, style='out')

    # Keyframe FK button
    pm.button(label="Set FK Keyframe",
              command=mimic_utils.key_fk,
              backgroundColor=[.7, .7, .7],
              annotation='Keyframes Robot\'s IK-FK hierarchy in FK mode:\n' \
                         'target_CTRL:\n' \
                         '    ik = 0\n' \
                         '    visibility = 0\n' \
                         'a*FK_CTRL:\n' \
                         '    rotateX, Y, or Z\n' \
                         'FK_CTRLS\n' \
                         '    visibility = 1')
    pm.setParent(parent_layout)
    return fk_tab_layout
コード例 #46
0
ファイル: mimic_ui.py プロジェクト: vrmnk/Mimic
def _build_add_io_frame(parent_layout):
    pm.frameLayout('add_io_frame',
                    label="Add IO",
                    collapsable=True)
    add_io_col = pm.columnLayout(adj=True, columnAttach=('both', 5))
    pm.separator(height=5, style='none')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAlign=[(1, 'left'),
                              (2, 'left')],
                 columnAttach=[(1, 'both', -1),
                               (2, 'both', 0),
                               (3, 'both', 0)])

    pm.text(label='IO Name: ')
    pm.textField('t_ioNameText',
                 placeholderText='ioName',
                 font=FONT)
    pm.setParent('..')

    pm.separator(height=3, style='none')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAlign=[(1, 'left'),
                              (2, 'left')],
                 columnAttach=[(1, 'both', -1),
                               (2, 'both', 0),
                               (3, 'both', 0)])
    pm.text(label='Postproc ID: ')
    pm.textField('t_ioPostprocIDText',
                 placeholderText='postprocID',
                 font=FONT)
    pm.setParent('..')

    pm.separator(height=3, style='none')

    pm.optionMenu('ioNumberMenu',
                  label='IO Number:',
                  height=18)

    io_number_list = [i + 1 for i in range(12)]
    for io_number in io_number_list:
        pm.menuItem(label=io_number)

    pm.separator(height=3, style='none')

    pm.optionMenu('ioTypeMenu',
                  label='IO Type:     ',
                  height=18)

    io_type = ['digital', 'analog']
    for attr in io_type:
        pm.menuItem(label=attr)

    pm.separator(height=3, style='none')

    pm.rowLayout(numberOfColumns=1)
    pm.checkBox('cb_ignoreIO',
                label="Ignore in prostprocessor", value=0)
    pm.setParent('..')

    pm.separator(height=4, style='none')

    pm.setParent(add_io_col)

    pm.button('b_add_io',
              label='Add IO',
              height=25,
              backgroundColor=[.361, .361, .361],
              command=mimic_io.add_io)
    pm.separator(height=5, style='none')

    pm.setParent(parent_layout)
コード例 #47
0
    def getValues(self):
        """
        In this function we will get all values
        """
        renderer = cmds.getAttr('defaultRenderGlobals.currentRenderer')
        if not renderer == 'mentalRay':
            cmds.confirmDialog(title='Renderer Not Supported',
                               message='Render box only support mentalRay',
                               button=['Exit'],
                               cancelButton='Exit')
            return 0
        app = pm.about(application=True)
        version = pm.about(version=True)
        appname = app + version
        apppath = os.environ["MAYA_LOCATION"]
        renderableLayerList = []
        date_time = strftime("%a, %d %b %Y %H:%M:%S")
        scene_file_path = str(pm.system.sceneName())
        scene_file_name = str(os.path.basename(scene_file_path))
        renderLayerList = cmds.ls(type='renderLayer')
        for renderLayerName in renderLayerList:
            renderableLayer = cmds.getAttr('%s.renderable' % renderLayerName)
            if renderableLayer:
                renderableLayerList.append(renderLayerName)
        # Get the name of the first and last image for the current layer
        first_frame = str(cmds.getAttr('defaultRenderGlobals.startFrame'))
        last_frame = str(cmds.getAttr('defaultRenderGlobals.endFrame'))
        newList = str(renderableLayerList).replace("u'", "").replace(
            "'", "").replace("[", "").replace("]", "")
        custom_path = ''
        custom_checkbox = pm.checkBox('custom_CB', query=True, value=True)
        if custom_checkbox:
            first_frame = pm.textField('start_frame_LE', query=True, text=True)
            try:
                val = int(first_frame)
            except ValueError:
                cmds.confirmDialog(title='invalid number',
                                   message='first frame is not valid',
                                   button=['Exit'],
                                   cancelButton='Exit')
                return 0
            last_frame = pm.textField('end_frame_LE', query=True, text=True)
            try:
                val = int(last_frame)
            except ValueError:
                cmds.confirmDialog(title='invalid number',
                                   message='last frame is not valid',
                                   button=['Exit'],
                                   cancelButton='Exit')
                return 0
            custom_path = pm.textField('output_path_LE', query=True, text=True)
        job_description = pm.textField('description_LE', query=True, text=True)
        priority = pm.optionMenu('priority_CB', query=True, value=True)
        #force_start = pm.checkBox('force_start_TB', query=True, value=True)
        command = ' -w ' \
                  ' -app "%s" ' \
                  ' -apppath "%s" ' \
                  ' -priority "%s" ' \
                  ' -description "%s" ' \
                  ' -filename "%s" ' \
                  ' -filepath "%s" ' \
                  ' -custompath "%s" ' \
                  ' -renderlayers "%s" ' \
                  ' -startframe "%s" ' \
                  ' -endframe "%s" ' \
                  ' -starttime "%s" ' % (appname, apppath, priority, job_description, scene_file_name, scene_file_path, custom_path, newList , first_frame, last_frame, date_time)

        if custom_path:
            if os.path.exists(custom_path):
                return command
            else:
                cmds.confirmDialog(
                    title='Path not exists',
                    message='Output path provided by you is not exists',
                    button=['Exit'],
                    cancelButton='Exit')
                return 0
        else:
            return command
コード例 #48
0
    def show(self):
        # some default values
        section_label_height = 30
        labels_width = 140

        if pm.window(self.windows_name, exists=True):
            pm.deleteUI(self.windows_name)

        self.window = pm.window(self.windows_name, t='Afanasy Job Submission')

        with pm.columnLayout(adj=True):

            pm.text(l='<h1><b>Job Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=4,
                              adj=2,
                              cl4=['right', 'left', 'center', 'center'],
                              cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<div align="right"><b>Start Frame</b></div>')
                start_time_int_field = pm.intField(
                    'cgru_afanasy__start_frame',
                    v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1))
                pm.button(l='<',
                          ann='Use minimum animation range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                min=True)))
                pm.button(l='<<',
                          ann='Use minimum playback range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                ast=True)))

            with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<b>End Frame</b>')
                end_time_int_field = pm.intField(
                    'cgru_afanasy__end_frame',
                    v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1))
                pm.button(l='<',
                          ann='Use maximum animation range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                max=True)))
                pm.button(l='<<',
                          ann='Use maximum playback range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                aet=True)))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Frame Per Task</b>')
                pm.intField('cgru_afanasy__frames_per_task',
                            v=pm.optionVar.get(
                                'cgru_afanasy__frames_per_task_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>By Frame</b>')
                pm.intField('cgru_afanasy__by_frame',
                            v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Global Depend Mask</b>')
                pm.textField('cgru_afanasy__depend_mask_global',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__depend_mask_global_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Mask</b>')
                pm.textField('cgru_afanasy__hosts_mask',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_mask_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Exclude</b>')
                pm.textField('cgru_afanasy__hosts_exclude',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_exclude_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Life Time (hours)</b>')
                pm.intField('cgru_afanasy__life_time',
                            v=pm.optionVar.get('cgru_afanasy__life_time_ov',
                                               240))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Annotation</b>')
                pm.textField('cgru_afanasy__annotation',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__annotation_ov', ''))

            pm.separator()
            pm.text(l='<h1><b>Block Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Avoid Host</b>')
                pm.intField('cgru_afanasy__errors_avoid_host',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_avoid_host_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Retries</b>')
                pm.intField('cgru_afanasy__errors_retries',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_retries_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Task Same Host</b>')
                pm.intField('cgru_afanasy__errors_task_same_host',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_task_same_host_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Forgive Time</b>', ann='in seconds')
                pm.intField('cgru_afanasy__errors_forgive_time',
                            ann='in seconds',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_errors_forgive_time_ov',
                                18000),
                            min=0)

            pm.separator()
            pm.text(l='<h1><b>Submission Details<b><h1>',
                    h=section_label_height)
            with pm.rowLayout(nc=2,
                              adj=2,
                              cl2=('right', 'left'),
                              cw2=(labels_width, 50)):
                pm.text(l='<b>Start Paused</b>', al='right')
                pm.checkBox('cgru_afanasy__paused', l='', v=0)

            pm.radioButtonGrp(
                'cgru_afanasy__separate_layers',
                numberOfRadioButtons=3,
                label='<b>Submit Render Layers<br>as Separate:</b>',
                labelArray3=['None', 'Block', 'Job'],
                # adj=1,
                cw4=[labels_width, 50, 50, 50],
                sl=pm.optionVar.get('cgru_afanasy__separate_layers_ov', 2))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                ann = """This is a weird hack! When used in conjunction with
the <b>Skip Existence Frames<b> parameter of the maya render settings and the
Frames Per Task parameters is equal or greater than the number of frames in the
animation range, it allows the Maya scene to be loaded only once per farm
machine. But then to be able to use all farmers there should be at least the
same amount of Jobs that there are farm machines. So with this parameter it is
possible to submit the same job multiple times.. But it is a bad hack.

This system will be updated in Afanasy."""
                pm.text(l='<b>Submit Multiple Times</b>', ann=ann)
                pm.intField('cgru_afanasy__submit_multiple_times',
                            ann=ann,
                            v=pm.optionVar.get(
                                'cgru_afanasy__submit_multiple_times_ov', 1))

            with pm.rowLayout(nc=2,
                              adj=2,
                              cl2=('right', 'left'),
                              cw2=(labels_width, 40)):
                pm.text(l='<b>Close After</b>', al='right')
                pm.checkBox('cgru_afanasy__close', l='', v=1)

            pm.button(l='SUBMIT', c=self.launch)

        pm.showWindow(self.window)
コード例 #49
0
ファイル: cardRigging.py プロジェクト: jonntd/fossil
    def buildUI(self, card):

        uiFieldKwargs = self.getUIFieldKwargs(card)

        if self.type == self.BOOL:
            field = checkBox(l='', **uiFieldKwargs)  # noqa e741
            checkBox(field, e=True, cc=core.alt.Callback(self.setParam, field))

        elif self.type == self.INT:
            field = intField(**uiFieldKwargs)
            intField(field, e=True, cc=core.alt.Callback(self.setParam, field))

        elif self.type == self.FLOAT:
            field = floatField(**uiFieldKwargs)
            floatField(field,
                       e=True,
                       cc=core.alt.Callback(self.setParam, field))

        elif self.type == self.ENUM:
            field = optionMenu(l='')  # noqa e741
            optionMenu(field,
                       e=True,
                       cc=core.alt.Callback(self.setParam, field))

            for i, choice in enumerate(self.enum, 1):
                menuItem(l=choice)  # noqa e741
                if self.enum[choice] == uiFieldKwargs['text']:
                    optionMenu(field, e=True, sl=i)

        elif self.type == self.STR:
            # &&& Possibly super gross, if the field is "name", use the first joint...
            if 'text' not in uiFieldKwargs and self.kwargName == 'name':
                uiFieldKwargs['text'] = shortName(card.joints[0])
                #default = card.n
                #getDefaultIkName(card) # &&& MAKE THIS so I can use the same logic when building the card.

            field = textField(**uiFieldKwargs)
            textField(field,
                      e=True,
                      cc=core.alt.Callback(self.setParam, field))
            setattr(field, 'getValue',
                    field.getText)  # Hack to allow ducktyping.

        elif self.type == self.NODE_0:

            def setExtraNode(extraNode):
                card.extraNode[0] = extraNode

                temp = ParamInfo.toDict(card.rigParams)
                temp[self.kwargName] = 'NODE_0'
                card.rigParams = ParamInfo.toStr(temp)

                return True

            def clearExtraNode(extraNode):
                card.extraNode[0] = None
                temp = ParamInfo.toDict(card.rigParams)
                del temp[self.kwargName]
                card.rigParams = ParamInfo.toStr(temp)

                return True

            util.GetNextSelected(
                setExtraNode,
                clearExtraNode,
                l='',  # noqa e741
                tx=shortName(card.extraNode[0]) if card.extraNode[0] else '',
                cw=[(1, 1), (2, 100), (3, 20)])
コード例 #50
0
ファイル: mtth_initialize.py プロジェクト: pangor/OpenMaya
    def TheaTranslatorCreateTab(self):
        log.debug("TheaTranslatorCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "TrScrollLayout"

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "TrColumnLayout",
                                 adjustableColumn=True,
                                 width=400):
                with pm.frameLayout(label="Translator",
                                    collapsable=True,
                                    collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName +
                                        ".translatorVerbosity")
                    ui = pm.attrEnumOptionMenuGrp(
                        label="Translator Verbosity",
                        at=self.renderGlobalsNodeName + ".translatorVerbosity",
                        ei=self.getEnumList(attr))
                with pm.frameLayout(label="{0} export".format(
                        self.rendererName),
                                    collapsable=True,
                                    collapse=False):
                    ui = pm.checkBoxGrp(
                        label="Export {0} Scene file (no rendering):".format(
                            self.rendererName),
                        value1=False)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".exportSceneFile",
                                      index=2)
                    xmlDict = {}
                    self.rendererTabUiDict['xml'] = xmlDict
                    defaultXMLPath = pm.workspace.path + "/" + pm.sceneName(
                    ).basename().split(".")[0] + ".xml"
                    if not defaultXMLPath.dirname().exists():
                        defaultXMLPath.dirname().makedirs()
                    with pm.rowLayout(nc=3):
                        xmlDict['xmlFileText'] = pm.text(label="Export to")
                        xmlDict['xmlFile'] = pm.textField(text=defaultXMLPath)
                        pm.symbolButton(image="navButtonBrowse.png",
                                        c=self.xmlFileBrowse)
                        pm.connectControl(xmlDict['xmlFile'],
                                          self.renderGlobalsNodeName +
                                          ".exportSceneFileName",
                                          index=2)

                with pm.frameLayout(label="Optimize Textures",
                                    collapsable=True,
                                    collapse=False):
                    optiDict = {}
                    ui = pm.checkBoxGrp(label="Use Optimized Textures:",
                                        value1=False)
                    with pm.rowLayout(nc=3):
                        self.rendererTabUiDict['opti'] = optiDict
                        pm.text(label="OptimizedTex Dir:")
                        optiDict['optiField'] = pm.textField(
                            text=self.renderGlobalsNode.optimizedTexturePath.
                            get())
                        pm.symbolButton(image="navButtonBrowse.png",
                                        c=self.dirBrowse)
                        pm.connectControl(optiDict['optiField'],
                                          self.renderGlobalsNodeName +
                                          ".optimizedTexturePath",
                                          index=2)

                with pm.frameLayout(label="Additional Settings",
                                    collapsable=True,
                                    collapse=False):
                    ui = pm.floatFieldGrp(label="Scene scale:",
                                          value1=1.0,
                                          numberOfFields=1)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".sceneScale",
                                      index=2)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm,
                      edit=True,
                      attachForm=[(scLo, "top", 0), (scLo, "bottom", 0),
                                  (scLo, "left", 0), (scLo, "right", 0)])
コード例 #51
0
ファイル: animation.py プロジェクト: ktSevindik/anima
 def cam_2_chan(cls, startButton, endButton):
     start = int(pm.textField(startButton, q=True, tx=True))
     end = int(pm.textField(endButton, q=True, tx=True))
     cam_to_chan(start, end)
コード例 #52
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
    def __set_limit_display_units(*args):
        if 'translate' in args[0]:

            pm.textField('t_externalAxisLimitMin',
                         edit=True,
                         placeholderText='mm')
            pm.textField('t_externalAxisLimitMax',
                         edit=True,
                         placeholderText='mm')
            pm.textField('t_externalAxisVelocityLimit',
                         edit=True,
                         placeholderText='m/s')
        else:
            pm.textField('t_externalAxisLimitMin',
                         edit=True,
                         placeholderText='deg')
            pm.textField('t_externalAxisLimitMax',
                         edit=True,
                         placeholderText='deg')
            pm.textField('t_externalAxisVelocityLimit',
                         edit=True,
                         placeholderText='deg/s')
コード例 #53
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
def _build_add_external_axis_frame(parent_layout):
    add_external_axis_frame = pm.frameLayout('add_external_axis_frame',
                                             label="Add External Axis",
                                             collapsable=True)
    add_external_axis_col = pm.columnLayout(adj=True, columnAttach=('both', 5))
    pm.separator(height=5, style='none')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAlign=[(1, 'left'),
                              (2, 'left')],
                 columnAttach=[(1, 'both', -1),
                               (2, 'both', 0),
                               (3, 'both', 0)])
    pm.text(label='Axis Name: ')
    pm.textField('t_externalAxisDescriptionText',
                 placeholderText='axisName',
                 font=FONT)
    pm.setParent('..')
    pm.separator(height=3, style='none')

    def __set_limit_display_units(*args):
        if 'translate' in args[0]:

            pm.textField('t_externalAxisLimitMin',
                         edit=True,
                         placeholderText='mm')
            pm.textField('t_externalAxisLimitMax',
                         edit=True,
                         placeholderText='mm')
            pm.textField('t_externalAxisVelocityLimit',
                         edit=True,
                         placeholderText='m/s')
        else:
            pm.textField('t_externalAxisLimitMin',
                         edit=True,
                         placeholderText='deg')
            pm.textField('t_externalAxisLimitMax',
                         edit=True,
                         placeholderText='deg')
            pm.textField('t_externalAxisVelocityLimit',
                         edit=True,
                         placeholderText='deg/s')

    pm.optionMenu('axisNumberMenu',
                  label='Axis Number:',
                  height=18)

    axis_number_list = [i + 1 for i in range(6)]
    for axis_number in axis_number_list:
        pm.menuItem(label=axis_number)

    pm.separator(height=3, style='none')

    pm.optionMenu('drivingAttributeMenu',
                  label='Driving Attribute:',
                  height=18,
                  changeCommand=__set_limit_display_units)

    driving_attributes = ['translateX', 'translateY', 'translateZ',
                          'rotateX', 'rotateY', 'rotateZ']
    for attr in driving_attributes:
        pm.menuItem(label=attr)

    pm.separator(height=3, style='none')

    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=3,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 80), (2, 65), (3, 65)],
                 height=20)
    pm.text(label='Position Limits:')

    pm.textField('t_externalAxisLimitMin',
                 placeholderText='mm')

    pm.textField('t_externalAxisLimitMax',
                 placeholderText='mm')

    pm.setParent('..')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 80)],
                 height=20)
    pm.text(label='Velocity Limit:')

    pm.textField('t_externalAxisVelocityLimit',
                 placeholderText='m/s')
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=1)
    pm.checkBox('cb_attachRobotToController',
                label="Attach robot to controller", value=0)
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=1)
    pm.checkBox('cb_ignoreExternalAxis',
                label="Ignore in prostprocessor", value=0)
    pm.setParent('..')

    pm.separator(height=4, style='none')

    pm.setParent(add_external_axis_col)

    pm.button('b_add_Axis',
              label='Add Axis',
              height=25,
              backgroundColor=[.361, .361, .361],
              command=mimic_external_axes.add_external_axis)
    pm.separator(height=5, style='none')

    pm.setParent(parent_layout)
コード例 #54
0
def ui():
    if pm.window("Baker", ex=True):
        pm.deleteUI("Baker")

    win = pm.window("Baker", wh=(200, 400), tlb=True, t="Vray baker")
    pm.columnLayout()

    pm.text("material directory", w=200)
    pm.textField("baker_mat_dir", tx=material_dir, w=200)

    pm.text("output directory", w=200)
    pm.textField("baker_out_dir", tx=textures_dir, w=200)

    pm.intSliderGrp("baker_size",
                    cw3=[50, 50, 100],
                    ct3=["left", "left", "lfet"],
                    l="size",
                    field=True,
                    v=size,
                    max=8192)
    pm.button("baker_uv", l="uv", w=200, c=applyUV)
    pm.text(l="AO", w=200)
    pm.floatSliderGrp("baker_radius",
                      cw3=[50, 50, 100],
                      ct3=["left", "left", "lfet"],
                      l="radius",
                      field=True,
                      v=10)
    pm.floatSliderGrp("baker_falloff",
                      cw3=[50, 50, 100],
                      ct3=["left", "left", "lfet"],
                      l="falloff",
                      field=True,
                      v=0)
    pm.intSliderGrp("baker_sub",
                    cw3=[50, 50, 100],
                    ct3=["left", "left", "lfet"],
                    l="subdivs",
                    field=True,
                    v=3)
    pm.text(l="bake", w=200)

    pm.checkBox("baker_id", l="bake id", v=True)
    pm.checkBox("baker_ao", l="bake ao", v=True)
    pm.checkBox("baker_shadow", l="bake shadow", v=True)
    pm.checkBox("baker_mat", l="bake materials", v=True)
    pm.text(h=30, l="")
    pm.button("baker_run", l="bake", w=200, c=render)
    pm.text(l="materials", w=200)
    for color in materials:
        pm.button(l=color, w=200, c=functools.partial(applyMaterial, color))

    try:
        options = nt.VRayBakeOptions("vrayDefaultBakeOptions")
    except pm.MayaNodeError:
        options = pm.createNode("VRayBakeOptions", n="vrayDefaultBakeOptions")
    options.setAttr("resolutionX", size)
    options.setAttr("outputTexturePath", textures_dir, type="string")
    options.setAttr("filenamePrefix", "")

    win.show()
コード例 #55
0
ファイル: pymelControlPanel.py プロジェクト: yujiye/pymel
    def buildUI(self, filter=None):

        if filter:
            match = False
            for i, info in enumerate(self.methodInfoList):
                argUtil = factories.ApiArgUtil(self.apiClassName,
                                               self.apiMethodName, i)
                if filter.intersection(argUtil.getInputTypes() +
                                       argUtil.getOutputTypes()):
                    match = True
                    break
            if match == False:
                return False

        self.layout = {
            'columnAlign': [1, 'right'],
            'columnAttach': [1, 'right', 8]
        }

        #print className, self.methodName, melMethods
        isOverloaded = len(self.methodInfoList) > 1
        self.frame = pm.frameLayout(w=FRAME_WIDTH,
                                    labelVisible=False,
                                    collapsable=False)
        logger.debug("building row for %s - %s" %
                     (self.methodName, self.frame))
        col = pm.columnLayout()

        enabledArray = []
        self.rows = []
        self.overloadPrecedenceColl = None
        self.enabledChBx = pm.checkBox(label=self.methodName,
                                       changeCommand=pm.CallbackWithArgs(
                                           MethodRow.enableCB, self))

        if isOverloaded:

            self.overloadPrecedenceColl = pm.radioCollection()
            for i in range(len(self.methodInfoList)):

                self.createMethodInstance(i)

        else:
            #row = rowLayout( self.methodName + '_rowMain', nc=2, cw2=[200, 400] )
            #self.enabledChBx = checkBox(label=self.methodName, changeCommand=CallbackWithArgs( MethodRow.enableCB, self ) )
            #text(label='')
            self.createMethodInstance(0)
            #setParent('..')

        pm.setParent(col)
        pm.separator(w=800, h=6)

        #self.row = rowLayout( self.methodName + '_rowSettings', nc=4, cw4=[200, 160, 180, 160] )
        #self.rows.append(row)

        self.row = pm.rowLayout(self.methodName + '_rowSettings',
                                nc=2,
                                cw2=[200, 220],
                                **self.layout)
        self.rows.append(self.row)

        # create ui elements
        pm.text(label='Mel Equivalent')

        self.melNameTextField = pm.textField(w=170, editable=False)
        self.melNameOptMenu = pm.popupMenu(parent=self.melNameTextField,
                                           button=1,
                                           postMenuCommand=pm.Callback(
                                               MethodRow.populateMelNameMenu,
                                               self))
        pm.setParent('..')

        self.row2 = pm.rowLayout(self.methodName + '_rowSettings2',
                                 nc=3,
                                 cw3=[200, 180, 240],
                                 **self.layout)
        self.rows.append(self.row2)

        pm.text(label='Use Name')
        self.nameMode = pm.radioButtonGrp(label='',
                                          nrb=3,
                                          cw4=[1, 50, 50, 50],
                                          labelArray3=['api', 'mel', 'other'])
        self.altNameText = pm.textField(w=170, enable=False)
        self.altNameText.changeCommand(
            pm.CallbackWithArgs(MethodRow.alternateNameCB, self))
        self.nameMode.onCommand(pm.Callback(MethodRow.nameTypeCB, self))

        isEnabled = self.data.get('enabled', True)

        # UI SETUP

        melName = self.data.get('melName', '')

        try:
            #self.melNameOptMenu.setValue( melName )
            self.melNameTextField.setText(melName)
            if melName != '':
                self.parent.parent.assignMelMethod(melName)

        except RuntimeError:
            # it is possible for a method name to be listed here that was set from a different view,
            # where this class was a super class and more mel commands were available.  expand the option list,
            # and make this frame read-only
            pm.menuItem(label=melName, parent=self.melNameOptMenu)
            self.melNameOptMenu.setValue(melName)
            logger.debug("making %s frame read-only" % self.methodName)
            self.frame.setEnable(False)

        self.enabledChBx.setValue(isEnabled)
        self.row.setEnable(isEnabled)
        self.row2.setEnable(isEnabled)

        name = self.data['useName']
        if name == 'API':
            self.nameMode.setSelect(1)
            self.altNameText.setEnable(False)
        elif name == 'MEL':
            self.nameMode.setSelect(2)
            self.altNameText.setEnable(False)
        else:
            self.nameMode.setSelect(3)
            self.altNameText.setText(name)
            self.altNameText.setEnable(True)

        if self.overloadPrecedenceColl:
            items = self.overloadPrecedenceColl.getCollectionItemArray()
            try:
                val = self.data['overloadIndex']

                if val is None:
                    logger.info("no wrappable options for method %s" %
                                self.methodName)
                    self.frame.setEnable(False)
                else:
                    self.overloadPrecedenceColl.setSelect(items[val])
            except:
                pass

#            # ensure we don't use a value that is not valid
#            for val in range(val, len(enabledArray)+1):
#                try:
#                    if enabledArray[val]:
#                        break
#                except IndexError:
#                    val = None
#            if val is not None:
#                self.overloadPrecedenceColl.setSelect( items[ val ] )

        pm.setParent('..')

        pm.setParent('..')  # frame
        pm.setParent('..')  # column

        return True
コード例 #56
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
def _build_axis_limits_frame(parent_layout):
    limits_frame = pm.frameLayout(label="Axis Limits", collapsable=True)

    limits_frame_cols = pm.rowColumnLayout(numberOfColumns=2)

    # Input text field width for all axis limits
    cell_width = 50

    # Set up primary axis limits UI
    pm.columnLayout(adj=True, columnAttach=('left', 5))
    pm.separator(height=5, style='none')

    pm.text('      Position:', align='center')
    pm.separator(height=5, style='none')

    for i in range(6):
        # Axis 1 Limit row
        pm.rowLayout(numberOfColumns=3,
                     columnAttach=(1, 'left', 0),
                     columnWidth=[(2, cell_width), (3, cell_width)],
                     height=20)
        pm.text(label='A{}: '.format(i + 1))

        # Axis 1 Min limit
        pm.textField("t_A{}Min".format(i + 1),
                     font=FONT,
                     placeholderText='Min',
                     width=cell_width,
                     changeCommand='import pymel.core as pm; ' \
                                   'import mimic_utils; ' \
                                   'pm.setFocus("t_A{}Max"); ' \
                                   'mimic_utils.set_axis_limit({},"Min")' \
                     .format(i + 1, i + 1))
        # Axis 1 Max limit
        set_focus_count = ((i + 1) % 6) + 1
        pm.textField("t_A{}Max".format(i + 1),
                     font=FONT,
                     placeholderText='Max',
                     width=cell_width,
                     changeCommand='import pymel.core as pm; ' \
                                   'import mimic_utils; ' \
                                   'pm.setFocus("t_A{}Min"); ' \
                                   'mimic_utils.set_axis_limit({},"Max")' \
                     .format(set_focus_count, i + 1))

        pm.setParent('..')

    pm.setParent(limits_frame_cols)

    # Set up primary axis velocity limts tab
    pm.columnLayout(adj=True, columnAttach=('right', 5))
    pm.separator(height=5, style='none')
    pm.text('Velocity:', align='center')
    pm.separator(height=5, style='none')

    # Input text field width for all axis limits
    cell_width = 40

    for i in range(6):
        # Axis 1 Limit row
        pm.rowLayout(numberOfColumns=2,
                     columnAttach=(1, 'left', 3),
                     columnWidth=[(2, 2 * cell_width)],
                     height=20)
        set_focus_count = ((i + 1) % 6) + 1
        # Axis 1 Min limit
        pm.textField("t_A{}vel".format(i + 1),
                     font=FONT,
                     placeholderText='deg/sec',
                     width=2 * cell_width,
                     enable=False,
                     changeCommand='import pymel.core as pm; ' \
                                   'import mimic_utils; ' \
                                   'pm.setFocus("t_A{}vel"); ' \
                     .format(set_focus_count))
        pm.setParent('..')

    pm.setParent(limits_frame)

    pm.columnLayout(adj=True, columnAttach=('both', 3))
    pm.gridLayout(nc=2, cw=114, ch=25)
    pm.button(label='Get Axis Limits',
              command=mimic_utils.get_axis_limits,
              annotation='Gets axis limit values for selected robot and ' \
                         'prints them above')
    pm.button(label='Set Axis Limits',
              command=mimic_utils.set_axis_limits,
              annotation='Sets selected robot\'s axis limit values to the ' \
                         'input values above')

    pm.setParent('..')
    pm.button(label='Clear',
              width=218,
              command=mimic_utils.clear_limits_ui,
              annotation='Clears the axis limits UI above')

    pm.setParent(parent_layout)
コード例 #57
0
 def addSelectionSetWin(self):
     setInput = pm.textField("setName", q=1, tx=1)
     if pm.objExists(setInput) == False:
         pm.sets(n=setInput)
         pm.textScrollList("selSetList", e=1, append=setInput)
     pm.sets(setInput, add=pm.selected())
コード例 #58
0
ファイル: mimic_ui.py プロジェクト: tws0002/Mimic
def _build_general_settings_tab(parent_layout):
    # Create column Layout for General settings
    general_settings_tab_layout = pm.columnLayout('generalSettings',
                                                  adj=True,
                                                  width=100)
    pm.separator(height=3, style='none')

    pm.rowLayout(numberOfColumns=3,
                 columnWidth3=(55, 250, 30),
                 adjustableColumn=2,
                 columnAlign=[(1, 'left'),
                              (2, 'left')],
                 columnAttach=[(1, 'both', -1),
                               (2, 'both', 0),
                               (3, 'both', 0)])
    pm.text(label="Directory:")
    pm.textField('t_programDirectoryText',
                 text='',
                 ed=False,
                 font=FONT)

    pm.symbolButton('b_directoryImage',
                    image="setDirectory_icon.png",
                    width=32,
                    height=20,
                    command=mimic_utils.set_program_dir)
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 90), (2, 100)],
                 height=20)
    pm.text(label='Output name:')
    pm.textField('t_outputFileName',
                 text=postproc_config.DEFAULT_OUTPUT_NAME,
                 font=FONT)

    pm.setParent('..')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 90), (2, 100)],
                 height=20)
    pm.text(label='Template name:')
    pm.textField('t_templateFileName',
                 text=postproc_config.DEFAULT_TEMPLATE_NAME,
                 font=FONT)

    pm.setParent('..')

    # Sample rate radio buttons
    pm.separator(height=3, style='none')
    selected_units = postproc_config.DEFAULT_SAMPLE_RATE_UNITS
    selected_value = postproc_config.DEFAULT_SAMPLE_RATE_VALUE
    radio_indent = 3
    pm.radioCollection('sample_rate_radio_collection')
    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=3,
                 columnAttach=(1, 'left', radio_indent),
                 columnWidth=[(1, 90), (2, 45)],
                 height=20)
    pm.radioButton('rb_timeInterval',
                   label='Sample rate:',
                   select=True)
    pm.textField('t_timeBetweenSamples',
                 text=selected_value,
                 font=FONT)
    pm.radioButtonGrp('time_unit_radio_group',
                      labelArray2=['s', 'f'],
                      annotation='Sample rate units: seconds or frames',
                      numberOfRadioButtons=2,
                      columnWidth2=[32, 30],
                      select=1 if selected_units == 'seconds' else 2)  # 1-based integer
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=1,
                 adjustableColumn=1,
                 columnAttach=(1, 'left', radio_indent),
                 height=20)
    pm.radioButton('rb_keyframesOnly',
                   label='Sample keyframes only',
                   enable=True)
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=3,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 132), (2, 40), (3, 30)],
                 height=20)
    pm.text(label='Animation frame range:')

    pm.intField("i_programStartFrame",
                value=pm.playbackOptions(animationStartTime=True, query=True),
                minValue=-10,
                maxValue=10000,
                step=1)

    pm.intField("i_programEndFrame",
                value=pm.playbackOptions(animationEndTime=True, query=True),
                minValue=-10,
                maxValue=10000,
                step=1)
    pm.setParent('..')

    pm.separator(height=5, style='none')

    # Post processor option menu list
    pm.optionMenu('postProcessorList',
                  label='Processor:',
                  height=18,
                  changeCommand=postproc_options.overwrite_options)

    # Get supported post-processors and fill option menu list
    supported_post_processors = postproc_setup.get_processor_names()
    for post in supported_post_processors:
        pm.menuItem(label=post)
    pm.separator(height=3, style='none')

    pm.setParent(parent_layout)
    return general_settings_tab_layout
コード例 #59
0
ファイル: speedrig.py プロジェクト: williamyap912/S-S-Rig
    def create_window(self):

        if pm.window('RiggingSpeedUp', exists=True):
            pm.deleteUI('RiggingSpeedUp')

        pm.scriptJob(killAll=True)
        window = pm.window(title="RiggingSpeedUp",
                           iconName="Speed",
                           widthHeight=(400, 400))

        pm.columnLayout()

        pm.text('Rename',
                align='center',
                width=400,
                height=20,
                font='boldLabelFont')

        pm.rowColumnLayout(nc=7,
                           cw=[(1, 30), (2, 30), (3, 30), (4, 50), (5, 100),
                               (6, 50), (7, 100)])

        pm.radioCollection()
        pm.radioButton(label='lt', editable=True, onCommand=rename_lt)
        pm.radioButton(label='rt', editable=True, onCommand=rename_rt)
        pm.radioButton(label='ct', editable=True, onCommand=rename_ct)

        global textFieldName_name
        global textFieldEntry_name
        textFieldName_name = pm.text(label='Name:')
        textFieldEntry_name = pm.textField(textFieldName_name, editable=True)

        global textFieldName_suffix
        global textFieldEntry_suffix
        textFieldName_suffix = pm.text(label='Suffix:')
        textFieldEntry_suffix = pm.textField(textFieldName_suffix,
                                             editable=True)

        pm.setParent('..')

        pm.button(label="Apply", width=400, command=renamer)
        pm.button(label="MirrorIntoRt", width=400, command=renamer_mirror)

        pm.separator(h=5, style='none')

        pm.text('Padding&Snapping',
                align='center',
                width=400,
                height=20,
                font='boldLabelFont')

        global intFieldName_num_name_delete
        global intFieldEntry_num_name_delete

        pm.rowColumnLayout(nc=2, cw=[(1, 200), (2, 200)])
        pm.rowColumnLayout(nr=2, rh=[(1, 25), (2, 25)])

        intFieldName_num_name_delete = pm.text(label='No_Name_Delete :')
        intFieldEntry_num_name_delete = pm.intField(
            intFieldName_num_name_delete, editable=True, value=0)

        global textFieldName_ik_suffix
        global textFieldEntry_ik_suffix

        textFieldName_ik_suffix = pm.text(label='Suffix:')
        textFieldEntry_ik_suffix = pm.textField(textFieldName_ik_suffix,
                                                editable=True)

        pm.setParent('..')

        pm.rowColumnLayout(nc=1, cw=(1, 200))
        pm.button(label="Padding", width=200, command=padding)

        pm.separator(h=5, style='none')

        pm.button(label='Snapping', width=200, command=snapping)

        pm.separator(h=5, style='none')

        pm.setParent('..')
        pm.setParent('..')

        pm.text('IK_Stretch',
                align='center',
                width=400,
                height=20,
                font='boldLabelFont')

        pm.button(label="Stretch IK", width=400, command=IK_Stretch)

        pm.separator(h=5, style='none')

        pm.text('IK_Spline_Stretch&Squash',
                align='center',
                width=400,
                height=20,
                font='boldLabelFont')

        pm.separator(h=5, style='none')

        pm.rowColumnLayout(nc=4, cw=[(1, 50), (2, 50), (3, 50), (4, 250)])

        global intFieldName_num_joint
        global intFieldEntry_num_joint

        intFieldName_num_joint = pm.text(label='No_Joint :')
        intFieldEntry_num_joint = pm.intField(intFieldName_num_joint,
                                              editable=True,
                                              value=0)

        global textFieldName_ik_spline_name
        global textFieldEntry_ik_spline_name

        textFieldName_ik_spline_name = pm.text(label='Name:')
        textFieldEntry_ik_spline_name = pm.textField(textFieldName_name,
                                                     editable=True)

        pm.setParent('..')

        pm.button(label="Stretch&Squash IK",
                  width=400,
                  command=squash_stretch_IK)

        window.show()
コード例 #60
0
ファイル: speedrig.py プロジェクト: williamyap912/S-S-Rig
def IK_Stretch(*args):

    joint_selected = pm.ls(sl=True)
    joint_start = joint_selected[0]
    joint_end = joint_selected[1]

    textFieldData_ik_suffix = pm.textField(textFieldEntry_ik_suffix,
                                           editable=True,
                                           query=True,
                                           text=True)
    ik_suffix = textFieldData_ik_suffix

    num_name_delete = pm.intField(intFieldEntry_num_name_delete,
                                  editable=True,
                                  query=True,
                                  value=True)

    newname = joint_start.split('_')
    print newname
    number_name = len(newname)

    new_name_first = newname[0] + '_'

    for i in range(0, number_name):

        if i > number_name - num_name_delete - 1 or i == number_name - num_name_delete - 1:

            new_name_ik = new_name_first
            print 'naming error'

            break

        else:

            if i < number_name - num_name_delete - 1:

                new_name_second = newname[i + 1] + '_'
                new_name_ik = new_name_first + new_name_second
                new_name_first = new_name_ik

            else:

                break

    pm.ikHandle(sj=joint_start,
                ee=joint_end,
                n='{0}ik_handle'.format(new_name_ik))

    if pm.objExists('dist_loc_01'):

        print 'dist_loc_01 exists'

    else:

        dist_loc_01 = pm.spaceLocator(n='dist_loc_01')

    for i in range(0, 20):

        if i == 0:

            pm.select(joint_start)
            joint_parent = pm.listRelatives(p=True, type='joint')

        elif i > 0:

            pm.select(joint_parent)
            joint_first = pm.ls(sl=True)
            joint_parent = pm.listRelatives(p=True, type='joint')

            if joint_parent == []:

                pm.select(joint_first)
                joint_first_select = pm.ls(sl=True)

                break

            else:
                continue

    pm.select(joint_first_select, hi=True)
    all_hierachy = pm.ls(sl=True)

    pm.select(joint_start)
    joint_mid = pm.listRelatives(c=True)

    pm.select(dist_loc_01, joint_start)
    snapping()

    pm.select(dist_loc_01, joint_mid)
    snapping()

    pm.select(dist_loc_01, joint_end)
    snapping()

    pm.select(joint_start, joint_mid, joint_end)
    ik_joint_loc = pm.ls(sl=True)
    pm.select(d=True)

    for n in ik_joint_loc:

        newname = n.split('_')
        print newname
        number_name = len(newname)

        new_name_first = newname[0] + '_'

        for i in range(0, number_name):

            if i > number_name - num_name_delete - 1 or i == number_name - num_name_delete - 1:

                new_name = new_name_first
                print 'naming error'

                break

            else:

                if i < number_name - num_name_delete - 1:

                    new_name_second = newname[i + 1] + '_'
                    new_name = new_name_first + new_name_second
                    new_name_first = new_name

                else:

                    break

        print new_name
        pm.select('{0}{1}'.format(new_name, ik_suffix), add=True)

    dist_loc_all = pm.ls(sl=True)
    dist_loc_start = dist_loc_all[0]
    dist_loc_mid = dist_loc_all[1]
    dist_loc_end = dist_loc_all[2]

    pm.pointConstraint('{0}'.format(dist_loc_start), joint_start, mo=True, w=1)
    pm.pointConstraint(joint_mid, '{0}_pad'.format(dist_loc_mid), mo=True, w=1)
    pm.pointConstraint('{0}'.format(dist_loc_end),
                       '{0}ik_handle'.format(new_name_ik),
                       mo=True,
                       w=1)

    dist_loc_start_tx = pm.getAttr('{0}_pad.tx'.format(dist_loc_start))
    dist_loc_start_ty = pm.getAttr('{0}_pad.ty'.format(dist_loc_start))
    dist_loc_start_tz = pm.getAttr('{0}_pad.tz'.format(dist_loc_start))

    dist_loc_mid_tx = pm.getAttr('{0}_pad.tx'.format(dist_loc_mid))
    dist_loc_mid_ty = pm.getAttr('{0}_pad.ty'.format(dist_loc_mid))
    dist_loc_mid_tz = pm.getAttr('{0}_pad.tz'.format(dist_loc_mid))

    dist_loc_end_tx = pm.getAttr('{0}_pad.tx'.format(dist_loc_end))
    dist_loc_end_ty = pm.getAttr('{0}_pad.ty'.format(dist_loc_end))
    dist_loc_end_tz = pm.getAttr('{0}_pad.tz'.format(dist_loc_end))

    dist_dimension_name()

    pm.distanceDimension(sp=(dist_loc_start_tx, dist_loc_start_ty,
                             dist_loc_start_tz),
                         ep=(dist_loc_mid_tx, dist_loc_mid_ty,
                             dist_loc_mid_tz))

    newname = dist_loc_start.split('_')
    print newname
    number_name = len(newname)

    new_name_first = newname[0] + '_'

    for i in range(0, number_name):

        if i > number_name - num_name_delete - 2 or i == number_name - num_name_delete - 2:

            new_name = new_name_first
            print 'naming error'

            break

        else:

            if i < number_name - num_name_delete - 2:

                new_name_second = newname[i + 1] + '_'
                new_name = new_name_first + new_name_second
                new_name_first = new_name

            else:

                break

    dist_measure_01 = pm.rename(dist_dimension_created,
                                '{0}01_dist'.format(new_name))

    dist_dimension_name()

    pm.distanceDimension(sp=(dist_loc_mid_tx, dist_loc_mid_ty,
                             dist_loc_mid_tz),
                         ep=(dist_loc_end_tx, dist_loc_end_ty,
                             dist_loc_end_tz))

    dist_measure_02 = pm.rename(dist_dimension_created,
                                '{0}02_dist'.format(new_name))

    dist_dimension_name()

    pm.distanceDimension(sp=(dist_loc_start_tx, dist_loc_start_ty,
                             dist_loc_start_tz),
                         ep=(dist_loc_end_tx, dist_loc_end_ty,
                             dist_loc_end_tz))

    actual_length_ik = pm.rename(dist_dimension_created,
                                 '{0}dist'.format(new_name))

    first_length_ik = pm.getAttr('{0}.distance'.format(dist_measure_01))
    second_length_ik = pm.getAttr('{0}.distance'.format(dist_measure_02))

    max_length_ik = first_length_ik + second_length_ik

    ratio_ik_stretch = pm.createNode('multiplyDivide',
                                     n='{0}ratio_ik_stretch'.format(new_name))
    pm.setAttr('{0}.operation'.format(ratio_ik_stretch), 2)
    pm.connectAttr('{0}.distance'.format(actual_length_ik),
                   '{0}.input1X'.format(ratio_ik_stretch))
    pm.setAttr('{0}.input2X'.format(ratio_ik_stretch), max_length_ik)

    ratio_ik_stretch_cond = pm.createNode(
        'condition', n='{0}ratio_ik_stretch_cond'.format(new_name))
    pm.connectAttr('{0}.outputX'.format(ratio_ik_stretch),
                   '{0}.firstTerm'.format(ratio_ik_stretch_cond))
    pm.connectAttr('{0}.outputX'.format(ratio_ik_stretch),
                   '{0}.colorIfTrueR'.format(ratio_ik_stretch_cond))
    pm.setAttr('{0}.operation'.format(ratio_ik_stretch_cond), 3)
    pm.setAttr('{0}.secondTerm'.format(ratio_ik_stretch_cond), 1)
    pm.setAttr('{0}.colorIfFalseR'.format(ratio_ik_stretch_cond), 1)

    pm.connectAttr('{0}.outColorR'.format(ratio_ik_stretch_cond),
                   '{0}.scaleX'.format(joint_start))
    pm.connectAttr('{0}.outColorR'.format(ratio_ik_stretch_cond),
                   '{0}.scaleX'.format(joint_mid[0]))
    pm.connectAttr('{0}.outColorR'.format(ratio_ik_stretch_cond),
                   '{0}.scaleX'.format(joint_end))

    pm.delete(dist_loc_01)