def deleteAll(*args):
    """deletes all audio in the scene"""

    nodes = cmds.textScrollList(widgets["audioTSL"], q=True, ai=True)
    for node in nodes:
        cmds.delete(node)
    cmds.textScrollList(widgets["audioTSL"], e=True, ra=True)
def loadReferenceList():
    """
    List all existing reference nodes to the UI textScrollList
    """
    refList = cmds.ls(type='reference')
    if 'sharedReferenceNode' in refList: refList.remove('sharedReferenceNode')
    for ref in refList: cmds.textScrollList('refEdits_refListTSL', e=True, a=ref)
 def build(self):
     if mc.window( self.win, ex=1 ): mc.deleteUI( self.win )
     if mc.windowPref( self.win, ex=1 ): mc.windowPref( self.win, remove=1 )
     mc.window(self.win, title=self.title, wh=(410,378))
     mc.columnLayout( 'mainColumn', adj=True )
     mc.separator( h=10 )
     mc.rowLayout( numberOfColumns=2, columnWidth2=(200, 200), columnAttach=[(1, "both", 5),(2 ,"both", 5)] )
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textsk )
     self.skcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textqp )
     self.qpcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent( '..' )
     mc.setParent('..')
     mc.separator ( h=10 )
     mc.rowLayout( numberOfColumns=4, columnWidth4=(100, 100, 100, 100), columnAttach=[(1, "both", 1),(2 ,"both", 1), (3 ,"both", 1), (4 ,"both", 1)] )
     mc.button( l=self.buttonsk, c=self.selSKItem )
     mc.button( l=self.buttonAllSk, c=self.mainSK )
     mc.button( l=self.buttonqp, c=self.selQPItem )
     mc.button( l=self.buttonAllQp, c=self.mainQP )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.separator ( h=10 )
     mc.setParent('..')
     self.addSKList()
def seqGUI(parent):
	frm = cmds.frameLayout( label="Sequence", cll=True, w=winWidth-5,
		collapseCommand=Callback(winExpand, -70),
		expandCommand=Callback(winExpand, 70))
	frmCol = cmds.columnLayout(rs=3)
	cmds.checkBox( "mecRenSeqCB", label="On\Off", v=1)
	rowCol = cmds.rowColumnLayout("mecRenSeqRC", nc=2, cw=[[1,winWidth/2],[2,winWidth/2]],
		co=[[1,"right",5]])
	'''
	Older version.  Used Callback instead with a function that will enable or disable any gui component.	
	cmds.checkBox( "mecRenSeqCB", e=True, onc='%s.cmds.rowColumnLayout("mecRenSeqRC", e=True, en=True)' %scriptName)
	cmds.checkBox( "mecRenSeqCB", e=True, ofc='%s.cmds.rowColumnLayout("mecRenSeqRC", e=True, en=False)' %scriptName)
	'''
	cmds.checkBox( "mecRenSeqCB", e=True, onc=Callback(enGUI,"rowColumnLayout", "mecRenSeqRC", 1 ) )
	cmds.checkBox( "mecRenSeqCB", e=True, ofc=Callback(enGUI,"rowColumnLayout", "mecRenSeqRC", 0 ))
	
	cmds.textScrollList( "mecRenSeqTSL", h=40, ams=True )
	cmds.setParent(rowCol)
	subCol = cmds.columnLayout()
	rowWidth = winWidth/2
	cmds.rowColumnLayout(nc=2, w=rowWidth,
		cw=[[1,(rowWidth-70)], [2,60]])
	cmds.textField("mecRenSeqName", w=rowWidth-70 )
	cmds.button(label="Add",
		c=Callback(addTSL, "mecRenSeqTSL"))
	cmds.setParent(subCol)
	cmds.rowColumnLayout(nc=2, w=rowWidth,
		cw=[[1,rowWidth/2],[2,rowWidth/2-10]])
	cmds.button(label="Rem All",
		c=Callback(remAllTSL, "mecRenSeqTSL"))
	cmds.button(label="Rem Sel",
		c=Callback(remSelTSL, "mecRenSeqTSL"))
	cmds.setParent(parent)
