Пример #1
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
Пример #2
0
	def remSelItems(self):
		'''
		Remove selected Items from the textScrollList
		'''
		selItems = self.getSelItems()
		for item in selItems:
			cmds.textScrollList( self.tsl, edit=True, ri=item )
Пример #3
0
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)
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)
Пример #5
0
 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()
Пример #6
0
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)
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
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)
Пример #10
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])
Пример #11
0
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)
Пример #12
0
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()
Пример #13
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
Пример #14
0
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
Пример #15
0
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
Пример #16
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 )
Пример #17
0
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
Пример #18
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()
Пример #19
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)
Пример #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()
Пример #21
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()
Пример #22
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)
Пример #23
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="");
Пример #24
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 )
Пример #25
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 )
Пример #26
0
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)
	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()
Пример #28
0
    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()
Пример #29
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 )
Пример #30
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()
Пример #31
0
def remove_mesh():
    mc.textScrollList("the_mod_list", e=True, ra=True)
Пример #32
0
	def bdUpdateSelected(self,*args):
		cmds.textScrollList(self.uiObjects['listOriginal'],edit = True, ra = True)
		self.bdPopulateListOriginal()
Пример #33
0
	def bdPopulateListOriginal(self,*args):
		selectedObj = []
		selectedObj = cmds.ls(selection = True )
		for item in selectedObj:
			cmds.textScrollList(self.uiObjects['listOriginal'],edit = True, append = item)
Пример #34
0
def makeGui():

    if (mc.window("fixVertWin", exists=True)):
        mc.deleteUI("fixVertWin", wnd=True)
        mc.windowPref("fixVertWin", r=True)

    # C R E A T E  U I
    mc.window("fixVertWin", s=False, tlb=True, rtf=True, t="Translate Vertex")
    mc.columnLayout(adj=True)

    # S O U R C E  O B J E C T S
    mc.frameLayout(l="Source",
                   la="top",
                   bgc=(0.329, 0.47, 0.505),
                   cll=False,
                   cl=False,
                   w=200)
    mc.columnLayout(adj=True)
    mc.button(label="Set Source Object",
              bgc=(0.27, 0.68, 0.66),
              c=lambda *x: getSourceObj(),
              h=30)
    mc.textScrollList("getSrcObjList", h=30, ams=False)
    mc.setParent('..')
    mc.setParent('..')

    # T A R G E T  O B J E C T S
    mc.frameLayout(l="Target",
                   la="top",
                   bgc=(0.1, 0.1, 0.1),
                   cll=False,
                   cl=False,
                   w=200)
    mc.columnLayout(adj=True)
    mc.button(label="Set Target Object(s)",
              bgc=(0.21, 0.67, 0.72),
              c=lambda *x: getTargetObj(),
              h=30)
    mc.textScrollList("getTargetObjList", h=100, ams=False)

    # T A R G E T  V E R T I C E S
    mc.frameLayout(l="Vertex Selection",
                   la="top",
                   bgc=(0.1, 0.1, 0.1),
                   cll=False,
                   cl=False,
                   w=200)
    mc.button(label="Get Selected Verts",
              bgc=(0.21, 0.67, 0.72),
              c=lambda *x: getVerticies(),
              h=30)
    mc.textScrollList("getSelVertList", h=30, ams=False)

    # I N V E R S E  S E T  S E L E C T I O N
    mc.frameLayout(l="Outliner Set Selection",
                   la="top",
                   bgc=(0.1, 0.1, 0.1),
                   cll=False,
                   cl=False,
                   w=200)
    mc.button(label="Create Inverse Vert Set",
              bgc=(0.21, 0.67, 0.72),
              c=lambda *x: createVertSet(),
              h=30)
    mc.textScrollList("vertSetList", h=30, ams=False)

    # O U T L I N E R  C O L O R
    mc.frameLayout(l="Outliner Color",
                   la="top",
                   bgc=(0.1, 0.1, 0.1),
                   cll=False,
                   cl=False,
                   w=200)
    mc.columnLayout(adj=True)
    mc.rowLayout(nc=5)
    mc.floatField('intRedValField', min=0.0, max=1.0, w=40)
    mc.floatField('intGreenValField', min=0.0, max=1.0, w=40)
    mc.floatField('intBlueValField', min=0.0, max=1.0, w=40)
    mc.button(label="Set Color",
              bgc=(0.21, 0.67, 0.72),
              c=lambda *x: setOutlineColor(),
              h=30,
              w=80)
    mc.setParent('..')
    mc.setParent('..')
    # U P D A T E  V E R T I C E S

    mc.button(label="Update Verts",
              bgc=(0.24, 0.72, 0.46),
              c=lambda *x: sortObjs(),
              h=40)

    mc.setParent('..')
    mc.setParent('..')

    # S H O W  W I N D O W
    mc.showWindow("fixVertWin")
Пример #35
0
def window_xGPU():

    if mc.window("xGPU", ex=True):
        mc.deleteUI("xGPU")
    mc.window("xGPU", title="xGPUcache V1.2", sizeable=True)
    mc.rowColumnLayout(numberOfColumns=1)
    mc.frameLayout(label=u"步骤一:选择要导出的场景模型")
    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 200), (2, 185)])
    mc.textScrollList("the_cj_list", w=200, h=110, bgc=(0.3, 0.3, 0.3))

    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 90), (2, 90)])
    mc.text(label=u"           → 代理文件导出")
    mc.text(label=u"设置 ←                  ")

    mc.text(label="")
    mc.text(label="")

    mc.text(label="")
    mc.text(label="")

    mc.text(label=u"输出代理")
    mc.optionMenu("the_dai", label="")
    mc.menuItem(l="Arnold")
    mc.menuItem(l="Vray")

    mc.text(label="")
    mc.text(label="")

    mc.text(label="")
    mc.text(label="")
    mc.button(label=u"载入所选", h=30, c="OCT_generel.OCT_xGPUCache.load_cj()")
    mc.button(label=u"清空列表", c="OCT_generel.OCT_xGPUCache.remove_cj()")

    mc.setParent('..')
    mc.setParent('..')

    mc.frameLayout(label=u"步骤二 : 选择所有需要转化缓存的组或者模型")
    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 200), (2, 185)])

    mc.textScrollList("the_mod_list", w=200, h=170, bgc=(0.3, 0.3, 0.3))

    mc.rowColumnLayout(numberOfColumns=1)
    mc.text(label=u"→ 缓存导出设置 ←")

    mc.rowColumnLayout(numberOfColumns=3, cw=[(1, 80), (2, 50), (3, 50)])
    mc.text(label="")
    mc.text(label="")
    mc.text(label="")

    mc.text(label=u"缓存类型")
    mc.optionMenu("cacheData",
                  label="",
                  cc="OCT_generel.OCT_xGPUCache.getCacheName()")
    mc.menuItem(l="ABC")
    mc.menuItem(l="GPU")
    mc.menuItem(l="GEO")
    mc.menuItem(l="blend")
    mc.text(label="")

    mc.text(label="")
    mc.text(label="")
    mc.text(label="")

    mc.text(label="Start/End")
    get_start_frame = mc.playbackOptions(q=True, min=True)
    get_end_frame = mc.playbackOptions(q=True, max=True)
    mc.intField("the_ST_ABC", v=get_start_frame)
    mc.intField("the_ET_ABC", v=get_end_frame)

    mc.text(label="Evaluate every")
    mc.floatField("the_EVA_every", v=1.0000)
    mc.text(label="")

    mc.text(label="")
    mc.text(label="")
    mc.text(label="")

    mc.text(label=u"是否导出UV")
    mc.checkBox("if_write_UV", label="UV W", v=1)
    mc.text(label="rite           ")

    mc.text(label=u"是否合并模型")
    mc.checkBox("if_combine", label="Comb", v=0)
    mc.text(label="")

    mc.text(label="")
    mc.text(label="")
    mc.text(label="")

    mc.setParent('..')

    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 90), (2, 90)])
    mc.button(label=u"载入所选", h=30, c="OCT_generel.OCT_xGPUCache.load_mesh()")
    mc.button(label=u"清空列表", c="OCT_generel.OCT_xGPUCache.remove_mesh()")

    mc.setParent('..')
    mc.setParent('..')
    mc.setParent('..')
    mc.setParent('..')
    mc.frameLayout(label=u"步骤三 : 是否有其他物体需要一并导出(如摄像机、灯光等等)")
    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 200), (2, 185)])
    mc.textScrollList("the_others_list", w=200, h=80, bgc=(0.3, 0.3, 0.3))
    mc.rowColumnLayout(numberOfColumns=1)
    mc.text(label="")
    mc.text(label="")
    mc.text(label=u"→ 如果没有,可清空 ←")
    mc.text(label="")

    mc.rowColumnLayout(numberOfColumns=2, cw=[(1, 90), (2, 90)])
    mc.button(label=u"载入所选", h=30, c="OCT_generel.OCT_xGPUCache.load_others()")
    mc.button(label=u"清空列表", c="OCT_generel.OCT_xGPUCache.remove_others()")
    mc.setParent('..')
    mc.setParent('..')
    mc.setParent('..')

    mc.setParent('..')
    mc.frameLayout(label=u"步骤四 : 最后的输出设置")
    mc.rowColumnLayout(numberOfColumns=3, cw=[(1, 90), (2, 230), (3, 60)])
    get_defaut_path = mc.workspace(en="scenes")
    mc.text(fn="boldLabelFont", label=u"文件输出位置:")
    the_out_abc_path = mc.textField("thePath_to_out",
                                    ed=False,
                                    tx=get_defaut_path + "/")
    mc.button(label=u"浏览...", c="OCT_generel.OCT_xGPUCache.set_path_output()")
    mc.text(fn="boldLabelFont", label=u"文件名:")
    get_current_filename = mc.file(q=True, sn=True)
    get_basename = os.path.splitext(os.path.basename(get_current_filename))
    mc.textField("the_out_file_name", tx=get_basename[0] + "_for_ABC")
    mc.optionMenu("the_ma_mb", label="")
    mc.menuItem(l=".mb")
    mc.menuItem(l=".ma")
    mc.setParent('..')
    mc.rowColumnLayout(numberOfColumns=4,
                       cw=[(1, 60), (2, 100), (3, 60), (4, 100)])
    mc.text(label="")
    mc.button(label=u"开始转换", c="OCT_generel.OCT_xGPUCache.if_start()")
    mc.text(label="")
    mc.button(label=u"打开目录", c="OCT_generel.OCT_xGPUCache.open_path_output()")
    mc.text(label="")

    mc.setParent('..')

    mc.showWindow("xGPU")
