def __init__(self, width ): self._emptyWidth = 10 self._width = width - self._emptyWidth*2 - 4 self._height = 140 sepList = [ 65, 50 ] self._mainWidthList = uifnc.setWidthByPerList( sepList, self._width ) sepList = [ 70, 30 ] self._optionWidthList = uifnc.setWidthByPerList( sepList, self._mainWidthList[0]-20 ) Cmd.__init__( self, self._mainWidthList[0] ) self._rowColumns = [] self.core()
def add(self, driverName, angleValues=[] ): if not angleValues: angleValues = [0,0,0] defaultBgc = [ .1, .1, .1 ] onBgc = [ .9, .9, .2 ] enList = [0,0,0] bgcList = [None,None,None] for i in range( 3 ): if math.fabs( angleValues[i] ) >= self._minValue: bgcList[i] = onBgc enList[i] = 1 else: bgcList[i] = defaultBgc enList[i] = 0 widthList = uifnc.setWidthByPerList( [70,15,15,15] , self._width ) cmds.rowColumnLayout( nc=4, cw=[(1,widthList[0]),(2,widthList[1]),(3,widthList[2]),(4,widthList[3])] ) cmds.text( l= driverName+' : ', al='right' ) cmds.floatField( precision=2, v=angleValues[0], bgc= bgcList[0] ) cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle0 : %3.2f' %angleValues[0] ) ) cmds.floatField( precision=2, v=angleValues[1], bgc= bgcList[1] ) cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle1 : %3.2f' %angleValues[1] ) ) cmds.floatField( precision=2, v=angleValues[2], bgc= bgcList[2] ) cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle2 : %3.2f' %angleValues[2] ) ) self.driverScrollAddPopupCmd() cmds.setParent( '..' )
def addMirrorMeshCmd(self, logicalIndex, *args ): items = cmds.textScrollList( globalInfo.meshInfoInst._selMeshList, q=1, ai=1 ) if not items: return None nodeName = amCmd.getBlendAndFixedShapeNode( items[0] ) targetName, driverInfo, returnIndex = amCmd.addMirrorTarget( items[0], logicalIndex ) cmds.setParent( self._scrollLay ) cmds.rowColumnLayout( nc=3, cw=[(1,25),(2,self._mainWidthList[0]-30),(3,self._mainWidthList[1]-30) ] ) cmds.button( l="X", c= partial( self.removeBlendMeshInfoElement, nodeName, logicalIndex ) ) meshNameField = cmds.textField( tx=targetName.replace( items[0]+'_', '' ), cc=partial( self.meshNameChangeCmd, nodeName, returnIndex ) ) self._meshNameList.append( meshNameField ) cmds.popupMenu( markingMenu = 1 ) cmds.menuItem( l='Edit Anim Curve', rp='W', c=partial( self.editAnimCurveCmd, nodeName, returnIndex ) ) cmds.menuItem( l='Edit Mesh',rp='N', c=partial( self.editAssigned, returnIndex) ) cmds.menuItem( l='Add Mirror Mesh',rp='E', c=partial( self.addMirrorMeshCmd, returnIndex) ) cmds.menuItem( l='Select Delta Points', rp='S', c=partial( self.selectDeltaPointsCmd, items[0], logicalIndex ) ) widthList = uifnc.setWidthByPerList( [50,50], self._mainWidthList[1] ) cmds.rowColumnLayout( nc=2, cw=[(1,widthList[0]),(2,widthList[1]-30)] ) for element in driverInfo: engleName, value1, value2, value3= element cmds.text( l= engleName ) cmds.floatFieldGrp( precision=2, nf=3, cw3=[50,50,50], v1=value1, v2=value2, v3=value3 ) cmds.setParent( '..' )
def __init__(self, width): self._emptyWidth = 10 self._width = width - self._emptyWidth * 2 - 4 sepList = [30, 50, 25] self._widthList = uifnc.setWidthByPerList(sepList, self._width) self.core() Cmd.__init__(self)
def __init__(self, width ): self._emptyWidth = 10 self._width = width - self._emptyWidth*2 - 4 sepList = [ 30, 50, 25 ] self._widthList = uifnc.setWidthByPerList( sepList, self._width ) self.core() Cmd.__init__( self )
def __init__(self, width ): self._emptyWidth = 10 self._width = width - self._emptyWidth*2 - 4 self._height = 140 sepList = [ 65, 50 ] self._mainWidthList = uifnc.setWidthByPerList( sepList, self._width ) Cmd.__init__( self ) self._rowColumns = [] mainLayout = self.core() self.scriptJob( mainLayout )
def __init__(self, width): self._emptyWidth = 10 self._width = width - self._emptyWidth * 2 - 4 self._height = 140 sepList = [65, 50] self._mainWidthList = uifnc.setWidthByPerList(sepList, self._width) Cmd.__init__(self) self._rowColumns = [] mainLayout = self.core() self.scriptJob(mainLayout)
def addShapeList(self): items = cmds.textScrollList( globalInfo.meshInfoInst._selMeshList, q=1, ai=1 ) childrenUIs = cmds.scrollLayout( self._scrollLay, q=1, ca=1 ) if childrenUIs: for child in childrenUIs: cmds.deleteUI( child ) if not items: return None for item in items: self._meshNameList = [] shapeInfoList, nodeName = chf.getShapeInfo( item ) if not shapeInfoList: continue cmds.setParent( self._scrollLay ) cmds.rowColumnLayout( nc=3, cw=[(1,25),(2,self._mainWidthList[0]-30),(3,self._mainWidthList[1]-30) ] ) for shapeInfo in shapeInfoList: shapeName, angleListAndValues, logicalIndex = shapeInfo cmds.button( l="X", c= partial( self.removeBlendMeshInfoElement, nodeName, logicalIndex ) ) meshNameField = cmds.textField( tx=shapeName.replace( item+'_', '' ), cc=partial( self.meshNameChangeCmd, nodeName, shapeInfoList.index( shapeInfo ) ) ) cmds.popupMenu( markingMenu = 1 ) cmds.menuItem( l='Edit Anim Curve', rp='W', c=partial( self.editAnimCurveCmd, nodeName, shapeInfoList.index( shapeInfo ) ) ) cmds.menuItem( l='Edit Mesh', rp='N', c=partial( self.editAssigned, shapeInfoList.index( shapeInfo ) ) ) cmds.menuItem( l='Add Mirror Mesh', rp='E', c=partial( self.addMirrorMeshCmd, shapeInfoList.index( shapeInfo ) ) ) cmds.menuItem( l='Select Delta Points', rp='S', c=partial( self.selectDeltaPointsCmd, item, logicalIndex ) ) self._meshNameList.append( meshNameField ) widthList = uifnc.setWidthByPerList( [50,50], self._mainWidthList[1] ) cmds.rowColumnLayout( nc=2, cw=[(1,widthList[0]),(2,widthList[1]-30)] ) for element in angleListAndValues: engleName, value1, value2, value3= element cmds.text( l= engleName ) cmds.floatFieldGrp( precision=2, nf=3, cw3=[50,50,50], v1=value1, v2=value2, v3=value3 ) cmds.setParent( '..' ) cmds.setParent( '..' )
def core(self): if cmds.window( self._winName, ex=1 ): cmds.deleteUI( self._winName ) cmds.window( self._winName, title= self._title ) cmds.columnLayout() uifnc.setSpace( 5 ) widthList = uifnc.setWidthByPerList( [5 ,25, 45, 20, 5], self._width ) cmds.rowColumnLayout( nc=5, cw=[(1,widthList[0]), (2,widthList[1]), (3,widthList[2]), (4,widthList[3]), (5,widthList[4])]) uifnc.setSpace() cmds.text( l='Target Root : ', al='right', w=widthList[1] ) self._rootField = cmds.textField( w=widthList[2] ) cmds.button( l='Load', w=widthList[3], c= self.loadCmd ) uifnc.setSpace() cmds.setParent( '..' ) uifnc.setSpace( 10 ) cmds.separator( width = self._width+2 ) uifnc.setSpace( 10 ) widthList = uifnc.setWidthByPerList( [ 5, 45, 3, 45, 5 ], self._width ) cmds.rowColumnLayout( nc=5, cw=[(1,widthList[0]), (2,widthList[1]), (3,widthList[2]), (4,widthList[3]), (5,widthList[4]) ] ) uifnc.setSpace() cmds.rowColumnLayout( nc=1, cw=(1,widthList[1]) ) cmds.text( l='Driver List', al='center' ) uifnc.setSpace(10) cmds.scrollLayout() self._driverList = cmds.textScrollList( w=widthList[1]-8, sc= self.selectDriverCmd, ams=1 ) cmds.setParent( '..' ) cmds.setParent( '..' ) uifnc.setSpace() cmds.rowColumnLayout( nc=1, cw=(1,widthList[3]-1) ) cmds.text( l='Driver Value' ) uifnc.setSpace( 30 ) cmds.frameLayout( cll=0, lv=0 ) uifnc.setSpace() driverWidthList = uifnc.setWidthByPerList( [ 50,50, 5 ], widthList[3]-2 ) self._angleFrame = cmds.rowColumnLayout( nc=3, cw=[(1,driverWidthList[0]), (2,driverWidthList[1]), (3,driverWidthList[2])], en=1 ) cmds.text( l='Angle1' ); self._angle1 = cmds.floatField( editable=False );uifnc.setSpace() cmds.text( l='Angle2' ); self._angle2 = cmds.floatField( editable=False );uifnc.setSpace() cmds.text( l='Angle3' ); self._angle3 = cmds.floatField( editable=False );uifnc.setSpace() cmds.setParent( '..' ) uifnc.setSpace() cmds.setParent( '..' ) driverWidthList = uifnc.setWidthByPerList( [ 5, 60,40, 5 ], widthList[3]-2 ) cmds.rowColumnLayout( nc=4, cw=[(1,driverWidthList[0]), (2,driverWidthList[1]), (3,driverWidthList[2]), (4,driverWidthList[3])]) uifnc.setSpace() cmds.text( l='Smaller Value : ' ) self._smallerValueField = cmds.floatField( v=0.01 ) uifnc.setSpace() cmds.setParent( '..' ) uifnc.setSpace( 20 ) self._showOnlyMovedCheck = cmds.checkBox( l='Show Only Moved Driver', cc= self.checkCmd ) uifnc.setSpace( 10 ) cmds.button( l='Update Condition', h=30, c=self.updateCondition ) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.rowColumnLayout() uifnc.setSpace( 10 ) cmds.separator( width = self._width+2 ) uifnc.setSpace( 10 ) cmds.setParent( '..' ) uifnc.setSpace() cmds.setParent( '..' ) driverWidthList = uifnc.setWidthByPerList( [ 5,90,5 ], self._width ) cmds.rowColumnLayout( nc=3, cw=[(1,driverWidthList[0]), (2,driverWidthList[1]), (3,driverWidthList[2])] ) uifnc.setSpace() cmds.button( l='Set Driver', h=30, c= self.setDriverCmd ) uifnc.setSpace() uifnc.setSpace() cmds.button( l='Make PSD Skin', h=30, c= self.makePSDSkinCmd ) uifnc.setSpace() cmds.setParent( '..' ) cmds.window( self._winName, e=1, width = self._width+2, height = self._height ) cmds.showWindow( self._winName ) self.setScriptJob()
def core(self): if cmds.window(self._winName, ex=1): cmds.deleteUI(self._winName) cmds.window(self._winName, title=self._title) cmds.columnLayout() uifnc.setSpace(5) widthList = uifnc.setWidthByPerList([5, 25, 45, 20, 5], self._width) cmds.rowColumnLayout(nc=5, cw=[(1, widthList[0]), (2, widthList[1]), (3, widthList[2]), (4, widthList[3]), (5, widthList[4])]) uifnc.setSpace() cmds.text(l='Target Root : ', al='right', w=widthList[1]) self._rootField = cmds.textField(w=widthList[2]) cmds.button(l='Load', w=widthList[3], c=self.loadCmd) uifnc.setSpace() cmds.setParent('..') uifnc.setSpace(10) cmds.separator(width=self._width + 2) uifnc.setSpace(10) widthList = uifnc.setWidthByPerList([5, 45, 3, 45, 5], self._width) cmds.rowColumnLayout(nc=5, cw=[(1, widthList[0]), (2, widthList[1]), (3, widthList[2]), (4, widthList[3]), (5, widthList[4])]) uifnc.setSpace() cmds.rowColumnLayout(nc=1, cw=(1, widthList[1])) cmds.text(l='Driver List', al='center') uifnc.setSpace(10) cmds.scrollLayout() self._driverList = cmds.textScrollList(w=widthList[1] - 8, sc=self.selectDriverCmd, ams=1) cmds.setParent('..') cmds.setParent('..') uifnc.setSpace() cmds.rowColumnLayout(nc=1, cw=(1, widthList[3] - 1)) cmds.text(l='Driver Value') uifnc.setSpace(30) cmds.frameLayout(cll=0, lv=0) uifnc.setSpace() driverWidthList = uifnc.setWidthByPerList([50, 50, 5], widthList[3] - 2) self._angleFrame = cmds.rowColumnLayout(nc=3, cw=[(1, driverWidthList[0]), (2, driverWidthList[1]), (3, driverWidthList[2])], en=1) cmds.text(l='Angle1') self._angle1 = cmds.floatField(editable=False) uifnc.setSpace() cmds.text(l='Angle2') self._angle2 = cmds.floatField(editable=False) uifnc.setSpace() cmds.text(l='Angle3') self._angle3 = cmds.floatField(editable=False) uifnc.setSpace() cmds.setParent('..') uifnc.setSpace() cmds.setParent('..') driverWidthList = uifnc.setWidthByPerList([5, 60, 40, 5], widthList[3] - 2) cmds.rowColumnLayout(nc=4, cw=[(1, driverWidthList[0]), (2, driverWidthList[1]), (3, driverWidthList[2]), (4, driverWidthList[3])]) uifnc.setSpace() cmds.text(l='Smaller Value : ') self._smallerValueField = cmds.floatField(v=0.01) uifnc.setSpace() cmds.setParent('..') uifnc.setSpace(20) self._showOnlyMovedCheck = cmds.checkBox(l='Show Only Moved Driver', cc=self.checkCmd) uifnc.setSpace(10) cmds.button(l='Update Condition', h=30, c=self.updateCondition) cmds.setParent('..') cmds.setParent('..') cmds.rowColumnLayout() uifnc.setSpace(10) cmds.separator(width=self._width + 2) uifnc.setSpace(10) cmds.setParent('..') uifnc.setSpace() cmds.setParent('..') driverWidthList = uifnc.setWidthByPerList([5, 90, 5], self._width) cmds.rowColumnLayout(nc=3, cw=[(1, driverWidthList[0]), (2, driverWidthList[1]), (3, driverWidthList[2])]) uifnc.setSpace() cmds.button(l='Set Driver', h=30, c=self.setDriverCmd) uifnc.setSpace() uifnc.setSpace() cmds.button(l='Make PSD Skin', h=30, c=self.makePSDSkinCmd) uifnc.setSpace() cmds.setParent('..') cmds.window(self._winName, e=1, width=self._width + 2, height=self._height) cmds.showWindow(self._winName) self.setScriptJob()