def addScrollListColor():
    tsList = scrollListItemsColor()
    cAdd = cmds.colorSliderButtonGrp(csbgColor, rgbValue = True, query = True)
    tsList.append('%s, %s, %s' %(cAdd[0], cAdd[1], cAdd[2]))
    cmds.textScrollList(tslColorList, edit = True, removeAll = True)
    cmds.textScrollList(tslColorList, append = tsList, edit = True)
    cmds.colorSliderButtonGrp(csbgColor, rgbValue = [1.0, 1.0, 1.0], edit = True)
def rsChProperties(i_s_intro, i_s_button):
    l_oSels = rsObjList()
    i_atKey = cmds.getAttr(l_oSels[2], keyable=True)
    s_channel = False
    if i_atKey == 1:
        s_keyable = True
    else:
        s_keyable = False
        i_atHidden = cmds.getAttr(l_oSels[2], channelBox=True)
        if i_atHidden == 0:
            s_channel = False
        else:
            s_channel = True
    cmds.setAttr(l_oSels[2], keyable=s_keyable, channelBox=s_channel)
    if i_s_button == "rsKeyable":
        cmds.setAttr(l_oSels[2], keyable=True, channelBox=False)
    if i_s_button == "rsDisplayable":
        cmds.setAttr(l_oSels[2], keyable=False, channelBox=True)
    if i_s_button == "rsHidden":
        cmds.setAttr(l_oSels[2], keyable=False, channelBox=False)
    l_ChannelAtList = rsChannelAtList()
    l_AttrKey = l_ChannelAtList[0]
    l_AttrKeyHidden = l_ChannelAtList[1]
    if l_AttrKey or l_AttrKeyHidden:
        cmds.textScrollList("rsAttributeScroll", edit=True, removeAll=True, append=l_AttrKey)
        cmds.textScrollList("rsAttributeScrollHidden", edit=True, removeAll=True, append=l_AttrKeyHidden)
    rsSearchInScroll(l_oSels[1])
    return True