Пример #36
0
def remove_cj():
    mc.textScrollList("the_cj_list", e=True, ra=True)
Пример #37
0
def remove_others():
    mc.textScrollList("the_others_list", e=True, ra=True)
Пример #38
0
 def selectAll(self):
     query = cmds.textScrollList(self.filterList, q = True, allItems = True)
     cmds.textScrollList(self.filterList, e = True, selectItem=query)
     self.selectItem()
Пример #39
0
 def removeSelectedItem(self):
     sel = cmds.ls(sl = True)
     for item in sel:
         self.filterItems.remove(item)
     self.clearList()
     cmds.textScrollList(self.filterList, edit = True, append = self.filterItems)
Пример #40
0
def start_trans():

    get_frame_start = mc.intField("the_ST_ABC", q=True, v=True)
    get_frame_end = mc.intField("the_ET_ABC", q=True, v=True)
    write_UV = ["", "-uvWrite"]
    # world_Space = ["","-worldSpace"]
    ifUV = int(mc.checkBox("if_write_UV", q=True, v=True))
    # ifWP = 1
    daili = mc.optionMenu("the_dai", q=True, sl=True)
    get_cj_list = mc.textScrollList("the_cj_list", q=True, ai=True)
    if_comb = int(mc.checkBox("if_combine", q=True, v=True))
    get_final_out_path = mc.textField("thePath_to_out", q=True, tx=True)
    get_final_out_filename = mc.textField("the_out_file_name", q=True, tx=True)
    get_the_step = mc.floatField("the_EVA_every", q=True, v=True)
    dataType = int(mc.optionMenu("cacheData", q=True, sl=True))
    all_need_to_cache = mc.textScrollList("the_mod_list", q=True, ai=True)
    all_need_to_string = ""
    all_need_to_cache_string = ""
    all_need_to_cache_string_2 = ""
    #导出代理

    #输出缓存
    if if_comb == 1 and str(all_need_to_cache) != "None":
        for oneGroup in all_need_to_cache:
            Groups = mc.listRelatives(oneGroup, allParents=True)
            group_M = mc.ls(oneGroup, dag=True, ni=True, shapes=True)
            if len(group_M) > 1:
                objComb = mc.polyUnite(oneGroup,
                                       ch=True,
                                       mergeUVSets=True,
                                       name=oneGroup + "_comb")
                if Groups:
                    mc.parent(objComb[0], Groups[0])

            if len(group_M) == 1:
                oneObj = mc.listRelatives(group_M[0], allParents=True)
                mc.rename(oneObj, oneGroup + "_comb")
            all_need_to_string += "\"" + oneGroup + "_comb" + "\","

        if str(all_need_to_string) != 0:
            mc.textScrollList("the_mod_list", e=True, ra=True)
            exec("mc.textScrollList(\"the_mod_list\",e=True,append=(" +
                 all_need_to_string[0:-1] + "))")
    all_need_to_cache = mc.textScrollList("the_mod_list", q=True, ai=True)
    for one_cache in all_need_to_cache:
        all_need_to_cache_string += " -root " + one_cache
        all_need_to_cache_string_2 += one_cache + " "
    #导出ABC缓存
    if dataType == 1:
        get_cache_path = mc.workspace(en="cache")
        get_cache_paths = r'%s/alembic/' % get_cache_path
        if not os.path.isdir(get_cache_paths):
            os.makedirs(get_cache_paths)
        # mc.AbcExport(j="-frameRange "+str(get_frame_start)+" "+str(get_frame_end)+" "+"-step "+str(get_the_step)+" "+write_UV[ifUV]+" -worldSpace"+all_need_to_cache_string+" -file "+get_final_out_path+get_final_out_filename+".abc");
        mc.AbcExport(j="-frameRange " + str(get_frame_start) + " " +
                     str(get_frame_end) + " " + "-step " + str(get_the_step) +
                     " " + write_UV[ifUV] + " -worldSpace" +
                     all_need_to_cache_string + " -file " + get_cache_paths +
                     get_final_out_filename + ".abc")
        mc.delete(all_need_to_cache, ch=True)
        #mm.eval("AbcImport -mode import -connect \""+all_need_to_cache_string_2[0:-1]+"\" \""+get_final_out_path+get_final_out_filename+".abc"+"\"")
        mm.eval("AbcImport -mode import -connect \"" +
                all_need_to_cache_string_2[0:-1] + "\" \"" + get_cache_paths +
                get_final_out_filename + ".abc" + "\"")

    #导出GPU缓存
    if dataType == 2:
        get_cache_path = mc.workspace(en="cache")
        get_cache_paths = r'%s/alembic/' % get_cache_path
        if not os.path.isdir(get_cache_paths):
            os.makedirs(get_cache_paths)
        mc.select(all_need_to_cache, r=True)
        # mc.gpuCache(all_need_to_cache, startTime  = get_frame_start, endTime  = get_frame_end, saveMultipleFiles = False, optimize = False, writeMaterials = False, dataFormat = "ogawa", wuv = ifUV, directory= get_final_out_path, fileName  = get_final_out_filename)
        mc.gpuCache(all_need_to_cache,
                    startTime=get_frame_start,
                    endTime=get_frame_end,
                    saveMultipleFiles=False,
                    optimize=False,
                    writeMaterials=False,
                    dataFormat="ogawa",
                    wuv=ifUV,
                    directory=get_cache_paths,
                    fileName=get_final_out_filename)
        for one_gpu in all_need_to_cache:
            mc.polyTriangulate(one_gpu)
        mc.delete(all_need_to_cache, ch=True)
        # mm.eval("AbcImport -mode import -connect \"" +all_need_to_cache_string_2[0:-1] + "\" -createIfNotFound " + " \"" +get_final_out_path+get_final_out_filename+".abc"+"\"")
        mm.eval("AbcImport -mode import -connect \"" +
                all_need_to_cache_string_2[0:-1] + "\" -createIfNotFound " +
                " \"" + get_cache_paths + get_final_out_filename + ".abc" +
                "\"")

    #导出几何体缓存
    if dataType == 3:
        all_need_to_cache_shape = mc.ls(all_need_to_cache,
                                        dagObjects=True,
                                        ni=True,
                                        shapes=True)
        cacheFiles = mc.cacheFile(r=True,
                                  sch=True,
                                  dtf=True,
                                  fm='OneFile',
                                  spm=1,
                                  smr=1,
                                  directory=get_final_out_path,
                                  fileName=get_final_out_filename,
                                  st=get_frame_start,
                                  et=get_frame_end,
                                  points=all_need_to_cache_shape)
        mc.delete(all_need_to_cache, ch=True)
        myswichList = []
        myswichNode = []
        myNewcacheObjects = []
        switchText = ''
        for each in all_need_to_cache_shape:
            switch = mm.eval('createHistorySwitch("%s",false)' % each)
            myNewcacheObjects.append(each)
            myswichNode.append(switch)
            switchText = '%s.inp[0]' % switch
            myswichList.append(switchText)
            mc.setAttr('%s.playFromCache' % switch, 1)
        mc.cacheFile(f=get_final_out_filename,
                     directory=get_final_out_path,
                     cnm=myNewcacheObjects,
                     ia=myswichList,
                     attachFile=True)

    #输出blend缓存
    if dataType == 4:
        mc.select(all_need_to_cache, r=True)
        mm.eval('x_bakeShape(%s,%s,%s, "%s", 0, 0)' %
                (get_frame_start, get_frame_end, get_the_step,
                 get_final_out_filename))
        mc.textScrollList("the_mod_list", e=True, ra=True)
        exec(
            "mc.textScrollList(\"the_mod_list\",e=True,append=(get_final_out_filename+'_bakeshape_gp'))"
        )
        mc.delete(all_need_to_cache, ch=True)
        mc.select(hi=True)
    #导出另存文件
    all_need_to_cache = mc.textScrollList("the_mod_list", q=True, ai=True)
    all_need_others = mc.textScrollList("the_others_list", q=True, ai=True)
    if str(all_need_others) != "None":
        mc.select(all_need_others + all_need_to_cache, r=True)
    else:
        mc.select(all_need_to_cache, r=True)
    maormb = mc.optionMenu("the_ma_mb", q=True, sl=True)
    MA_MB = ["mayaBinary", "mayaAscii"]
    ma_mb = [".mb", ".ma"]
    mm.eval("file -force -options \"v=0;\" -typ \"" + MA_MB[maormb - 1] +
            "\" -pr -es \"" + get_final_out_path + get_final_out_filename +
            ma_mb[maormb - 1] + "\"")
Пример #41
0
 def clearList(self):
     cmds.textScrollList(self.filterList, edit = True, removeAll = True)
Пример #42
0
 def selectItem(self):
     itemQuery = cmds.textScrollList(self.filterList, query = True, selectItem = True)
     cmds.select(itemQuery)         
    def addCharacter(self, close, *args):

        project = cmds.optionMenu(self.widgets["project"], q=True, value=True)

        selectedCharacter = cmds.textScrollList(self.widgets["characterList"],
                                                q=True,
                                                si=True)[0]

        rigPath = self.mayaToolsDir + "/General/ART/Projects/" + project + "/AnimRigs/" + selectedCharacter + ".mb"

        #find existing namespaces in scene

        namespaces = cmds.namespaceInfo(listOnlyNamespaces=True)

        #reference the rig file

        cmds.file(rigPath,
                  r=True,
                  type="mayaBinary",
                  loadReferenceDepth="all",
                  namespace=selectedCharacter,
                  options="v=0")

        #clear selection and fit view

        cmds.select(clear=True)

        cmds.viewFit()

        panels = cmds.getPanel(type='modelPanel')

        #turn on smooth shading

        for panel in panels:

            editor = cmds.modelPanel(panel, q=True, modelEditor=True)

            cmds.modelEditor(editor,
                             edit=True,
                             displayAppearance="smoothShaded",
                             displayTextures=True,
                             textures=True)

        #find new namespaces in scene (this is here in case I need to do something later and I need the new name that was created)

        newCharacterName = selectedCharacter

        newNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)

        for name in newNamespaces:

            if name not in namespaces:

                newCharacterName = name

        #launch UI

        import ART_animationUI

        reload(ART_animationUI)

        ART_animationUI.AnimationUI()

        if close:

            cmds.deleteUI(self.widgets["window"])
Пример #44
0
 def addSelectedItem(self):
     sel = cmds.ls(sl = True)
     self.filterItems.extend(sel)
     self.clearList
     cmds.textScrollList(self.filterList, edit = True, append = self.filterItems)
Пример #45
0
def moveDownTSLPosition(TSL):
    """
    Move the selected textScrollList items down by one position
    @param TSL: The name of th textScrollList to manipulate
    @type TSL: str
    """
    # Get list length
    listLen = len(cmds.textScrollList(TSL, q=True, ai=True))
    maxIndex = listLen

    # Get selected item indices
    listItems = cmds.textScrollList(TSL, q=True, si=True)
    listIndex = cmds.textScrollList(TSL, q=True, sii=True)
    # Reverse lists
    listItems.reverse()
    listIndex.reverse()

    # Iterate through list items
    for i in range(len(listItems)):
        # Check maxIndex
        if listIndex[i] >= maxIndex:
            maxIndex -= 1
            continue
        cmds.textScrollList(TSL, e=True, sii=listIndex[i])
        listIndex[i] += 1
        if listIndex[i] == listLen:
            moveToTSLPosition(TSL, -1)
        else:
            moveToTSLPosition(TSL, listIndex[i] + 1)

    # Select list items
    cmds.textScrollList(TSL, e=True, da=True)
    cmds.textScrollList(TSL, e=True, sii=listIndex)
    cmds.textScrollList(TSL, e=True, shi=listIndex[0])
Пример #46
0
 def doRefresh(self, *args):
     self.getSelection()
     cmds.textScrollList(self.uiList, e=True, removeAll=True)
     cmds.textScrollList(self.uiList, e=True, append=self.listCustomAttrs())