Exemple #7
0
        def populatescrollList(self,newLocation=None):
                """Edit textScrollList and update with selected location"""

                hideTheseFolders=["thumb", ".thumb",".mayaSwatches","RECYCLER","$AVG",
                                  "$Recycle.Bin","$RECYCLE.BIN","INCINERATE","Config.Msi",".dropbox.cache"
                                  "System Volume Information","Recovery","ProgramData","PROGRAMDATA",
                                  "PerfLogs"]


                if newLocation==None: locationTxt=cmds.textField('location',q=True,tx=True)
                else: locationTxt=newLocation

                cmds.textScrollList('fileLister', edit=True,removeAll=True)
                try:
                        [cmds.textScrollList('fileLister', edit=True,append=each) for each in os.listdir(locationTxt)  if os.path.isdir(os.path.join(locationTxt,each)) and each not in hideTheseFolders]
                        [cmds.textScrollList('fileLister', edit=True,ams=False, append=self.sizeof(os.path.join(locationTxt,each))) for nfile in self.fileFilters for each in os.listdir(locationTxt) if each.endswith(nfile)]
                except:
                        insel= cmds.textField('location',q=True,tx=True)
                        if not os.path.exists(insel):
                                msg="You either moved or renamed %s project folder\n Or the Drive that contained this folder is not connected."%os.path.basename(insel)
                                api.MGlobal.displayWarning(msg)
                                reply=cmds.confirmDialog(t='Warning',msg="Selected favrite item not found on disk.\nDo you want to delete it?",button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
                                if reply =="Yes":
                                        accAction=Actions()
                                        accAction.removeSel()
                                else:
                                        pass
Exemple #8
0
 def selectedFilesFromList(self):
     ctrlPath = '|'.join([self.window, 'groupBox', 'listWidget']);
     self.selectedFiles = cmds.textScrollList(ctrlPath, query=True, si=True);
     
     self.filesToCreate = 0
     self.filesCreated = 0
     self.createdErrors = 0
     
     if not self.selectedFiles:
         updateProgressMessage(self.window, 0, 0, 0)    
         return
     
     list = cmds.textScrollList(ctrlPath, query=True, ai=True);
     
     for i in range(len(self.selectedFiles)):
         texture = self.selectedFiles[i]
         if texture.startswith('       '):
             self.selectedFiles[i] = texture.replace('       ','',1)
         elif texture.startswith('(tx) '):
             self.selectedFiles[i] = texture.replace('(tx) ','',1)
         else:
             self.selectedFiles[i] = ""
             continue;
         texture = self.selectedFiles[i]
         if 'udim' in os.path.basename(texture):
             udims = getUdims(texture)
             self.filesToCreate += len(udims)
         else:
             self.filesToCreate += 1
     
     updateProgressMessage(self.window, self.filesCreated, self.filesToCreate, 0)
     ctrlPath = '|'.join([self.window, 'groupBox_3', 'label_10']);
     cmds.text(ctrlPath, edit=True, label="");
    def populate(self):
        sets = mel.zooVisManListHeirarchically()

        cmd.textScrollList(self.UI_tsl_sets, e=True, ra=True)
        while True:
            try:
                vset = sets.pop(0)
                name = self.EXPANDED
                childSets = mel.zooSetRelatives(vset, 0, 0, 1)
                depth = len(
                    mel.zooSetRelatives(vset, 0, 1, 1)
                )  # count the number of parents to see how deep in the tree the set is

                if not childSets:
                    name = self.SPACER
                if cmd.objExists("%s.isoCollapse" % vset):
                    # if this set is collapsed we need to remove all its children from the list and change the name prefix
                    name = self.COLLAPSED
                    for toRemove in childSets:
                        sets.remove(toRemove)

                name += self.SPACER * depth
                name += vset
                cmd.textScrollList(self.UI_tsl_sets, e=True, a=name)
            except IndexError:
                break

        self.updateSelection()
Exemple #10
0
 def updateCondition(self, *args ):
     
     rootName = cmds.textField( self._rootField, q=1, tx=1 )
     
     children = cmds.listRelatives( rootName, c=1, ad=1 )
     
     angleDriverList = []
     for child in children:
         hists = cmds.listHistory( child )
         
         for hist in hists:
             if cmds.nodeType( hist ) == 'angleDriver':
                 if not hist in angleDriverList:
                     angleDriverList.append( hist )
                     
     onlyMoved = cmds.checkBox( self._showOnlyMovedCheck, q=1, v=1 )
     
     showDrivers = []
     
     minValue = cmds.floatField( self._smallerValueField, q=1, v=1 )
     
     if onlyMoved:
         for driver in angleDriverList:
             angle1, angle2, angle3 = cmds.getAttr( driver+'.outDriver' )[0]
             
             if math.fabs( angle1 ) > minValue or math.fabs( angle2 ) > minValue or math.fabs( angle3 ) > minValue:
                 showDrivers.append( driver )
     else:
         for driver in angleDriverList:
             showDrivers.append( driver )
             
     cmds.textScrollList( self._driverList, e=1, ra=1, a=showDrivers )
Exemple #11
0
 def InitWindow( self ):
     self._window = cmds.window( self.windowID, title = 'FBX Exporter', sizeable=False, resizeToFitChildren=True ) 
     cmds.columnLayout()
     cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1,self.Layout.CLWIDTH), (2,self.Layout.CLWIDTH), (3,self.Layout.CLWIDTH)], \
                           rowSpacing=[(1,self.Layout.SPACING), (2,self.Layout.SPACING), (3,self.Layout.SPACING)] )
     cmds.text( label='Export current scene' )
     cmds.separator(visible=False)   
     cmds.separator(visible=False)
     cmds.button( 'Export All', width=self.Layout.BWIDTH, command=self.button_ExportAll_pressed )
     cmds.button( 'Export Selected', width=self.Layout.BWIDTH, command=self.button_ExportSelected_pressed )
     cmds.button( 'Open Current Scene', width=self.Layout.BWIDTH, command=self.button_OpenCurrentScene_pressed )
     cmds.text( label='Batch export' )
     cmds.separator(visible=False)   
     cmds.separator(visible=False)
     cmds.button( 'Add Folder', width=self.Layout.BWIDTH, command=self.button_AddFolder_pressed )
     cmds.button( 'Export All Files', width=self.Layout.BWIDTH, command=self.button_ExportAllFiles_pressed ) 
     cmds.button( 'Delete Selected', width=self.Layout.BWIDTH, command=self.button_DeleteSelected_pressed )
     cmds.separator()
     cmds.separator()
     cmds.separator()
     cmds.setParent( '..' )
     cmds.rowColumnLayout( numberOfColumns=1, columnWidth=(1,3*self.Layout.CLWIDTH) )
     cmds.progressBar('ProgressBar', width=3*self.Layout.BWIDTH )
     cmds.textScrollList( 'scrollList', allowMultiSelection=False)
     cmds.setParent( '..' )
     cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1,self.Layout.CLWIDTH), (2,self.Layout.CLWIDTH), (3,self.Layout.CLWIDTH)], \
                           rowSpacing=[(1,self.Layout.SPACING), (2,self.Layout.SPACING), (3,self.Layout.SPACING)] )
     cmds.separator()
     cmds.separator()
     cmds.separator()
     cmds.separator(visible=False)
     cmds.separator(visible=False)
     cmds.button( 'Close', width=self.Layout.BWIDTH, command=self.button_Close_pressed )
	def installModule(self,mod,moduleName,*args):
		self.disableSelectionScriptJob()
		
		moduleNamespace = self.currentBlueprintModule + ':' + mod.CLASS_NAME + '_1'
		
		moduleClass = getattr(mod,mod.CLASS_NAME)
		moduleInstance = moduleClass(moduleNamespace)
		moduleInstance.install()
		
		cmds.textScrollList(self.UIElements['controlModule_textScrolllist'],edit=True,removeItem=moduleName)
		
		if cmds.textScrollList(self.UIElements['controlModule_textScrolllist'],q=True, numberOfItems=True) != 0:
			cmds.textScrollList(self.UIElements['controlModule_textScrolllist'],edit=True,selectIndexedItem=1)
			
		self.UI_controlModuleSelected()
		
		utils.forceSceneUpdate()
		
		cmds.select(self.currentBlueprintModule + ':module_container', replace=True)
		
		
			
		
		
		self.setupSelectionScriptJob()