Пример #47
0
def evaluationOrderUI():
    '''
	Main UI method for Evaluation Order setup tools
	'''
    # Window
    win = 'evaluationOrderUI'
    if mc.window(win, q=True, ex=True): mc.deleteUI(win)
    win = mc.window(win, t='Evaluation Order')
    # Form Layout
    evaluationOrderFL = mc.formLayout(numberOfDivisions=100)

    # Evaluation Order List
    evalOrderTSL = mc.textScrollList('evalOrderTSL', allowMultiSelection=True)

    # Buttons
    evalOrderRootB = mc.button(label='Set Selected As Root',
                               c='glTools.ui.poseMatch.evalOrderUIsetRoot()')
    evalOrderBuildB = mc.button(
        label='Build Root Hierarchy',
        c='glTools.ui.poseMatch.evalOrderUIbuildHierarchy()')
    evalOrderIKB = mc.button(label='Reorder Using IK',
                             c='glTools.ui.poseMatch.evalOrderUIreorderIK()')
    evalOrderConstraintB = mc.button(
        label='Reorder Using Constraints',
        c='glTools.ui.poseMatch.evalOrderUIreorderConstraints()')
    evalOrderReduceB = mc.button(
        label='Reduce To Selection',
        c='glTools.ui.poseMatch.evalOrderUIreduceToSelection()')
    evalOrderMoveUpB = mc.button(label='Move Up',
                                 c='glTools.ui.utils.moveUpTSLPosition("' +
                                 evalOrderTSL + '")')
    evalOrderMoveDnB = mc.button(label='Move Down',
                                 c='glTools.ui.utils.moveDownTSLPosition("' +
                                 evalOrderTSL + '")')
    evalOrderMoveToBottomB = mc.button(
        label='Move To Bottom',
        c='glTools.ui.utils.moveToTSLPosition("' + evalOrderTSL + '",-1)')
    evalOrderAddAttrB = mc.button(
        label='Add "evalOrder" attribute',
        c='glTools.ui.poseMatch.evalOrderUIaddAttr()')

    # Separators
    evalOrderReorderSEP = mc.separator(h=10, style='single')
    evalOrderReduceSEP = mc.separator(h=10, style='single')
    evalOrderMoveSEP = mc.separator(h=10, style='single')
    evalOrderAddAttrSEP = mc.separator(h=10, style='single')

    # Form Layout - MAIM
    #-
    # evalOrderTSL
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderTSL, 'left', 5), (evalOrderTSL, 'bottom', 5),
                      (evalOrderTSL, 'top', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderTSL, 'right', 5, 50)])
    # evalOrderRootB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderRootB, 'top', 5),
                      (evalOrderRootB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderRootB, 'left', 5, 50)])
    # evalOrderBuildB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderBuildB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderBuildB, 'top', 5, evalOrderRootB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderBuildB, 'left', 5, 50)])

    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderReorderSEP, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderReorderSEP, 'top', 5, evalOrderBuildB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderReorderSEP, 'left', 5, 50)])

    # evalOrderIKB
    mc.formLayout(evaluationOrderFL, e=True, af=[(evalOrderIKB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderIKB, 'top', 5, evalOrderReorderSEP)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderIKB, 'left', 5, 50)])
    # evalOrderConstraintB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderConstraintB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderConstraintB, 'top', 5, evalOrderIKB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderConstraintB, 'left', 5, 50)])

    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderReduceSEP, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderReduceSEP, 'top', 5, evalOrderConstraintB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderReduceSEP, 'left', 5, 50)])

    # evalOrderReduceB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderReduceB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderReduceB, 'top', 5, evalOrderReduceSEP)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderReduceB, 'left', 5, 50)])

    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderMoveSEP, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderMoveSEP, 'top', 5, evalOrderReduceB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderMoveSEP, 'left', 5, 50)])

    # evalOrderMoveUpB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderMoveUpB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderMoveUpB, 'top', 5, evalOrderMoveSEP)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderMoveUpB, 'left', 5, 50)])
    # evalOrderMoveDnB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderMoveDnB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderMoveDnB, 'top', 5, evalOrderMoveUpB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderMoveDnB, 'left', 5, 50)])
    # evalOrderMoveToBottomB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderMoveToBottomB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderMoveToBottomB, 'top', 5, evalOrderMoveDnB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderMoveToBottomB, 'left', 5, 50)])

    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderAddAttrSEP, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderAddAttrSEP, 'top', 5, evalOrderMoveToBottomB)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderAddAttrSEP, 'left', 5, 50)])

    # evalOrderAddAttrB
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  af=[(evalOrderAddAttrB, 'right', 5)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ac=[(evalOrderAddAttrB, 'top', 5, evalOrderAddAttrSEP)])
    mc.formLayout(evaluationOrderFL,
                  e=True,
                  ap=[(evalOrderAddAttrB, 'left', 5, 50)])

    # Show Window
    mc.showWindow(win)
    def __init__(self):

        #get access to our maya tools

        toolsPath = cmds.internalVar(usd=True) + "mayaTools.txt"

        if os.path.exists(toolsPath):

            f = open(toolsPath, 'r')

            self.mayaToolsDir = f.readline()

            f.close()

        #create a dictionary for our UI widgets

        self.widgets = {}

        #create window

        if cmds.window("addCharacter_UI", exists=True):

            cmds.deleteUI("addCharacter_UI")

        self.widgets["window"] = cmds.window("addCharacter_UI",
                                             title="Add Character",
                                             w=430,
                                             h=260,
                                             sizeable=True,
                                             mxb=False,
                                             mnb=False)

        #create the main layout

        main = cmds.columnLayout(w=430)

        #banner image

        cmds.image(w=430,
                   h=50,
                   image=self.mayaToolsDir +
                   "/General/Icons/ART/artBanner430px.bmp",
                   parent=main)

        self.widgets["formLayout"] = cmds.formLayout(w=430, h=260, parent=main)

        #create the widgets

        self.widgets["project"] = cmds.optionMenu(label="Project:",
                                                  w=200,
                                                  cc=self.findCharacterRigs)

        self.widgets["search"] = cmds.textFieldGrp(label="Search:",
                                                   cl2=["left", "left"],
                                                   ct2=["left", "left"],
                                                   cw2=[40, 160],
                                                   text="coming soon",
                                                   enable=False)

        self.widgets["characterList"] = cmds.textScrollList(
            allowMultiSelection=False,
            w=200,
            h=180,
            selectCommand=self.findCharacterThumbnail)

        self.widgets["thumbnailBorder"] = cmds.image(w=210,
                                                     h=210,
                                                     image="",
                                                     ebg=True,
                                                     bgc=[0, 0, 0])

        self.widgets["thumbnail"] = cmds.image(w=200, h=200, image="")

        self.widgets["addButton"] = cmds.button(label="Add",
                                                w=60,
                                                c=partial(
                                                    self.addCharacter, False))

        self.widgets["addButton2"] = cmds.button(label="Add and Close",
                                                 w=80,
                                                 c=partial(
                                                     self.addCharacter, True))

        self.widgets["cancelButton"] = cmds.button(label="Cancel",
                                                   w=60,
                                                   c=self.cancel)

        #attach widgets

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["project"], 'top', 10),
                            (self.widgets["project"], 'left', 10)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["search"], 'top', 40),
                            (self.widgets["search"], 'left', 10)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["characterList"], 'top', 70),
                            (self.widgets["characterList"], 'left', 10)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["thumbnailBorder"], 'top', 5),
                            (self.widgets["thumbnailBorder"], 'right', 5)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["thumbnail"], 'top', 10),
                            (self.widgets["thumbnail"], 'right', 10)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["addButton"], 'bottom', 10),
                            (self.widgets["addButton"], 'left', 215)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["addButton2"], 'bottom', 10),
                            (self.widgets["addButton2"], 'left', 280)])

        cmds.formLayout(self.widgets["formLayout"],
                        edit=True,
                        af=[(self.widgets["cancelButton"], 'bottom', 10),
                            (self.widgets["cancelButton"], 'right', 5)])

        #show the window

        cmds.showWindow(self.widgets["window"])

        self.findProjects()

        #set favorite project if it exists

        settingsLocation = self.mayaToolsDir + "/General/Scripts/projectSettings.txt"

        if os.path.exists(settingsLocation):

            f = open(settingsLocation, 'r')

            settings = cPickle.load(f)

            favoriteProject = settings.get("FavoriteProject")

            try:

                cmds.optionMenu(self.widgets["project"],
                                edit=True,
                                v=favoriteProject)

            except:

                pass

            self.findCharacterRigs()
Пример #49
0
 def texScrSel(self, *args):
     selectedPose = cmds.textScrollList('r_poseTexScrList',
                                        q=True,
                                        selectItem=True)[0]
     cmds.select('%s_pose_loc' % selectedPose, r=True)
Пример #50
0
def moveToTSLPosition(TSL, index):
    """
    Move the selected textScrollList item(s) to the specified position in the list
    @param TSL: The name of th textScrollList to manipulate
    @type TSL: str
    @param index: The new index position for the selected list items
    @type index: int
    """
    # Get all list entries
    listLen = len(cmds.textScrollList(TSL, q=True, ai=True))

    # Get selected item indices
    listItems = cmds.textScrollList(TSL, q=True, si=True)
    listIndex = cmds.textScrollList(TSL, q=True, sii=True)
    listItems.reverse()
    listIndex.reverse()

    # Check position value
    if not index or index > listLen:
        raise UserInputError('Invalid position (' + str(index) +
                             ') provided for textScrollList!!')
    if index < 0:
        index = 2 + listLen + index

    # Remove items
    for i in range(len(listIndex)):
        if listIndex[i] < index: index -= 1
    cmds.textScrollList(TSL, e=True, rii=listIndex)

    # Append items to position
    for i in range(len(listIndex)):
        cmds.textScrollList(TSL, e=True, ap=(index, listItems[i]))
        listIndex[i] = index + i

    # Select list items
    cmds.textScrollList(TSL, e=True, da=True)
    cmds.textScrollList(TSL, e=True, sii=listIndex)
    cmds.textScrollList(TSL, e=True, shi=listIndex[0])
Пример #51
0
    def laminaFinder(self):
        self.log('laminaFinder', prefix='Standard')

        #if the attribute has already been created there is no purpose in wasting the cycles to create it again.
        try:
            self.utilityObject.laminaObjects
        except AttributeError:
            self.log(
                'AttributeError -- Creating laminaObjects and laminaFaces class attr'
            )
            #grabs method specific data and sets attr notFrozen to that hold that data
            self.utilityObject.laminaObjects, self.utilityObject.laminaFaces = self.utilityObject.laminaFinder(
                self.utilityObject.sortedNodes)

        if cmds.window("laminaFinder_Utility_Window", exists=True):
            cmds.deleteUI("laminaFinder_Utility_Window", window=True)

        ##After script completion comment out this section.
        ##This section forces Maya to recreate the window dimensions each time
        if cmds.windowPref("laminaFinder_Utility_Window", exists=True):
            cmds.windowPref("laminaFinder_Utility_Window", remove=True)

        cmds.window("laminaFinder_Utility_Window",
                    resizeToFitChildren=True,
                    widthHeight=self.popupWinWidthHeight)
        cmds.paneLayout(configuration='horizontal2', staticHeightPane=2)
        cmds.textScrollList(
            'laminaFinder_textScroll',
            numberOfRows=8,
            allowMultiSelection=True,
            showIndexedItem=4,
            selectCommand=
            'import maya.cmds as cmds;\ncmds.select(cmds.textScrollList("laminaFinder_textScroll", query = True, selectItem = True))'
        )
        for item in self.utilityObject.laminaObjects:
            cmds.textScrollList('laminaFinder_textScroll',
                                edit=True,
                                append=str(item))
        cmds.columnLayout(adjustableColumn=True)
        form = cmds.formLayout('lamina_FormLayout', numberOfDivisions=100)
        button1 = cmds.button(
            'laminaObjects_Select',
            label='Select laminaObjects',
            command=
            'import maya.cmds as cmds;cmds.select(clear = True);\nfor item in %r:\n cmds.select(item, add=True)'
            % self.utilityObject.laminaObjects)
        button2 = cmds.button(
            'laminaFaces_Select',
            label='Select laminaFaces',
            command=
            'import maya.cmds as cmds;cmds.select(clear = True);\nfor item in %r:\n cmds.select(item, add=True)'
            % self.utilityObject.laminaFaces)
        cmds.formLayout(form,
                        edit=True,
                        attachForm=[(button1, 'top', 2), (button1, 'left', 2),
                                    (button1, 'bottom', 2),
                                    (button2, 'top', 2), (button2, 'right', 2),
                                    (button2, 'bottom', 2)],
                        attachControl=[(button1, 'right', 2, button2),
                                       (button2, 'left', 2, button1)],
                        attachPosition=[(button1, 'right', 1, 50),
                                        (button2, 'left', 1, 50)])
        cmds.setParent('..')
        cmds.button(
            'laminaFinder_Button',
            label=("Lamina Faces: %s  - Close Window" %
                   len(self.utilityObject.laminaFaces)),
            command=
            'import maya.cmds as cmds; cmds.deleteUI("laminaFinder_Utility_Window", window=True)'
        )
        cmds.setParent('..')
        cmds.showWindow()