def gui():
	'''
	GUI for Image convert script.
	'''
	
	win = "mecCVTWin"
	winWidth = 200
	winHeight = 369
	
	if( cmds.window(win, q=True, ex=True) ):
		cmds.deleteUI(win)
		
	cmds.window(win, title="Image Converter", w=winWidth, h=winHeight)
	cmds.columnLayout("mecCVTMC")
	
	cmds.button(label="Get Directory", w=200,
		c="mecConvert.pickFolder()")
	cmds.scrollField( "mecCVTDir", w=winWidth,
		editable=False, wordWrap=True, text='Choose Directory' )
	# cmds.text("mecCVTDir", label="")
	
	cmds.textScrollList("mecCVTTSL", w=winWidth, h=200,
		allowMultiSelection=True)
	cmds.rowColumnLayout(nc=2, cw=[[1,100],[2,100]])
	cmds.button(label="Remove ALL",
		c="mecConvert.cmds.textScrollList('mecCVTTSL', e=True, ra=True)")
	cmds.button(label="Remove Selected",
		c="mecConvert.tslRemSel()")
	cmds.setParent("..")
	cmds.button(label="Convert", w=200,
		c="mecConvert.convert()")
	cmds.picture(image="sbaLogo.xpm", w=210, h=20)
	
	cmds.showWindow(win)
Exemple #14
0
    def refreshTextScrollList(self, *args ):
        
        targetWorldCtl = cmds.textField( self._worldCtl, q=1, tx=1 )
        
        refs = cmds.ls( type='reference' )

        worldCtls = []
        for ref in refs:
            try :ctls = cmds.reference( rfn=ref, n=1 )
            except: continue
            for ctl in ctls:
                if ctl == targetWorldCtl: continue
                if ctl[-9:] == 'World_CTL':
                    worldCtls.append( ctl )
                    break
                elif ctl.find( 'DGTR' ) != -1 and ctl[-4:] == '_CTL':
                    namespace = ctl.split( 'DGTR' )[0]
                    worldCtls.append( namespace+'DGTR_World_CTL' )
                    break
           
        connectedCtls = retargetCmd.getConnectedRetargetWorldCtl( targetWorldCtl )
        
        for connectedCtl in connectedCtls:
            worldCtls.remove( connectedCtl )
        
        cmds.textScrollList( self._retargetList, e=1, ra=1, a=connectedCtls )
        cmds.textScrollList( self._transformList, e=1, ra=1 )