Пример #52
0
    def ui(self):
        cmds.window(self.winName, title='Pose Corrective UI')

        cmds.rowColumnLayout('mainRowColLay',
                             numberOfColumns=2,
                             h=500,
                             columnWidth=[(1, 270), (2, 150)])

        cmds.tabLayout('l_mainTabLay', tv=False)
        cmds.tabLayout('l_subTabLay', tv=False)
        cmds.columnLayout('l_mainColLay', adj=True)
        cmds.textFieldButtonGrp('jntTexButGrp',
                                label='Driver Joint: ',
                                text='Elbow_L',
                                buttonLabel='<<',
                                columnWidth=[(1, 80), (2, 120), (3, 50)],
                                bc=partial(self.loadSel, 'jntTexButGrp'))
        cmds.textFieldButtonGrp('prntJointTexBtnGrp',
                                label='Parent Joint: ',
                                text='Shoulder_L',
                                buttonLabel='<<',
                                columnWidth=[(1, 80), (2, 120), (3, 50)],
                                bc=partial(self.loadSel, 'prntJointTexBtnGrp'))
        cmds.textFieldButtonGrp('locJointTexBtnGrp',
                                label='Child Joint: ',
                                text='Wrist_L',
                                buttonLabel='<<',
                                columnWidth=[(1, 80), (2, 120), (3, 50)],
                                bc=partial(self.loadSel, 'locJointTexBtnGrp'))
        cmds.textFieldGrp('poseNameTexFld',
                          label='Pose Name: ',
                          text='lf_elbow_bicep',
                          columnWidth=[(1, 80), (2, 120)])

        cmds.separator(h=10, style='in')

        cmds.rowColumnLayout('sculptRowColLay',
                             numberOfColumns=2,
                             columnWidth=[(1, 120), (2, 120)],
                             columnAttach=[(2, 'left', 3)])
        cmds.button('sculptBut', label='Sculpt', c=self.sculptMode)
        cmds.button('cancelBut', label='Cancel', w=120, c=self.cancel)
        cmds.setParent('l_mainColLay')

        cmds.separator(h=10, style='in')

        cmds.rowColumnLayout('corRowColLay',
                             numberOfColumns=2,
                             columnWidth=[(1, 185), (2, 50)],
                             columnAttach=[(2, 'left', 3)])
        cmds.button('createCorBut',
                    label='Create Corretive',
                    c=self.createCorrective)
        cmds.checkBox(
            'mirChkBox',
            label='Mirror',
            v=False,
            onc=
            "cmds.rowColumnLayout('symVtxTolRowColLay', e = True, vis = True)\ncmds.rowColumnLayout('rplcNameRowColLay', e = True, vis = True)",
            ofc=
            "cmds.rowColumnLayout('symVtxTolRowColLay', e = True, vis = False)\ncmds.rowColumnLayout('rplcNameRowColLay', e = True, vis = False)"
        )
        cmds.setParent('l_mainColLay')

        cmds.rowColumnLayout('symVtxTolRowColLay',
                             numberOfColumns=2,
                             columnWidth=[(1, 150), (2, 45)],
                             columnAttach=[(1, 'left', 8), (2, 'left', 0)],
                             vis=False)
        # cmds.text(label = '# Make sure pose in mirror.')
        # cmds.text(label = '')
        cmds.text(label='Symmetry Vertex Tolerance: ')
        cmds.floatField('symVtxTolTexFiel',
                        minValue=0,
                        maxValue=1,
                        value=0.002)
        cmds.setParent('l_mainColLay')

        cmds.rowColumnLayout('rplcNameRowColLay',
                             numberOfColumns=2,
                             columnWidth=[],
                             columnAttach=[],
                             vis=False)
        cmds.textFieldGrp('jntSrchTexFld',
                          label='Joint Search for: ',
                          columnWidth=[(1, 90), (2, 25)],
                          text='_L')
        cmds.textFieldGrp('jntRplcTexFld',
                          label='Joint Replace with: ',
                          columnWidth=[(1, 100), (2, 25)],
                          text='_R')
        cmds.textFieldGrp('poseSrchTexFld',
                          label='Pose Search for: ',
                          columnWidth=[(1, 90), (2, 25)],
                          text='lf_')
        cmds.textFieldGrp('poseRplcTexFld',
                          label='Pose Replace with: ',
                          columnWidth=[(1, 100), (2, 25)],
                          text='rt_')

        cmds.setParent('mainRowColLay')

        cmds.tabLayout('r_mainTabLay', tv=False)
        cmds.tabLayout('r_subTabLay', tv=False)
        cmds.columnLayout('r_mainColLay', adj=True)
        cmds.text(label='Pose Corrective List',
                  font='smallBoldLabelFont',
                  rs=True)
        cmds.textScrollList('r_poseTexScrList',
                            h=240,
                            sc=self.texScrSel,
                            allowMultiSelection=True)
        cmds.popupMenu()
        cmds.menuItem(label='Refresh', c=self.populatePoseList)
        cmds.menuItem(label='Edit', c=self.edit)
        cmds.menuItem(label='Remove', c=self.removePose)

        cmds.window(self.winName, e=True, w=300, h=150)
        cmds.showWindow(self.winName)

        # populate pose list
        self.populatePoseList()
Пример #53
0
def getrepeatName():
    global rpnamedict
    rpnamedict = fantabox.common.rpname()
    cmds.textScrollList("rpnamelists",e=1,ra=1,a=rpnamedict.keys())
Пример #54
0
    def createCorrective(self, mode, *args):
        '''# remove heads up display
		cmds.headsUpDisplay('sculptModeDisplay', remove = True)'''
        '''# off the isolate
		curPanel = cmds.paneLayout('viewPanes', q = True, pane1= True)
		cmds.isolateSelect(curPanel, state = False)'''
        # show skin geometry
        cmds.setAttr('%s.visibility' % self.skinGeo, True)

        self.vtxDeltaDic = {}
        sculptVtxFinVecDic = {}
        sculptVtxPointDic = {}
        inverseVtxPosDic = {}

        # get skin cluster
        cmds.select(self.skinGeo, r=True)
        mel.eval('string $selList[] = `ls -sl`;')
        mel.eval('string $source = $selList[0];')
        self.skinCluster = mel.eval('findRelatedSkinCluster($source);')

        # get number of vertex
        vtxNum = cmds.polyEvaluate(self.skinGeo, v=True)

        # progress window
        cmds.progressWindow(title='Creating Corrective Shape',
                            maxValue=vtxNum,
                            status='stand by',
                            isInterruptable=True)

        # get the delta that between sculpted geometry and skin geometry
        for i in xrange(vtxNum):
            if cmds.progressWindow(q=True, isCancelled=True):
                break
            cmds.progressWindow(e=True, step=1, status='calculating delta...')

            sculptVtxPos = cmds.pointPosition('%s.vtx[%d]' %
                                              (self.sculptGeo, i),
                                              world=True)
            sculptVtxVec = OpenMaya.MVector(*sculptVtxPos)
            skinVtxPos = cmds.pointPosition('%s.vtx[%d]' % (self.skinGeo, i),
                                            world=True)
            skinVtxVec = OpenMaya.MVector(*skinVtxPos)
            delta = sculptVtxVec - skinVtxVec
            # if vertex didn't move, skip
            if delta.length() < 0.001:
                continue
            self.vtxDeltaDic[i] = delta

        cmds.progressWindow(e=True, progress=0, status='calculating delta...')

        # set envelop to 0 about all deformers without skin cluster of skin geometry
        allConnections = cmds.listHistory(self.skinGeo)
        for item in allConnections:
            if cmds.objectType(item) in self.deformerList:
                cmds.setAttr('%s.envelope' % item, 0)

        # reset progression window maxValue
        cmds.progressWindow(e=True, maxValue=len(self.vtxDeltaDic))

        # get vertex position that skin cluster plus delta
        for i in self.vtxDeltaDic.keys():
            if cmds.progressWindow(q=True, isCancelled=True):
                break
            cmds.progressWindow(
                e=True,
                step=1,
                status='calculating final sculpt vtx position...')

            skinVtxPos = cmds.pointPosition('%s.vtx[%d]' % (self.skinGeo, i),
                                            world=True)
            skinVtxVec = OpenMaya.MVector(*skinVtxPos)
            sculptVtxFinVecDic[i] = skinVtxVec + self.vtxDeltaDic[i]
            sculptVtxPointDic[i] = OpenMaya.MPoint(sculptVtxFinVecDic[i].x,
                                                   sculptVtxFinVecDic[i].y,
                                                   sculptVtxFinVecDic[i].z)

        cmds.progressWindow(e=True,
                            progress=0,
                            status='calculating final sculpt vtx position...')

        # get inversed vertex position
        for i in self.vtxDeltaDic.keys():
            if cmds.progressWindow(q=True, isCancelled=True):
                break
            cmds.progressWindow(e=True,
                                step=1,
                                status='calculating inverse matrix...')

            # set matrix pallete
            matrixPallete = OpenMaya.MMatrix()
            matrixPalletInitList = [
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0
            ]
            OpenMaya.MScriptUtil.createMatrixFromList(matrixPalletInitList,
                                                      matrixPallete)

            # get influences
            influenceList = cmds.skinCluster('%s.vtx[%d]' % (self.skinGeo, i),
                                             q=True,
                                             wi=True)

            # for each influence get the matrix and multiply inverse matrix
            for influence in influenceList:
                infBindMatrixList = cmds.getAttr('%s.bindPose' % influence)
                infWorldMatrixList = cmds.getAttr('%s.worldMatrix' % influence)
                infWeight = cmds.skinPercent(self.skinCluster,
                                             '%s.vtx[%d]' % (self.skinGeo, i),
                                             q=True,
                                             transform=influence,
                                             v=True)

                if infWeight == 0.0:
                    continue

                infBindMatrix = OpenMaya.MMatrix()
                OpenMaya.MScriptUtil.createMatrixFromList(
                    infBindMatrixList, infBindMatrix)
                infWorldMatrix = OpenMaya.MMatrix()
                OpenMaya.MScriptUtil.createMatrixFromList(
                    infWorldMatrixList, infWorldMatrix)
                matrixPallete += (infBindMatrix.inverse() *
                                  infWorldMatrix) * infWeight

            inverseVtxPosDic[i] = sculptVtxPointDic[i] * matrixPallete.inverse(
            )

        cmds.progressWindow(e=True,
                            progress=0,
                            status='calculating inverse matrix...')

        # on eidt mode, replace poseName to selTrg
        if mode == 'editMode':
            self.poseName = cmds.textScrollList('r_poseTexScrList',
                                                q=True,
                                                selectItem=True)[0]

        if mode != 'editMode':
            # get corrective geometry by duplicating skin geometry with skinCluster envelope 0
            cmds.setAttr('%s.envelope' % self.skinCluster, 0)
            cmds.duplicate(self.skinGeo, n=self.poseName)
            # delete intermediate shape
            shapList = cmds.ls(self.poseName, dag=True, s=True)
            for shap in shapList:
                if cmds.getAttr('%s.intermediateObject' % (shap)):
                    cmds.delete(shap)

        # set corrective shape's vertex position
        if mode != 'editMode':
            for i in self.vtxDeltaDic.keys():
                if cmds.progressWindow(q=True, isCancelled=True):
                    break
                cmds.progressWindow(
                    e=True,
                    step=1,
                    status='calculating corrective vtx position...')

                cmds.xform('%s.vtx[%d]' % (self.poseName, i),
                           ws=True,
                           t=(inverseVtxPosDic[i].x, inverseVtxPosDic[i].y,
                              inverseVtxPosDic[i].z))

        elif mode == 'editMode':
            for i in self.vtxDeltaDic.keys():
                if cmds.progressWindow(q=True, isCancelled=True):
                    break
                cmds.progressWindow(
                    e=True,
                    step=1,
                    status='calculating facial target vtx position...')

                # get vertex position that no assigned deformer
                cmds.setAttr('%s.envelope' % self.skinCluster, 0)
                skinVtxPos = cmds.pointPosition('%s.vtx[%d]' %
                                                (self.skinGeo, i),
                                                world=True)

                # get modified vertex vector
                modifiedVtxPos = [(inverseVtxPosDic[i].x - skinVtxPos[0]),
                                  (inverseVtxPosDic[i].y - skinVtxPos[1]),
                                  (inverseVtxPosDic[i].z - skinVtxPos[2])]

                # add modified vertex vector to original target vertex vector
                facialTrgVtxPos = cmds.pointPosition('%s.vtx[%d]' %
                                                     (self.poseName, i),
                                                     world=True)
                finalVtxPos = [(facialTrgVtxPos[0] + modifiedVtxPos[0]),
                               (facialTrgVtxPos[1] + modifiedVtxPos[1]),
                               (facialTrgVtxPos[2] + modifiedVtxPos[2])]

                # set final vertex position
                cmds.xform('%s.vtx[%d]' % (self.poseName, i),
                           ws=True,
                           t=finalVtxPos)

        cmds.progressWindow(endProgress=True)

        # all deformer's envelope set to 1 of  skin geometry
        cmds.setAttr('%s.envelope' % self.skinCluster, 1)
        allConnections = cmds.listHistory(self.skinGeo)
        for item in allConnections:
            if cmds.objectType(item) in self.deformerList:
                cmds.setAttr('%s.envelope' % item, 1)

        # add corrective geometry to geo_grp
        if mode != 'editMode':
            corGeoGrpName = self.skinGeo + '_corrective_geo_grp'
            if cmds.objExists(corGeoGrpName):
                cmds.parent(self.poseName, corGeoGrpName)
                cmds.setAttr('%s.visibility' % self.poseName, False)
            else:
                cmds.createNode('transform', n=corGeoGrpName)
                cmds.parent(self.poseName, corGeoGrpName)
                cmds.setAttr('%s.visibility' % self.poseName, False)

        # delete sculpt geometry
        cmds.delete(self.sculptGeo)

        if mode != 'editMode':
            # add corrective to blend shape node
            if cmds.objExists(self.bsName):
                bsAttrList = cmds.aliasAttr(self.bsName, q=True)
                weightNumList = []
                for bsAttr in bsAttrList:
                    if 'weight' in bsAttr:
                        reObj = re.search(r'\d+', bsAttr)
                        weightNum = reObj.group()
                        weightNumList.append(int(weightNum))
                bsIndex = max(weightNumList) + 1
                cmds.blendShape(self.bsName,
                                edit=True,
                                target=(self.skinGeo, bsIndex, self.poseName,
                                        1.0))
                cmds.setAttr('%s.%s' % (self.bsName, self.poseName), 1)
                # refresh pose list
                self.populatePoseList()
            else:
                cmds.blendShape(self.poseName,
                                self.skinGeo,
                                n=self.bsName,
                                frontOfChain=True)[0]
                cmds.setAttr('%s.%s' % (self.bsName, self.poseName), 1)
                # refresh pose list
                self.populatePoseList()

            # get data for pose reader
            driverJoint = cmds.textFieldButtonGrp('jntTexButGrp',
                                                  q=True,
                                                  text=True)
            parentJoint = cmds.textFieldButtonGrp('prntJointTexBtnGrp',
                                                  q=True,
                                                  text=True)
            locatorJoint = cmds.textFieldButtonGrp('locJointTexBtnGrp',
                                                   q=True,
                                                   text=True)

            # pose reader
            self.poseReader(driverJoint, parentJoint, locatorJoint,
                            self.poseName)

            # mirror
            mirOpt = cmds.checkBox('mirChkBox', q=True, v=True)
            if mirOpt:
                # create fliped opposite side geometry
                flipGeo = self.flipGeo()

                # add opposite corrective to the blend shape node
                bsAttrList = cmds.aliasAttr(self.bsName, q=True)
                weightNumList = []
                for bsAttr in bsAttrList:
                    if 'weight' in bsAttr:
                        reObj = re.search(r'\d+', bsAttr)
                        weightNum = reObj.group()
                        weightNumList.append(int(weightNum))
                bsIndex = max(weightNumList) + 1
                cmds.blendShape(self.bsName,
                                edit=True,
                                target=(self.skinGeo, bsIndex, flipGeo, 1.0))
                cmds.setAttr('%s.%s' % (self.bsName, flipGeo), 1)
                # refresh pose list
                self.populatePoseList()

                # get data for opposite side pose reader
                jntSearchTex = cmds.textFieldGrp('jntSrchTexFld',
                                                 q=True,
                                                 text=True)
                jntReplaceTex = cmds.textFieldGrp('jntRplcTexFld',
                                                  q=True,
                                                  text=True)
                oppoDriverJnt = re.sub(jntSearchTex, jntReplaceTex,
                                       driverJoint, 1)
                oppoParentJnt = re.sub(jntSearchTex, jntReplaceTex,
                                       parentJoint)
                oppolocatorJnt = re.sub(jntSearchTex, jntReplaceTex,
                                        locatorJoint, 1)

                # set opposite side pose
                srcRo = cmds.getAttr('%s.rotate' % (driverJoint))[0]
                srcRo = (srcRo[0], -srcRo[1], srcRo[2])
                cmds.setAttr('%s.rotate' % (oppoDriverJnt), *srcRo)

                # create opposite side pose reader
                self.poseReader(oppoDriverJnt, oppoParentJnt, oppolocatorJnt,
                                flipGeo)

        self.populatePoseList()