def rsSelChange():
    l_oSels = cmds.ls(selection=True)
    s_sel = "select one object"
    if len(l_oSels) == 1:
        s_sel = l_oSels[0]
        l_ChannelAtList = rsChannelAtList()
        l_AttrKey = l_ChannelAtList[0]
        l_AttrKeyHidden = l_ChannelAtList[1]
        if l_AttrKey or l_AttrKeyHidden:
            cmds.textScrollList("rsAttributeScroll", edit=True, removeAll=True, append=l_AttrKey, selectItem=l_AttrKey[0])
            cmds.textScrollList("rsAttributeScrollHidden", edit=True, removeAll=True, append=l_AttrKeyHidden)
            attSelected()
        else:
            rsAttNoEnable()
            rsEnumNoEnable()
            rsLockNoEnable()
            rsPropertyNoEnable()
            rsMinNoEnable()
            rsMaxNoEnable()
            rsAttDefaultNoEnable()
            rsCheckNoEnable()
    else:
        rsAttNoEnable()
        rsEnumNoEnable()
        rsLockNoEnable()
        rsPropertyNoEnable()
        rsMinNoEnable()
        rsMaxNoEnable()
        rsAttDefaultNoEnable()
        rsCheckNoEnable()
    s_UiName = "rs Edit Atribute >> " + s_sel
    cmds.window("rsEditAtribute", edit=True, title=s_UiName)
    return True
Exemple #16
0
def reloadInfo():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape: blendShape = ['']
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	target = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	if not target: target = ['']
	
	# Get Derived Data
	baseIndex = ''
	targetGeo = ''
	targetIndex = ''
	if base[0]: baseIndex = glTools.utils.blendShape.getBaseIndex(blendShape[0],base[0])
	if target[0]: targetGeo = glTools.utils.blendShape.getTargetGeo(blendShape[0],target[0],base[0])
	if target[0]: targetIndex = glTools.utils.blendShape.getTargetIndex(blendShape[0],target[0])
	
	infoTxt = 'BlendShape: '+blendShape[0]+'\n'
	infoTxt += 'Base Geometry: '+base[0]+'\n'
	infoTxt += 'Base Index: '+str(baseIndex)+'\n'
	infoTxt += 'Target Name: '+target[0]+'\n'
	infoTxt += 'Target Geometry: '+targetGeo+'\n'
	infoTxt += 'Target Index: '+str(targetIndex)
	
	mc.scrollField('bsMan_infoSF',e=True,text=infoTxt)
def rsChName(i_s_textField, s_name):
    l_oSels = rsObjList()
    i_LockState = cmds.getAttr(l_oSels[2], lock=True)
    if i_LockState:
        cmds.setAttr(l_oSels[2], lock=False)
    if s_name == "NewName":
        s_NewName = l_oSels[0] + "." + i_s_textField
        cmds.renameAttr(l_oSels[2], i_s_textField)
        if i_LockState:
            cmds.setAttr(s_NewName, lock=True)
        s_search = i_s_textField
    else:
        cmds.addAttr(l_oSels[2], edit=True, niceName=i_s_textField)
        if i_LockState:
            cmds.setAttr(l_oSels[2], lock=True)
        s_search = l_oSels[1]
    l_ChannelAtList = rsChannelAtList()
    l_AttrKey = l_ChannelAtList[0]
    l_AttrKeyHidden = l_ChannelAtList[1]
    if l_AttrKey or l_AttrKeyHidden:
        cmds.textScrollList("rsAttributeScroll", edit=True, removeAll=True, append=l_AttrKey)
        cmds.textScrollList("rsAttributeScrollHidden", edit=True, removeAll=True, append=l_AttrKeyHidden)
    cmds.select(cl=True)
    cmds.select(l_oSels[0], r=True)
    rsSearchInScroll(s_search)
    return True