Пример #55
0
 def QueryTextScrollList(self, thisTSC):
     return cmds.textScrollList(thisTSC, q = 1, si = 1)
Пример #56
0
def deleteExcludeItem(*args):
    selectedItems = cmds.textScrollList("exclude_list",
                                        q=True,
                                        selectItem=True)
    # removeItem
    cmds.textScrollList("exclude_list", e=True, removeItem=selectedItems)
Пример #57
0
    def Create(self):
        
        #main layout with tabs
        self.form = cmds.formLayout()
        self.tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
        cmds.formLayout( self.form, edit=True, attachForm=((self.tabs, 'top', 0), (self.tabs, 'left', 0), (self.tabs, 'bottom', 0), (self.tabs, 'right', 0)) )
        
        #modelling tab
        self.child1 = cmds.rowColumnLayout(parent = self.tabs, numberOfColumns=1)
        
        #duplicate and scatter
        self.dupScatFrame = cmds.frameLayout(parent = self.child1, label = "Duplicate and Scatter", collapsable = True, collapse = True)
        self.dupScatRC = cmds.rowColumnLayout(parent = self.dupScatFrame, numberOfColumns = 3)

        cmds.text(parent = self.dupScatRC, label = "X range")
        self.xMinField = cmds.floatField(parent = self.dupScatRC, value = -10)
        self.xMaxField = cmds.floatField(parent = self.dupScatRC, value = 10)
        cmds.text(parent = self.dupScatRC, label = "Y range")
        self.yMinField = cmds.floatField(parent = self.dupScatRC, value = -10)
        self.yMaxField = cmds.floatField(parent = self.dupScatRC, value = 10)
        cmds.text(parent = self.dupScatRC, label = "Z range")
        self.zMinField = cmds.floatField(parent = self.dupScatRC, value = -10)
        self.zMaxField = cmds.floatField(parent = self.dupScatRC, value = 10)
        cmds.text(parent = self.dupScatRC, label = "Number of Duplicates")
        self.dupNumField = cmds.intField(parent = self.dupScatRC, value = 10)

        self.dupScatCol = cmds.columnLayout(parent = self.dupScatFrame)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.dupScatFrame, label = "Duplicate", command = lambda : self.DupAndScatter(cmds.intField(self.dupNumField, q = 1, v = 1), cmds.floatField(self.xMinField , q = 1, v = 1), cmds.floatField(self.xMaxField , q = 1, v = 1), cmds.floatField(self.yMinField , q = 1, v = 1), cmds.floatField(self.yMaxField , q = 1, v = 1), cmds.floatField(self.zMinField , q = 1, v = 1), cmds.floatField(self.zMaxField , q = 1, v = 1)))
        
        #rigging tab
        self.child2 = cmds.rowColumnLayout(parent = self.tabs, numberOfColumns=1)
        
        #locator creator
        self.createLocatorFrame = cmds.frameLayout(parent = self.child2, label = "Create Locators", collapsable = True, collapse = True)
        self.createLocatorRC = cmds.rowColumnLayout(parent = self.createLocatorFrame, numberOfColumns = 2)
        cmds.text(parent = self.createLocatorRC, label = "Type")
        self.createLocatorMenu = cmds.optionMenu(parent = self.createLocatorRC)
        cmds.menuItem(parent = self.createLocatorMenu, label = "Center of Objects")
        cmds.menuItem(parent = self.createLocatorMenu, label = "Center of Components")
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.createLocatorFrame, label = "Create Locator", command = lambda : self.CreateLocator(cmds.optionMenu(self.createLocatorMenu, q = True, v = True)))

        cmds.separator(parent = self.child2, style = "double")

        #joint creator
        self.createJointFrame = cmds.frameLayout(parent = self.child2, label = "Create Joints", collapsable = True, collapse = True)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.createJointFrame, label = "Create Joints", command = lambda : self.CreateJoints())

        cmds.separator(parent = self.child2, style = "double")
        
        #joint orient
        self.jointOrientFrame = cmds.frameLayout(parent = self.child2, label = "Orient Joints", collapsable = True, collapse = True)
        
        self.primaryAxisRC = cmds.radioButtonGrp(parent = self.jointOrientFrame, label = "Primary Axis:", ad3 = 1, cw3 = [20, 20, 20], labelArray3 = ["X", "Y", "Z"], numberOfRadioButtons = 3, select = 1)

        self.secondaryAxisRC = cmds.radioButtonGrp(parent = self.jointOrientFrame,  label = "Secondary Axis:", ad3 = 1, cw3 = [20, 20, 20], labelArray3 = ["X", "Y", "Z"], numberOfRadioButtons = 3, select = 3)

        self.SAORC = cmds.radioButtonGrp(parent = self.jointOrientFrame, label = "Secondary Axis World Orientation", ad3 = 1, cw3 = [20, 20, 20], labelArray3 = ["X", "Y", "Z"], numberOfRadioButtons = 3, select = 1)
        
        self.upOrDown = cmds.optionMenu(parent = self.jointOrientFrame)
        cmds.menuItem(parent = self.upOrDown, label = "+")
        cmds.menuItem(parent = self.upOrDown, label = "-")
        
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.jointOrientFrame, label = "Orient Joints", command = lambda : self.OrientJoints(self.QueryRadioButtonGrp(self.primaryAxisRC), self.QueryRadioButtonGrp(self.secondaryAxisRC), self.QueryRadioButtonGrp(self.SAORC), cmds.optionMenu(self.upOrDown, q = 1, value = 1), True, True, True))
        
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.jointOrientFrame, label = "Freeze Rotations", command = lambda : self.FreezeRotation())
        
        cmds.separator(parent = self.child2, style = "double")
        
        #ik solvers
        self.ikSolversFrame = cmds.frameLayout(parent = self.child2, label = "IK Solvers", collapsable = True, collapse = True)
        cmds.text(parent = self.ikSolversFrame, label = "Spline IK")
        self.splineSelectHierarchyCB = cmds.checkBox(parent = self.ikSolversFrame, label = "Select Hierarchy")
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.ikSolversFrame, label = "Create Spline IK", command = lambda : self.SplineIK(cmds.checkBox(self.splineSelectHierarchyCB, query = 1, value = 1)))
        
        cmds.separator(parent = self.child2, style = "double")

        #control creator
        self.createControlFrame = cmds.frameLayout(parent = self.child2, label = "Create Controls", collapsable = True, collapse = True)
        self.createControlRC = cmds.rowColumnLayout(parent = self.createControlFrame, numberOfColumns=2)
        self.createControlGrid = cmds.gridLayout(parent = self.createControlFrame, numberOfColumns = 8)
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 0, 0), command = lambda x: self.SetColor(1) )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.75, 0.75, 0.75), command = lambda x: self.SetColor(2) )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.5, 0.5, 0.5), command = lambda x: self.SetColor(3) )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (.8, 0, 0.2), command = lambda x: self.SetColor(4)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 0, .4), command = lambda x: self.SetColor(5)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 0, 1), command = lambda x: self.SetColor(6)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, .3, 0), command = lambda x: self.SetColor(7)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.2, 0, 0.3), command = lambda x: self.SetColor(8)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (.8, 0, .8), command = lambda x: self.SetColor(9)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.6, 0.3, 0.2), command = lambda x: self.SetColor(10)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.25, 0.13, 0.13), command = lambda x: self.SetColor(11)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.7, .2, 0), command = lambda x: self.SetColor(12)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (1, 0, 0), command = lambda x: self.SetColor(13)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 1, 0), command = lambda x: self.SetColor(14)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 0.3, 0.6), command = lambda x: self.SetColor(15)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (1, 1, 1), command = lambda x: self.SetColor(16)  )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (1, 1, 0), command = lambda x: self.SetColor(17)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 1, 1), command = lambda x: self.SetColor(18)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 1, .8), command = lambda x: self.SetColor(19)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (1, .7, .7), command = lambda x: self.SetColor(20)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.9, .7, .5), command = lambda x: self.SetColor(21)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (1, 1, 0.4), command = lambda x: self.SetColor(22)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0, 0.7, .4), command = lambda x: self.SetColor(23)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (.6, .4, .2), command = lambda x: self.SetColor(24)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (.63, .63, .17), command = lambda x: self.SetColor(25)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.4, 0.6, 0.2), command = lambda x: self.SetColor(26)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.2, 0.63, 0.35), command = lambda x: self.SetColor(27)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.18, 0.63, 0.63), command = lambda x: self.SetColor(28)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.18, 0.4, 0.63), command = lambda x: self.SetColor(29)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.43, 0.18, 0.63), command = lambda x: self.SetColor(30)   )
        cmds.button( label = "", parent = self.createControlGrid, backgroundColor = (0.63, 0.18, 0.4), command = lambda x: self.SetColor(31)   )
        cmds.text(parent = self.createControlRC, label = "Control Type")
        self.createControlOptnMenu = cmds.optionMenu(parent = self.createControlRC)
        cmds.menuItem(parent = self.createControlOptnMenu, label = "")
        cmds.menuItem(parent = self.createControlOptnMenu, label = "Circle")
        cmds.menuItem(parent = self.createControlOptnMenu, label = "Square")
        cmds.menuItem(parent = self.createControlOptnMenu, label = "Flower")
        cmds.text(parent = self.createControlRC, label = "Constrain to Joint")
        self.createControlCheckbox = cmds.checkBox(parent = self.createControlRC, value = False, label = "")
        cmds.text(parent = self.createControlRC, label = "Color Joints")
        self.colorJointsCheckbox = cmds.checkBox(parent = self.createControlRC, value = False, label = "")
        cmds.text(parent = self.createControlRC, label = "Rotate 90 Y")
        self.rotateYCheckbox = cmds.checkBox(parent = self.createControlRC, value = False, label = "")
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.createControlFrame, label = "Create Controls", command = lambda : self.CreateControl(cmds.optionMenu(self.createControlOptnMenu, q = True, v = True), self.colorIndex, cmds.checkBox(self.createControlCheckbox, q= True, v = True), cmds.checkBox(self.colorJointsCheckbox, q= True, v = True), cmds.checkBox(self.rotateYCheckbox, q= True, v = True)))
        cmds.text(parent = self.createControlRC, label = "Control Color:")
        
        cmds.separator(parent = self.child2, style = "double")

        # constraints
        self.constraintsFrame = cmds.frameLayout(parent = self.child2, label = "Constraints", collapsable = True, collapse = True)

        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.constraintsFrame, label = "Parent-Scale Constraint", command = lambda : self.ParentScaleConstraint())
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.constraintsFrame, label = "Split Parent Constrain", command = lambda : self.SplitParentConstrain())
        
        cmds.separator(parent = self.child2, style = "double")

        #RK system tools
        self.rkFrame = cmds.frameLayout(parent = self.child2, label = "IKFK System", collapsable = True, collapse = True)
        
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.rkFrame, label = "Create IK FK Chains", command = lambda : self.CreateIKFKJoints())
        
        self.scrollList = cmds.textScrollList(parent = self.rkFrame)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.rkFrame, label = "Add", command = lambda : self.AddToTextScrollList(self.scrollList))
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.rkFrame, label = "Create Transform Control Attributes", command = lambda : self.CreateIKFKAttributes(self.QueryTextScrollList(self.scrollList)), ann = "Select your Transform control to run this command. Will create an IKFK attribute for two arms and two legs")

        self.rkRC1 = cmds.rowColumnLayout(parent = self.rkFrame, numberOfColumns=2)
        cmds.text(parent = self.rkRC1, label = "Attribute Number", ann = "Check the order of the user-created attributes on Transform control to get this number")
        self.rkAttrNum1 = cmds.intField(parent = self.rkRC1, value = 1)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.rkFrame, label = "Key IKFK Switch", command = lambda : self.RKConstraintSetDrivenKey(self.QueryTextScrollList(self.scrollList), cmds.intField(self.rkAttrNum1, q = 1, v = 1)), ann  = "Select your Transform control first, then select the parent constraints on your RK joint chain for one joint system (ie for the left arm)")

        self.rkRC2 = cmds.rowColumnLayout(parent = self.rkFrame, numberOfColumns=2)
        cmds.text(parent = self.rkRC2, label = "Attribute Number", ann = "Check the order of the user-created attributes on Transform control to get this number")
        self.rkAttrNum2 = cmds.intField(parent = self.rkRC2, value = 1)
        cmds.text(parent = self.rkRC2, label = "Control Type")
        self.rkOptnMenu = cmds.optionMenu(parent = self.rkRC2)
        cmds.menuItem(parent = self.rkOptnMenu, label = "FK")
        cmds.menuItem(parent = self.rkOptnMenu, label = "IK")
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.rkFrame, label = "Key Control Visibility", command = lambda : self.RKCtrlSetDrivenKey(self.QueryTextScrollList(self.scrollList), cmds.intField(self.rkAttrNum2, q = 1, v = 1), cmds.optionMenu(self.rkOptnMenu, q = 1, v = 1)) , ann = "Select Transform control first, then select the controls for one joint system (ie the left arm IK controls)")
        
        cmds.separator(parent = self.child2, style = "double")

        #skinning animator
        self.skinAnimFrame = cmds.frameLayout(parent = self.child2, label = "Skinning Auto Animator", collapsable = True, collapse = True)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.skinAnimFrame, label = "Animate", command = lambda : self.SkinningAnim())
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.skinAnimFrame, label = "Clear Keys", command = lambda : cmds.cutKey())

        
        
        #utility tab
        self.child3 = cmds.rowColumnLayout(parent = self.tabs, numberOfColumns=1)

        #renamer
        self.renamerFrame = cmds.frameLayout(parent = self.child3, label = "Renamer", collapsable = True, collapse = True)
        self.renamerRC = cmds.rowColumnLayout(parent = self.renamerFrame, numberOfColumns = 2)

        cmds.text(parent = self.renamerRC, label = "Name")
        self.nameField = cmds.textField(parent = self.renamerRC, text = "name")
        cmds.text(parent = self.renamerRC, label = "Number Padding")
        self.numPadField = cmds.textField(parent = self.renamerRC, text = "00")
        cmds.text(parent = self.renamerRC, label = "Number")
        self.numField = cmds.intField(parent = self.renamerRC, value = 1)
        cmds.text(parent = self.renamerRC, label = "Suffix")
        self.suffixField = cmds.textField(parent = self.renamerRC, text = "suffix")

        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.renamerFrame, label = "Rename and Number", command = lambda : self.RenameAndNumber(cmds.textField(self.nameField, q = 1, text = 1), cmds.textField(self.numPadField, q = 1, text = 1), cmds.intField(self.numField, q = 1, v = 1), cmds.textField(self.suffixField, q = 1, text = 1)))

        #filter selection
        self.filselFrame = cmds.frameLayout(parent = self.child3, label = "Filter Selection", collapsable = True, collapse = True)
        self.filselRC = cmds.rowColumnLayout(parent = self.filselFrame, numberOfColumns = 2)
        cmds.text(parent = self.filselRC, label = "Select Hierarchy")
        self.filselCheckbox = cmds.checkBox(parent = self.filselRC, value = True, label = "")
        cmds.text(parent = self.filselRC, label = "Node Type")
        self.filselText = cmds.textField(parent = self.filselRC)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.filselFrame, label = "Filter Selection", command = lambda : self.FilterSelection(cmds.checkBox(self.filselCheckbox, q = 1, v = 1), cmds.textField(self.filselText, q = 1, text = 1)))

        #randomize selection
        self.randSelFrame = cmds.frameLayout(parent = self.child3, label = "Randomize Selection", collapsable = True, collapse = True)
        self.randSelRC = cmds.rowColumnLayout(parent = self.randSelFrame, numberOfColumns = 2)

        cmds.text(parent = self.randSelRC, label = "Percent of Selection")
        self.percentSelField = cmds.floatField(parent = self.randSelRC, value = 50)
        cmds.iconTextButton(style = "textOnly", rpt = 1, parent = self.randSelFrame, label = "Randomize", command = lambda : self.RandomizeSelection(cmds.floatField(self.percentSelField, q = 1, v = 1)))
        
        #set up tab layout
        cmds.tabLayout( self.tabs, edit=True, tabLabel=((self.child1, 'Modelling'), (self.child2, 'Rigging'), (self.child3, 'Utility')) )
Пример #58
0
def getWrongShape():
    global rpnamedict
    rpnamedict={}
    wrongshapelist= fantabox.common.k004_check_vshapeNode()
    cmds.textScrollList("rpnamelists",e=1,ra=1,a=wrongshapelist)
Пример #59
0
 def getSelectedPresetNames(self):
     selected = cmd.textScrollList(self.UI_tsl_presets, q=True,
                                   si=True) or []
     return [Path(s).name() for s in selected]
Пример #60
0
 def AddToTextScrollList(self, thisTSC):
     cmds.textScrollList(thisTSC, edit = 1, append = cmds.ls(selection = 1))