Exemple #18
0
def addTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	targetGeo = mc.textFieldButtonGrp('bsMan_addTargetGeoTFB',q=True,text=True)
	targetName = mc.textFieldGrp('bsMan_addTargetNameTFG',q=True,text=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if base[0] and not mc.objExists(base[0]):
		raise Exception('Base geometry "'+base[0]+'" does not exist!')
	if not mc.objExists(targetGeo):
		raise Exception('Target geometry "'+targetGeo+'" does not exist!')
	
	# Add BlendShape Target
	glTools.utils.blendShape.addTarget(	blendShape=blendShape[0],
										target=targetGeo,
										base=base[0],
										targetIndex=-1,
										targetAlias=targetName,
										targetWeight=0.0,
										topologyCheck=False	)
	
	# Reload
	reloadUI()
def mainEditAt():
    l_oSels = cmds.ls(selection=True)
    if len(l_oSels) == 1:
        editAtUI(l_oSels)
        l_ChannelAtList = rsChannelAtList()
        l_AttrKey = l_ChannelAtList[0]
        l_AttrKeyHidden = l_ChannelAtList[1]
        if l_AttrKey or l_AttrKeyHidden:
            cmds.textScrollList("rsAttributeScroll", edit=True, removeAll=True, append=l_AttrKey, selectItem=l_AttrKey[0])
            cmds.textScrollList("rsAttributeScrollHidden", edit=True, removeAll=True, append=l_AttrKeyHidden)
            attSelected()
        else:
            rsAttNoEnable()
            rsEnumNoEnable()
            rsLockNoEnable()
            rsPropertyNoEnable()
            rsMinNoEnable()
            rsMaxNoEnable()
            rsAttDefaultNoEnable()
            rsCheckNoEnable()
    else:
        editAtUI(l_oSels)
        rsAttNoEnable()
        rsEnumNoEnable()
        rsLockNoEnable()
        rsPropertyNoEnable()
        rsMinNoEnable()
        rsMaxNoEnable()
        rsAttDefaultNoEnable()
        rsCheckNoEnable()
Exemple #20
0
def connectToTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	target = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	if not target:
		print('No blendShape target selected!')
		return
	targetGeo = mc.textFieldButtonGrp('bsMan_connectTargetTFB',q=True,text=True)
	targetWt = mc.floatSliderGrp('bsMan_connectTargetFSG',q=True,v=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if base[0] and not mc.objExists(base[0]):
		raise Exception('Base geometry "'+base[0]+'" does not exist!')
	if not mc.objExists(targetGeo):
		raise Exception('Target geometry "'+targetGeo+'" does not exist!')
	
	# Add BlendShape Target Inbetween
	glTools.utils.blendShape.connectToTarget(	blendShape=blendShape[0],
											targetGeo=targetGeo,
											targetName=targetName[0],
											baseGeo=base[0],
											weight=1.0	)
	
	# Reload
	reloadUI()
Exemple #21
0
def moveUpTSLPosition(TSL):
	'''
	Move the selected textScrollList items up by one position
	@param TSL: The name of th textScrollList to manipulate
	@type TSL: str
	'''
	# Method variables
	minIndex = 1
	
	# Get selected item indices
	listItems = mc.textScrollList(TSL,q=True,si=True)
	listIndex = mc.textScrollList(TSL,q=True,sii=True)
	
	# Iterate through list items
	for i in range(len(listIndex)):
		# Check minIndex
		if listIndex[i] <= minIndex:
			minIndex += 1
			continue
		mc.textScrollList(TSL,e=True,sii=listIndex[i])
		listIndex[i] -= 1
		moveToTSLPosition(TSL,listIndex[i])
	
	# Select list items
	mc.textScrollList(TSL,e=True,da=True)
	mc.textScrollList(TSL,e=True,sii=listIndex)
	mc.textScrollList(TSL,e=True,shi=listIndex[0])
Exemple #22
0
def removeTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	targetList = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	if not targetList:
		print('No blendShape targets selected!')
		return
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if base[0] and not mc.objExists(base[0]):
		raise Exception('Base geometry "'+base[0]+'" does not exist!')
	
	# Remove BlendShape Targets
	for target in targetList:
		if not glTools.utils.blendShape.hasTarget(blendShape[0],target):
			print('BlendShape "'+blendShape[0]+'" has no target "'+target+'"! Skipping...')
			continue
		glTools.utils.blendShape.removeTarget(blendShape=blendShape[0],target=target,baseGeo=base[0])
	
	# Reload
	reloadUI()
def convert(*args):
	'''
	Convert chosen files into xpm.
	'''	
	# Grab the path from the ScrollField
	targetPath = cmds.scrollField( "mecCVTDir", q=True, text=True)
	
	# Grabbing the selected elements from the textScrollList
	tslSel = cmds.textScrollList("mecCVTTSL", q=True, si=True)
	
	# - Checking to see if anything is selcted in the textScrollList
	#   if nothing is selected grab everything.
	if( not(tslSel) ):
		print("Nothing selected in textScrollList Selected.\n Converting everything.")
		tslSel = cmds.textScrollList("mecCVTTSL", q=True, ai=True)

	
	for tsl in tslSel:
		# Creating the proper path to the files.
		# split file up to get the file name with out the extension.
		baseFile = tsl.split(".")[0]
		destFile = '"' + targetPath + "/""" + baseFile + '.xpm"'
		
		sourceFile = '"' + targetPath + "/" + tsl + '"'
		
		# Switching from front slashes to backslashes if on a windows machine.
		if(cmds.about(os=True) == "nt"):
			destFile = convertSlashes( destFile )
			sourceFile = convertSlashes( sourceFile )
			
		# Compiling the command line to convert the images.
		runLine = 'imconvert ' + sourceFile + " " + destFile
		print(runLine)
		# Executing the imconvert program from the command prompt (DOS)
		os.popen2(runLine)
Exemple #24
0
def renameTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	target = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	if not target:
		print('No blendShape target selected!')
		return
	targetName = mc.textFieldGrp('bsMan_renameTargetTFB',q=True,text=True)
	if not targetName:
		print('No target name specified!')
		return
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if not glTools.utils.blendShape.hasTarget(blendShape[0],target[0]):
		raise Exception('BlendShape "" has not target "'+target+'"!')
	
	# Rename BlendShape Target
	glTools.utils.blendShape.renameTarget(blendShape=blendShape[0],target=target[0],newName=targetName)
	
	# Reload
	reloadUI()
def selectNode():
    """
    Select node from reference edits UI.
    """
    # Get Selected Ref Node
    refNode = cmds.textScrollList('refEdits_refListTSL', q=True, si=True)
    if not refNode: return
    refNS = glTools.utils.reference.getNamespace(refNode[0]) + ':'

    # Get Selected Nodes
    nodeList = cmds.textScrollList('refEdits_nodeListTSL', q=True, si=True)
    if not nodeList: return

    # Select Nodes
    selNodes = []
    for node in nodeList:

        # Check Node
        editNode = node
        if not cmds.objExists(node): node = node.split('|')[-1]
        if not cmds.objExists(node): node = refNS + node
        if not cmds.objExists(node): raise Exception('Reference edit node "' + editNode + '" not found!')

        # Append to Selection List
        selNodes.append(node)

    # Select Node
    if selNodes: cmds.select(selNodes)
Exemple #26
0
def bsManUpdateTargetsFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: raise Exception('No base (old) geometry specified!')
	oldBase = base[0]
	newBase = mc.textFieldButtonGrp('bsMan_updateTargetTFB',q=True,text=True)
	targetList = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if not mc.objExists(oldBase):
		raise Exception('Old base geometry "'+oldBase+'" does not exist!')
	if not mc.objExists(newBase):
		raise Exception('New base geometry "'+newBase+'" does not exist!')
	if not targetList: raise Exception('Empty target list!')
	
	# Get Target Geometry
	targetGeoList = []
	for target in targetList:
		targetGeo = glTools.utils.blendShape.getTargetGeo(blendShape[0],target,baseGeo=oldBase)
		if not targetGeo:
			print('No target geometry found for target name"'+target+'"! Skipping')
			continue
		targetGeoList.append(targetGeo)
	
	# Update Targets
	glTools.tools.blendShape.updateTargets(oldBase,newBase,targetGeoList)
def filterNodeList():
    """
    """
    # Filter List
    nodeSearchStr = cmds.textFieldButtonGrp('refEdits_nodeSearchTFG', q=True, text=True)
    if not nodeSearchStr: return

    # Get Node List
    nodeList = cmds.textScrollList('refEdits_nodeListTSL', q=True, ai=True)
    if not nodeList: return

    # Check Negative Filter
    if nodeSearchStr.startswith('!'):
        if nodeSearchStr.startswith('!*'):
            nodeList = list(set([i for i in nodeList if not i.endswith(nodeSearchStr[2:])]))
        elif nodeSearchStr.endswith('*'):
            nodeList = list(set([i for i in nodeList if not i.startswith(nodeSearchStr[1:-1])]))
        else:
            nodeList = list(set([i for i in nodeList if not nodeSearchStr[1:] in i]))
    else:
        if nodeSearchStr.startswith('*'):
            nodeList = list(set([i for i in nodeList if i.endswith(nodeSearchStr[1:])]))
        elif nodeSearchStr.endswith('*'):
            nodeList = list(set([i for i in nodeList if i.startswith(nodeSearchStr[:-1])]))
        else:
            nodeList = list(set([i for i in nodeList if nodeSearchStr in i]))

    # Apply Filtered Node List
    cmds.textScrollList('refEdits_nodeListTSL', e=True, ra=True)
    for node in sorted(nodeList): cmds.textScrollList('refEdits_nodeListTSL', e=True, a=node)
Exemple #28
0
 def selectionChangedCmd( self, *args ):
     
     cmds.textScrollList( self._meshList, e=1, da=1 )
     cmds.textScrollList( self._selMeshList, e=1, da=1 )
     sels = cmds.ls( sl=1 )
     
     if not sels: return None
     
     meshItems = cmds.textScrollList( self._meshList, q=1, ai=1 )
     selMeshItems = cmds.textScrollList( self._selMeshList, q=1, ai=1 )
     
     if not meshItems: meshItems = []
     if not selMeshItems: selMeshItems = []
     
     meshItemTargets = []
     selMeshItemTargets = []
     for sel in sels:
         if sel in meshItems:
             meshItemTargets.append( sel )
         if sel in selMeshItems:
             selMeshItemTargets.append( sel )
     
     if not meshItemTargets: return None
     cmds.textScrollList( self._meshList, e=1, si=meshItemTargets )
     if not selMeshItemTargets : return None
     cmds.textScrollList( self._selMeshList, e=1, si=selMeshItemTargets )
	def remSelItems(self):
		'''
		Remove selected Items from the textScrollList
		'''
		selItems = self.getSelItems()
		for item in selItems:
			cmds.textScrollList( self.tsl, edit=True, ri=item )
Exemple #30
0
 def create(self, *args ):
     
     top, left = cmds.window( WindowInfo._window, q=1, topLeftCorner=1 )
     
     top  += 70
     left +=19
     
     itemIndex = cmds.textScrollList( FolderUIInfo._scrollListUI, q=1, sii=1 )
     if not itemIndex: return None
     selItem = cmds.textScrollList( FolderUIInfo._scrollListUI, q=1, si=1 )[0].split('.')[0]
     
     top += itemIndex[0]*13
     
     if cmds.window( FolderSubRenameUiInfo._winName, ex=1 ):
         cmds.deleteUI( FolderSubRenameUiInfo._winName )
     cmds.window( FolderSubRenameUiInfo._winName, titleBar=0 )
     
     cmds.columnLayout()
     cmds.rowColumnLayout( nc=3, cw=[(1,120),(2,52),(3,25)] )
     textField = cmds.textField( tx=selItem )
     cmds.button( l='Rename', c=FolderSubRenameUiInfo.cmdRename )
     cmds.button( l='X' , c=self.cmdDeleteWindow, bgc=[0.9,0.35,0.35] )
     
     cmds.windowPref( FolderSubRenameUiInfo._winName, e=1,
                      widthHeight = [ FolderSubRenameUiInfo._width, FolderSubRenameUiInfo._height ],
                      topLeftCorner = [ top, left ] )
     cmds.showWindow( FolderSubRenameUiInfo._winName )
     
     FolderSubRenameUiInfo._renameTextField = textField