Пример #1
0
        def openSelectedCallback(self,*args):
                """
                This method is called on double click selected item in textscrollList
                """
                #try block also saves from error caused by directories that we do not have rights to access.
                cMsg="Selected scene file is already open. Do you want to reload it?\n If you reload all changes you made since last save will be lost."
                try:
                        cmds.button('upBtn',edit=True,enable=True)
                        self.selectedItem=str(os.path.join(cmds.textField('location',q=True,tx=True),str(cmds.textScrollList('fileLister',q=True,si=True)[0]).split(" > ")[0])).replace("/","\\")

                        if (self.selectedItem.endswith("ma")) or (self.selectedItem.endswith("mb")):
                                print "selected Item: %s\n scene Open: %s"%(self.selectedItem , cmds.file(q=True,sn=True))
                                if self.selectedItem==cmds.file(q=True,sn=True).replace("/","\\"):
                                        print "Same Scene"
                                        result=cmds.confirmDialog(t='Warning',m=cMsg,button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
                                        if result== "Yes":
                                                state= cmds.file(self.selectedItem,open=True, f=True)
                                else:
                                        print"Saved scene file %s"%os.path.basename(cmds.file(q=True,sn=True))
##                      if not cmds.file(q=True,save=True):
##                         cmds.file(save=True)
                                        state= cmds.file(self.selectedItem,open=True, f=True)
                        else:
                                if os.path.isdir(self.selectedItem):
                                        cmds.textField('location',edit=True,tx=self.selectedItem)
                                        self.populatescrollList(self.selectedItem.replace("/","\\"))

                except Exception as e:
                        print e
Пример #2
0
 def addFloatVariable(self, nodeAttr, varslayout, name=None, value=None):
    n = cmds.columnLayout(varslayout, query=1, numberOfChildren=1)
    
    indexStr = "[%d]" % n
    nameAttr = nodeAttr + indexStr
    valueAttr = nodeAttr.replace("fparam_name", "fparam_value") + indexStr
    
    form = cmds.formLayout(numberOfDivisions=100, parent=varslayout)
    
    rembtn = cmds.button(label="-")
    namefld = cmds.textField(text=("fparam%d" % n if name is None else name))
    vallbl = cmds.text(label="=")
    valfld = cmds.floatField(value=(0.0 if value is None else value))
    
    cmds.setAttr(nameAttr, ("fparam%d" % n if name is None else name), type="string")
    cmds.setAttr(valueAttr, (0.0 if value is None else value))
    
    self.setupVariableNameCallback(nameAttr, namefld)
    self.setupFloatVariableValueCallback(valueAttr, valfld)
    
    cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, n))
    
    cmds.formLayout(form, edit=1,
                    attachForm=[(rembtn, "top", 0), (rembtn, "bottom", 0), (rembtn, "left", 0),
                                (namefld, "top", 0), (namefld, "bottom", 0),
                                (vallbl, "top", 0), (vallbl, "bottom", 0),
                                (valfld, "top", 0), (valfld, "bottom", 0)],
                    attachControl=[(namefld, "left", 5, rembtn),
                                   (vallbl, "left", 5, namefld),
                                   (valfld, "left", 5, vallbl)],
                    attachNone=[(rembtn, "right"),
                                (vallbl, "right")],
                    attachPosition=[(namefld, "right", 0, 30),
                                    (valfld, "right", 0, 100)])
Пример #3
0
    def _reloadUI(self, frame):

        flg = logging.getLogger("lettuce._reloadUI")

        mc.deleteUI(frame)
        flg.info("Deleting UI: {}".format(frame))

        mc.frameLayout('masterFrame',
                       parent=self.uiWindow,
                       label='',
                       width=400,
                       labelVisible=False,
                       marginWidth=0
                       )

        if self.xml_load_state:
            flg.info("XML File Loaded")
            self.char_in_scene_list = self._get_characters(self.char_xml_file)

            if len(self.char_in_scene_list) > 0:
                self.char_in_scene = True
                flg.info("Characters verified in Scene")
            else:
                self.char_in_scene = False
                flg.info("Characters verified not in scene")

        if self.char_in_scene:
            flg.info("Creating Character Menus")
            self._create_character_frame(self.char_in_scene_list, "masterFrame")
        else:
            flg.info("Added reload button ")
            mc.button('reloadButton',
                      label="Reload",
                      command=lambda *_: self._reloadUI("masterFrame")
                      )
Пример #4
0
def snapOnClosestVertex_window():
	"""
	Creates the 'Snap On Closest Vertex' vertex window.
	"""

	cmds.windowPref(enableAll=False)

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

	cmds.window("snapOnClosestVertex_window",
		title="Snap On Closest Vertex",
		width=320)

	spacing = 5

	cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)

	cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
	cmds.text(label="Reference Object:")
	referenceObject_textField = cmds.textField("referenceObject_textField")
	cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked)

	cmds.showWindow("snapOnClosestVertex_window")
	cmds.windowPref(enableAll=True)
Пример #5
0
 def removeFloatVariable(self, nodeAttr, varslayout, index):
    # Remove variable
    children = cmds.columnLayout(varslayout, query=1, childArray=1)
    
    if len(children) <= index:
       return
    
    baseNameAttr = nodeAttr
    baseValueAttr = nodeAttr.replace("fparam_name", "fparam_value");
    
    for i in xrange(index+1, len(children)):
       rembtn, namefld, _, valfld = cmds.formLayout(children[i], query=1, childArray=1)
       
       indexStr = "[%d]" % (i - 1)
       nextIndexStr = "[%d]" % i
       
       nameAttr = baseNameAttr + indexStr
       valueAttr = baseValueAttr + indexStr
       
       cmds.setAttr(nameAttr, cmds.getAttr(baseNameAttr + nextIndexStr), type="string")
       cmds.setAttr(valueAttr, cmds.getAttr(baseValueAttr + nextIndexStr));
       
       self.setupVariableNameCallback(nameAttr, namefld)
       self.setupFloatVariableValueCallback(valueAttr, valfld)
       cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, i-1))
    
    cmds.deleteUI(children[index])
    
    cmds.removeMultiInstance("%s[%d]" % (baseNameAttr, len(children)-1), b=True)
    cmds.removeMultiInstance("%s[%d]" % (baseValueAttr, len(children)-1), b=True)
 def commonButtons(self):
     """
     Create common buttons for all option boxes
     """
     self.commonBtnSize = ((self.size[0]-18)/3, 26)
     # The basic idea for computing the width is that we want 5 pixels of padding on the left and right, 
     # and 4 pixels of padding in between the buttons (5+4+4+45 =18). Hence, we subtract a total of 
     # 18 from the window's width before dividing by 3. The height is 26 pixels.
     self.actionBtn = cmds.button(label=self.actionName, height=self.commonBtnSize[1],
                                  command=self.actionBtnCmd)
     self.applyBtn = cmds.button(label='Apply', height=self.commonBtnSize[1],
                                  command=self.applyBtnCmd)
     self.closeBtn = cmds.button(label='Close', height=self.commonBtnSize[1],
                                  command=self.closeBtnCmd)
     cmds.formLayout(self.mainForm, edit=True, attachForm=
                     ([self.actionBtn, 'left', 5],
                     [self.actionBtn, 'bottom', 5],
                     [self.applyBtn, 'bottom', 5],
                     [self.closeBtn, 'bottom', 5],
                     [self.closeBtn, 'right', 5]),
                     attachPosition=
                     ([self.actionBtn, 'right', 1, 33],
                      [self.closeBtn, 'left', 0, 67]),
                     attachControl=
                     ([self.applyBtn, 'left', 4, self.actionBtn],
                      [self.applyBtn, 'right', 4, self.closeBtn]),
                     attachNone=
                     ([self.actionBtn, 'top'],
                      [self.applyBtn, 'top'],
                      [self.closeBtn, 'top']))
Пример #7
0
def zbw_offsetAnim(*args):
    """creates offset from first obj sel to last based on the entered offset value"""
    def zbw_runOffsetAnim(*args):
        #get frame range!!!!!!
        #get selection, check that they are tranforms
        sel = cmds.ls(sl=True,type="transform")
        selSize = int(len(sel))
        #for each selection mult the index by the offset value
        for i in range(0,selSize):
            obj = sel[i]
            offsetRaw = cmds.intFieldGrp('zbw_offsetValue', q=True, v=True)
            offset = offsetRaw[0]
            multFactor = i * offset
            #shift the entire anim curve by the offset mult value
            cmds.keyframe(obj, edit=True,relative=True,timeChange=multFactor,time=(1,24))

    #create UI, get offset value, frame range or all anim
    if (cmds.window('zbw_offsetAnimUI', exists=True)):
        cmds.deleteUI('zbw_offsetAnimUI', window=True)
        cmds.windowPref('zbw_offsetAnimUI', remove=True)
    window=cmds.window('zbw_offsetAnimUI', widthHeight=(350,200), title='zbw_offsetAnim')
    cmds.columnLayout(cal='center')
    cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5)
    #CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?)
    #WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT)
    #checkbox for random freq (to give a random amount to offset each object)
    #cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom)
    cmds.button('zbw_offsetAnimGo', label='offset!', width=75, command=zbw_runOffsetAnim)

    cmds.showWindow(window)
Пример #8
0
def particleLocatorsUI():
    """
    """
    # Get current frame range
    start = cmds.playbackOptions(q=True, min=True)
    end = cmds.playbackOptions(q=True, max=True)

    # Define window
    particleLocatorsUI = 'particleLocatorsWindow'
    if cmds.window(particleLocatorsUI, q=True, ex=True): cmds.deleteUI(particleLocatorsUI)
    particleLocatorsUI = cmds.window(particleLocatorsUI, t='Generate Locators')

    # UI Layout
    cmds.columnLayout(adj=False, cal='left')
    partiTFG = cmds.textFieldGrp('partiLoc_particleTFG', label='Particle', text='', cw=[(1, 120)])
    prefixTFG = cmds.textFieldGrp('partiLoc_prefixTFG', label='Prefix', text='', cw=[(1, 120)])
    bakeAnicmdsBG = cmds.checkBoxGrp('partiLoc_bakeAnicmdsBG', label='Bake Animation', ncb=1, v1=0, cw=[(1, 120)])
    startEndIFG = cmds.intFieldGrp('partiLoc_startEndISG', nf=2, label='Frame Range', v1=start, v2=end, cw=[(1, 120)])

    rotateLocCBG = cmds.checkBoxGrp('partiLoc_rotateCBG', label='Rotate (rotatePP)', ncb=1, v1=0, cw=[(1, 120)])
    scaleLocCBG = cmds.checkBoxGrp('partiLoc_scaleCBG', label='Scale (scalePP)', ncb=1, v1=0, cw=[(1, 120)])

    cmds.button(l='Create Locators', c='glTools.tools.generateParticles.particleLocatorsFromUI()')

    # Popup menu
    cmds.popupMenu(parent=partiTFG)
    for p in cmds.ls(type=['particle', 'nParticle']):
        cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')

    # Show Window
    cmds.showWindow(particleLocatorsUI)
Пример #9
0
def locatorParticlesUI():
    """
    """
    # Define window
    locParticleUI = 'locatorParticleWindow'
    if cmds.window(locParticleUI, q=True, ex=True): cmds.deleteUI(locParticleUI)
    locParticleUI = cmds.window(locParticleUI, t='Generate Particles')

    # UI Layout
    cmds.columnLayout(adj=False, cal='left')
    partiTFG = cmds.textFieldGrp('locParticle_particleTFG', label='Particle', text='', cw=[(1, 100)])
    radiusFFG = cmds.floatSliderGrp('locParticle_radiusFSG', label='radius', f=True, min=0.1, max=10.0, fmn=0.01,
                                  fmx=100.0, pre=2, v=1.0, cw=[(1, 100)])
    rotateLocCBG = cmds.checkBoxGrp('locParticle_rotateCBG', label='Add rotatePP', ncb=1, v1=0, cw=[(1, 100)])
    scaleLocCBG = cmds.checkBoxGrp('locParticle_scaleCBG', label='Add scalePP', ncb=1, v1=0, cw=[(1, 100)])
    selfCollideCBG = cmds.checkBoxGrp('locParticle_selfCollideCBG', label='self collide', ncb=1, v1=0, cw=[(1, 100)])

    cmds.button(l='Create Particles', c='glTools.tools.generateParticles.locatorParticlesFromUI()')

    # Popup menu
    cmds.popupMenu(parent=partiTFG)
    for p in cmds.ls(type=['particle', 'nParticle']):
        cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')

    # Show Window
    cmds.showWindow(locParticleUI)
Пример #10
0
    def __init__(s):
        with report.Report():
            tracker = JointTracker()
            winName = "Orient_Joints"
            if cmds.window(winName, ex=True):
                cmds.deleteUI(winName)
            s.win = cmds.window(rtf=True, w=300, t="Orient Joints")
            cmds.columnLayout(adj=True)
            cmds.button(
                l="Attach Marker",
                h=50,
                c=Callback(tracker.addMarker),
                ann="""
Attach a Marker to the selected Joint.
Rotate the marker into the desired joint rotation.
"""
            )
            cmds.button(
                l="Update Joints",
                h=50,
                c=Callback(tracker.orientJoints),
                ann="""
Rotate all joints that have markers to their respective rotations.
"""
            )
            cmds.showWindow(s.win)
            cmds.scriptJob(uid=[s.win, tracker.removeMarkers])
Пример #11
0
 def doIt( self, arglist ):
  wnd = cmds.window( "kgmEngineWindow_" + str(time.time()), widthHeight = ( 200, 200 ) )
  #cmds.columnLayout( adjustableColumn = True )
  #cmds.button( label = 'Export Map',          command = kgmEngine.exportMap )
  #cmds.button( label = 'Export Mesh',         command = kgmEngine.exportMesh )
  #cmds.button( label = 'Export Skeleton',     command = kgmEngine.exportSkeleton )
  #cmds.button( label = 'Export Animation',    command = kgmEngine.exportAnimation )
  #cmds.button( label = 'Insert Node',         command = kgmEngine.insertNode )
  cmds.columnLayout()
  cmds.rowColumnLayout( numberOfColumns = 2 )
  cmds.checkBox( "Mesh", label="Mesh", value=False, onCommand=kgmEngine.enableMesh, offCommand=kgmEngine.enableMesh )
  cmds.checkBox( "Material", label="Material", value=False, onCommand=kgmEngine.enableMaterial, offCommand=kgmEngine.enableMaterial )
  cmds.checkBox( "Skeleton", label="Skeleton", value=False, onCommand=kgmEngine.enableSkeleton, offCommand=kgmEngine.enableSkeleton )
  cmds.checkBox( "Animation", label="Animation", value=False, onCommand=kgmEngine.enableAnimation, offCommand=kgmEngine.enableAnimation )
  
  cmds.columnLayout()
  cmds.rowColumnLayout( numberOfColumns = 2 )
  cmds.columnLayout( adjustableColumn=True )
  cmds.button( label = 'Export',         command = kgmEngine.export )
  cmds.button( label = 'Insert Node',    command = kgmEngine.insertNode )
  
  cmds.columnLayout()
  cmds.rowColumnLayout( numberOfColumns = 3 )
  cmds.columnLayout( adjustableColumn=True )
  cmds.radioCollection()
  cmds.radioButton( label='Bin', align='left', select=False )
  cmds.radioButton( label='Xml', align='left', select=True  )
  
  #cmds.radioButtonGrp( label='Format',   labelArray3=['Bin', 'Txt', 'Xml'], numberOfRadioButtons=3 )
  #cmds.radioButton( 'Format', label='Bin',   )
  cmds.showWindow( wnd )
Пример #12
0
    def __init__(self):
        winName = "Size set"
        global typeMenu
        winTitle = winName
        if cmds.window(winName, exists=True):
                cmds.deleteUI(winName)

#         self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 )
        window = cmds.window(winName, title=winTitle, tbm=1, w=250, h=100 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=250)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(100, 20))
        typeMenu=cmds.optionMenu( label='ctrl size')
        cmds.menuItem( label="Large" )
        cmds.menuItem( label="Med" )
        cmds.menuItem( label="Small" )           
        cmds.button (label='Change Selection', p='listBuildButtonLayout', command = lambda *args:self.controllerSize())
        cmds.showWindow(window)    
Пример #13
0
def setAttributeVectorUI():
    global tfXIn, tfXOut, tfYIn, tfYOut, tfZIn, tfZOut, tslVectorList, tfXAdd, tfYAdd, tfZAdd, vectorUI
    vectorUI = 'vectorUI'
    closeUI(vectorUI)
    cmds.window(vectorUI, title = 'vectorUI')
    cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210)
    cmds.text('..: random range :..', backgroundColor = [0.15, 0.15, 0.0])
    cmds.gridLayout(numberOfColumns = 6, cellWidthHeight = (33, 20))
    tfXIn = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
    tfXOut = cmds.textField(text = '1.0', backgroundColor = [0.15, 0.1, 0.0])
    tfYIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
    tfYOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.15, 0.1])
    tfZIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
    tfZOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.1, 0.15])
    cmds.setParent('..')
    cmds.button('ok', command = 'setAttributeVectorRandom()')
    cmds.separator(style = 'out')
    cmds.text('..: vector list :..', backgroundColor = [0.0, 0.15, 0.15])
    tslVectorList = cmds.textScrollList(allowMultiSelection = True)
    cmds.button('remove', command = 'removeScrollListVector()')
    cmds.gridLayout(numberOfColumns = 4, cellWidthHeight = (50, 20))
    tfXAdd = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
    tfYAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
    tfZAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
    cmds.button('add..', command = 'addScrollListVector()')
    cmds.setParent('..')
    cmds.button('random', command = 'setAttributeListVectorRandom()')
    cmds.button('increment %', command = 'setAttributeListVectorInc()')
    cmds.setParent('..')
    cmds.showWindow()
Пример #14
0
def addMultiAttr():
    #Create a variable for the window name
    winName = 'blend'
    winTitle = 'rh_addMultiAttr'
    #Delete the window if it exists
    if cmds.window(winName, exists=True):
        cmds.deleteUI(winName, window=True)
    #Build the main window
    cmds.window(winName, title=winTitle, sizeable=True)
    cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()')
    cmds.columnLayout(adjustableColumn=True)    
    cmds.textFieldGrp('Attr',l='Attribute:',text='')   

    cmds.columnLayout(adjustableColumn=True)  
    cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0) 
       
    cmds.columnLayout(adjustableColumn=True) 
    cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0)
    
    cmds.columnLayout(adjustableColumn=True)        
    cmds.button(label='Contact', command='Connect()')
    cmds.columnLayout(adjustableColumn=True)
    #Show the window
    cmds.showWindow(winName)
    cmds.window(winName, edit=True, width=300, height=120)
Пример #15
0
 def new(self):
     cmds.setParent(self.parent)
     self.name = cmds.button(self.name, label=self.label, c=self.cmd, h=self.h)
     if self.bgc:
         cmds.button(self.name, e=True, bgc=self.bgc)
     attachForm = [(self.name, 'bottom', self.moveUp), (self.name, 'right', 0), (self.name, 'left', 0)]
     cmds.formLayout(self.parent, edit=True, attachForm=attachForm)
Пример #16
0
	def create(self):
		if cmds.window('uvShellAlignWindow', exists = True):
			cmds.deleteUI('uvShellAlignWindow')

		self.window = cmds.window(self.window, title = self.title, widthHeight = self.size)
		self.frameForm = cmds.frameLayout(label = " 1. 基準とする UVShell を選択して登録", bgc = (0.5, 0.3, 0.2), cll = False)
		self.setUVSBtn1 = cmds.button(label = "基準 UVShell を登録"  , command = self.registUVBndBox1, height = 30 )
		cmds.rowLayout( numberOfColumns = 1, adj = True)					

				




		cmds.setParent("..")			
		self.frameForm = cmds.frameLayout(label = " 2. 位置を揃えたい UVShell を選択して実行", bgc = (0.2, 0.3, 0.5), cll = False)
		self.distDcheckBox = cmds.radioButtonGrp('radioBtn', label = "", numberOfRadioButtons = 4 ,
							 sl = 1, cl4 = ['left','left','left','left'] , la4 = [ 'Left', 'Right', 'Bottom', 'Top'], adj = True)

		self.backupPathText = cmds.text("※ 2016/1/5 現在、複数UVを選択した状態での位置揃えには対応していません", font = "smallBoldLabelFont", align = 'left');
		self.setUVSBtn2 = cmds.button(label = "選択した UVShell を揃える" , command = self.registUVBndBox2, height = 30 )
		cmds.setParent("..")	
		
		cmds.separator(width = self.width, style = 'in')
		
		cmds.text("【問い合わせ先】 : TAセクション.村岡", bgc = (0.2, 0.2, 0.2), align = 'left', width = self.width);

		cmds.setParent("..")	
		cmds.showWindow()
Пример #17
0
	def makeSaveVisible(self):
		
		cmds.button("btnSaveNetwork", e=1, en = 1)
		cmds.button("btnSaveWs", e=1, en = 1)

#if __name__=="__main__":
#	obj = shotManager_SID()
Пример #18
0
 def enterTimecodeUI(self, buttonlabel='set', buttonfunc=None):
     '''
     generic UI to enter timecode
     
     :param buttonlabel' = label to add to the button
     :param buttonfunc' = function to bind to the button on exit
     '''
     self.win='Timecode_UI'
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win)
     cmds.columnLayout(adjustableColumn=True)
     cmds.text(label='Timecode Reference')
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(nc=8)
     cmds.text(label='  smpte :  ')
     cmds.textField('tchrs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tchrs'))
     cmds.text(label=' : ')
     cmds.textField('tcmins', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcmins'))
     cmds.text(label=' : ')
     cmds.textField('tcsecs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcsecs'))
     cmds.text(label=' : ')
     cmds.textField('tcfrms', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcfrms'))
     cmds.setParent('..')
     cmds.button(label=buttonlabel, command=lambda x:self.__uicb_gatherTimecode(buttonfunc))
     cmds.showWindow(self.win)
Пример #19
0
def transfertSelectionToTarget_window():
	"""
	This definition creates the 'Transfert Selection To Target' main window.
	"""

	cmds.windowPref(enableAll=False)

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

	cmds.window("transfertSelectionToTarget_window",
		title="Transfert Selection To Target",
		width=320)

	spacing = 5

	cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)

	cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
	cmds.text(label="Target:")
	sources_textField = cmds.textField("target_textField")
	cmds.button("pickTarget_button", label="Pick Target!", command=pickTarget_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("transfertSelection_button", label="Transfert Selection!", command=transfertSelection_button_OnClicked)

	setUnsetContextHotkeys()
	scriptJob = cmds.scriptJob(uiDeleted=("transfertSelectionToTarget_window", setUnsetContextHotkeys), runOnce=True)

	cmds.showWindow("transfertSelectionToTarget_window")

	cmds.windowPref(enableAll=True)
Пример #20
0
def UI():
    if cmds.window("TressFXExporterUI", exists = True):
        cmds.deleteUI("TressFXExporterUI")

    windowTitle = 'TressFX Exporter' + ' ' + 'v' + tressfx_exporter_version
    window = cmds.window("TressFXExporterUI", title = windowTitle, w=280, h = 260, mnb=False, sizeable=False)
    mainLayout = cmds.columnLayout(w=280, h=260)

    cmds.separator(h=8, style='in')
    cmds.text(label='Number of vertices per strand (4, 8, 16, 32 or 64):', align='left')
    cmds.intField("numVerticesPerStrand", w=30, minValue=4, maxValue=64, value=16 )
    cmds.separator(h=8, style='in')
    cmds.checkBox("bothEndsImmovable", label='Both ends immovable')
    cmds.checkBox("InvertZ", label='Invert Z', value = True)
    cmds.checkBox("exportSkinCheckBox", label='Export skin data', value = False)
    cmds.checkBox("randomStrandCheckBox", label='Randomize strands for LOD', value = True)
    
    cmds.separator(h=15)
    
    cmds.button(label="Set the base mesh", w=170, h=30, command=SetBaseMesh)
    cmds.textField("MeshNameLabel", w=170, editable=False)
    
    cmds.separator(height=10, style='none')
    cmds.button(label="Export as binary (*.tfx)", w=170, h=30, command=ExportBinary)
    
    cmds.separator(h=15)
    
    version_text = 'v' + tressfx_exporter_version
    cmds.text(label=version_text, align='left')
    
    global selected_mesh_shape_name
    selected_mesh_shape_name = ''
    
    cmds.showWindow(window)
Пример #21
0
	def __init__( self, setsToReparent ):
		baseMelUI.BaseMelWindow.__init__( self )

		allSets = set( mel.zooVisManListHeirarchically() )
		allSets.difference_update( set(setsToReparent) )

		self.UI_form = cmd.formLayout()
		self.UI_tsl = cmd.textScrollList(ams=0, nr=18)
		self.UI_button_parent = cmd.button(l="parent")

		cmd.textScrollList(self.UI_tsl, e=True, dcc='%s.ui.reparentUI.on_done()' % name)
		cmd.button(self.UI_button_parent, e=True, c='%s.ui.reparentUI.on_done()' % name)

		#
		cmd.textScrollList(self.UI_tsl, e=True, a=self.NO_PARENT)
		for vset in allSets:
			cmd.textScrollList(self.UI_tsl, e=True, a=vset)

		cmd.formLayout(self.UI_form, e=True,
				   af=((self.UI_tsl, "top", 0),
					   (self.UI_tsl, "left", 0),
					   (self.UI_tsl, "right", 0),
					   (self.UI_button_parent, "left", 0),
					   (self.UI_button_parent, "right", 0),
					   (self.UI_button_parent, "bottom", 0)),
				   ac=((self.UI_tsl, "bottom", 0, self.UI_button_parent)) )

		#select the no parent option
		cmd.textScrollList(self.UI_tsl, e=True, si=self.NO_PARENT)
		self.show()
Пример #22
0
	def __init__(self) :
		# get the currently selected objects and make sure we have only one object
		selected = OM.MSelectionList()
		OM.MGlobal.getActiveSelectionList(selected)
		self.selectedObjects = []
		selected.getSelectionStrings(self.selectedObjects)
		if len(self.selectedObjects) == 0 :
			cmds.confirmDialog( title='No objects Selected', message='Select a Mesh Object', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' )
		elif len(self.selectedObjects) > 1 :
			cmds.confirmDialog( title='Select One Object', message='Only One Mesh mat be exported at a time', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' )
		# now we have the correct criteria we can proceed with the export
		else :
			# get the start and end values for our UI sliders
			anim=OMA.MAnimControl()
			minTime=anim.minTime()
			maxTime=anim.maxTime()
			self.m_start=int(minTime.value())
			self.m_end=int(maxTime.value())
			# now we create a window ready to populate the components
			self.m_window = cmds.window( title='NCCA Pointbake Export' )
			# create a layout
			cmds.columnLayout()
			# create two sliders for start and end we also attach methods to be called when the slider
			# changes
			self.m_startSlider=cmds.intSliderGrp( changeCommand=self.startChanged,field=True, label='Start Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_start, fieldMaxValue=self.m_end, value=self.m_start )
			self.m_endSlider=cmds.intSliderGrp( changeCommand=self.endChanged ,field=True, label='End Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_end, fieldMaxValue=self.m_end, value=self.m_end )
			# create a button and add the method called when pressed
			cmds.button( label='Export', command=self.export )
			# finally show the window
			cmds.showWindow( self.m_window )
def stabilizer (task):
	camera	= Camera()
	point	= cmds.ls (selection = True)

	if task == 'end':
		# turn off stab
		expression		= str (cmds.expression ('stabilizator_expression', string = True, query = True))
		camera.shape	= expression[2:expression.find('#')]
		cmds.delete ('stabilizator_expression')
		camera.reset_camera ()
		cmds.button ('button_stabilizer',
					edit				= True,
					label				= 'stabilize',
					backgroundColor		= (0, 0.5, 0),
					command				= 'fstab.stabilizer("start")')

	else:
		# start stab
		if cmds.objExists ('stabilizator_expression'):
			# stabilizator exists
			expression		= str (cmds.expression ('stabilizator_expression', string = True, query = True))
			camera.shape	= expression[2:expression.find('#')]
			cmds.delete ('stabilizator_expression')
			cmds.select (camera.shape, replace = True)
			cmds.warning (('>>> STAB WAS TURNED ON. CHECK: ' + camera.shape + ' <<< FOR NONZERO OFFSET VALUES ::..'))
		
		else:
			if cmds.nodeType (point) != 'mesh' and cmds.nodeType (point) != 'transform' and len (point) == 0:
				# wrong selection
				cmds.warning ('..:: SELECT SOMETHING TO STABILIZE ::..')
			else:
				point = point[0]
				
				if point != camera.transform and point != camera.shape and camera.transform != 'empty':
					# stabilize
					cmds.setAttr( camera.shape + '.displayResolution', 0)
					cmds.setAttr( camera.shape + '.displayFilmGate', 0)
				
					expression = '//%s#' % camera.shape
					expression += '\npython "import maya.cmds as cmds";'
					expression += '\npython "fov_h = cmds.camera (\'%s\', query = True, horizontalFieldOfView = True)";' % camera.shape
					expression += '\npython "fov_v = cmds.camera (\'%s\', query = True, verticalFieldOfView = True)";' % camera.shape
					expression += '\npython "aperture_h = cmds.camera (\'%s\', query = True, horizontalFilmAperture = True)";' % camera.shape
					expression += '\npython "aperture_v = cmds.camera (\'%s\', query = True, verticalFilmAperture = True)";' % camera.shape
					expression += '\n$pos=`python "fstab.get_normalized_screen_position(\'%s\',\'%s\',fov_h, fov_v,aperture_h,aperture_v)"`;' % (point, camera.transform)
					expression += '\nsetAttr "%s.horizontalFilmOffset" ($pos[2]);' % camera.shape
					expression += '\nsetAttr "%s.verticalFilmOffset" ($pos[3]);' % camera.shape

					# create expression
					cmds.expression		(name = 'stabilizator_expression', string = expression)
		
					# update GUI
					cmds.button			('button_stabilizer',
										edit			= True,
										label			="deStabilize",
										backgroundColor	= (1, 0, 0),
										command			= 'fstab.stabilizer("end")')
					
				else:
					cmds.warning ('..:: CLICK IN THE PANE WITH THE CAMERA ::..')
Пример #24
0
 def drawButton(self,elem,x,y,w=None,h=None):
     """ Draw a Button 
     @type  elem: dictionary
     @param elem: the button dictionary
     @type  x: int
     @param x: position on x in the gui windows
     @type  y: int
     @param y: position on y in the gui windows
     @type  w: int
     @param w: force the width of the item
     @type  h: int
     @param h: force the height of the item
     """        
     name = elem["name"]
     if elem["label"] != None:
         name = elem["label"]
     if elem["action"] is not None :
         elem["id"] = cmds.button( label=name, 
                     w=elem["width"]*self.scale,
                     h=elem["height"]*self.scale,
                     c=partial(elem["action"],),
                     recomputeSize=False)
     else :
         elem["id"] = cmds.button( label=name,
                     w=elem["width"]*self.scale,
                     h=elem["height"]*self.scale,recomputeSize=False)
Пример #25
0
def setupRLUI():
    if cmds.window("RLWin", exists=True):
        cmds.deleteUI("RLWin")
    
    widgets["win"] = cmds.window("RLWin", t="zbw_setupRL", w=200, h=400)
    widgets["mainCL"] = cmds.columnLayout(w=200)
    widgets["mainFrame"] = cmds.frameLayout(l="Create Render Layers", w=200, cll=True, bgc=(.2,.2,.2))
    
    widgets["CarKey"] = cmds.checkBox(l="Car_Env", v=True)
    widgets["CarEnv"] = cmds.checkBox(l="Car_Key", v=True)
    widgets["BGKey"] = cmds.checkBox(l="BG_Env", v=True)
    widgets["BGEnv"] = cmds.checkBox(l="BG_Key", v=True)
    widgets["AO"] = cmds.checkBox(l="All_AO", v=True)
    widgets["MatteA"] = cmds.checkBox(l="All_MatteA", v=True)
    widgets["MatteB"] = cmds.checkBox(l="All_MatteB", v=True)
    widgets["MoVec"] = cmds.checkBox(l="All_MoVec", v=True)
    widgets["Shadow"] = cmds.checkBox(l="All_Shadow", v=True)
    
    widgets["createBut"] = cmds.button(l="Create Layers", w=200, h=40, bgc=(.6,.8,.6), c=createRL)
    cmds.text("NOTE: this is setting the overrides for \nthe moVec layer RG's and materials \n(if you have them in scene\n for the AO and Movec layers but \n NO passes are set up")
    cmds.separator(h=20, style = "double")
    #widgets["copyBut"] = cmds.button(l="Copy Selected Layer", w=200, h=40, bgc=(.8,.8,.6), c=copyRL)
    #cmds.separator(h=20, style = "double")
    widgets["importBut"] = cmds.button(l="Import RL Shaders File", w=200, h=40, bgc=(.8,.6,.6), c=importRL)
   
    cmds.showWindow(widgets["win"])
    cmds.window(widgets["win"], e=True, w=200, h=400)
Пример #26
0
def evenEdgeSpacingUI():
    """
    Even Edge Spacing UI
    """
    # Window
    window = 'evenEdgeSpacingUI'
    if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
    window = cmds.window(window, t='Even Edge Spacing', s=True)

    # Layout
    CL = cmds.columnLayout()

    # UI Elements
    cmds.intSliderGrp('evenEdgeSpacing_smoothISG', label='Smooth', field=True, minValue=0, maxValue=20, fieldMinValue=0,
                    fieldMaxValue=100, value=4)
    cmds.floatSliderGrp('evenEdgeSpacing_influenceFSG', label='Influence', field=True, minValue=0.0, maxValue=1.0,
                      fieldMinValue=0.0, fieldMaxValue=1.0, value=1.0)
    cmds.checkBoxGrp('evenEdgeSpacing_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1,
                   v1=False)  # columnWidth2=[100,165]
    cmds.checkBoxGrp('evenEdgeSpacing_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False)
    cmds.button('evenEdgeSpacingB', l='Even Edge Spacing', w=390,
              c='glTools.model.straightenVerts.evenEdgeSpacingFromUI()')

    # Show Window
    cmds.window(window, e=True, wh=[392, 99])
    cmds.showWindow(window)
Пример #27
0
def smoothEdgeLineUI():
    """
    Smooth Edge Line UI
    """
    # Window
    window = 'smoothEdgesUI'
    if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
    window = cmds.window(window, t='Smooth Edge Line', s=True)

    # Layout
    CL = cmds.columnLayout()

    # UI Elements
    cmds.intSliderGrp('smoothEdges_smoothISG', label='Smooth', field=True, minValue=1, maxValue=20, fieldMinValue=1,
                    fieldMaxValue=100, value=4)
    cmds.floatSliderGrp('smoothEdges_falloffFSG', label='Falloff Distance', field=True, precision=3, minValue=0.0,
                      maxValue=10.0, fieldMinValue=0.0, fieldMaxValue=100.0, value=0.01)
    cmds.checkBoxGrp('smoothEdges_edgeSpacingCBG', label='Maintain Edge Spacing', numberOfCheckBoxes=1, v1=False)
    cmds.checkBoxGrp('smoothEdges_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1,
                   v1=False)  # columnWidth2=[100,165]
    cmds.checkBoxGrp('smoothEdges_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False)
    cmds.button('smoothEdgesB', l='Smooth', w=390, c='glTools.model.straightenVerts.smoothEdgeLineFromUI()')

    # Show Window
    cmds.window(window, e=True, wh=[392, 115])
    cmds.showWindow(window)
Пример #28
0
 def create( self, *args ):
     
     if cmds.window( self.winName, ex=1 ):
         cmds.deleteUI( self.winName, wnd=1 )
     cmds.window( self.winName, title= self.title, titleBarMenu=0 )
     
     cmds.columnLayout()
     cmds.rowColumnLayout( nc=1, cw=[( 1,self.width-2)] )
     cmds.text( l='Register ID', h=30 )
     idField = cmds.textField( h=25 )
     helpField = cmds.textField( en=0 )
     cmds.setParent( '..' )
     
     firstWidth = (self.width-2)*0.5
     secondWidth = (self.width-2)-firstWidth
     cmds.rowColumnLayout( nc=2, cw=[(1,firstWidth),(2,secondWidth)])
     cmds.button( l='Create', h=25, c=self.cmdCreate )
     cmds.button( l='Cancel', h=25, c=self.cmdCancel )
     cmds.setParent( '..' )
     
     cmds.window( self.winName, e=1,
                  width = self.width,
                  height = self.height )
     cmds.showWindow( self.winName )
     
     self.idField = idField
     self.helpField = helpField
Пример #29
0
 def commonButtons(self):
     # Creates a button size parameter with a padding of 18 pixels.  The width is the size of the UI width minus the padding
     # divided by three.  The height is 26 pixels.  
     self.commonBtnSize = ((self.size[0]-18)/3, 26)
     # Establishes the layout of the buttons.  Sets them into a row, with three buttons in the row.  Also establishes their size.
     
     # Creates the "create and close" button.
     self.actionBtn = mc.button(label = self.actionName, height = self.commonBtnSize[1], command = self.actionBtnCmd)
     # Creates the "create" button.
     self.createBtn = mc.button(label = "Create", height = self.commonBtnSize[1], command = self.createBtnCmd)
     # Creates the "close" button.
     self.closeBtn = mc.button(label = "Close", height = self.commonBtnSize[1], command = self.closeBtnCmd)
     # Dictates how the buttons scale when the user scales the UI.  
         # First sets the main form to edit mode.
     mc.formLayout(self.mainForm, e=True, attachForm=(
         # Then takes each button, specifies the edge to adjust, and then specifies the value to adjust by.
         # Pins the action button to the left of the UI with a padding of 5 pixels.
         [self.actionBtn, 'left', 5],
         # Pins the action button to the bottom of the UI with a padding of 5 pixels.
         [self.actionBtn, 'bottom', 5],
         # Pins the create button to the bottom of the UI with a padding of 5 pixels.
         [self.createBtn, 'bottom', 5],
         # Pins the close botton to the bottom of the UI with a padding of 5 pixels.
         [self.closeBtn, 'bottom', 5],
         # Pins the close button to the right of the UI with a padding of 5 pixels. 
         [self.closeBtn, 'right', 5]),
         # Pins buttons relative to the coordinates specified in the create(self) function according to the
         # numberOfDivisions flag in the mainForm command.
         attachPosition = ([self.actionBtn, 'right', 1, 33], [self.closeBtn, 'left', 0, 67]),
         # Pins the middle button to the outer two buttons.  Allows it to scale along with the other two buttons.
         attachControl = ([self.createBtn, 'left', 4, self.actionBtn], [self.createBtn, 'right', 4, self.closeBtn]),
         # Makes sure that the the top edges of the buttons scale according to the above parameters.  
         attachNone = ([self.actionBtn, 'top'], [self.createBtn, 'top'], [self.closeBtn, 'top']))
Пример #30
0
 def build(self):
     if mc.windowPref(self.win, exists=1):
         mc.windowPref(self.win, remove=1)
     if mc.window(self.win,exists=1):
         mc.deleteUI(self.win)
     mc.window( self.win, title=self.title, widthHeight=(500, 210) )
     cl1 = mc.columnLayout( columnAttach=('both', 2), rowSpacing=3, columnWidth=500, adjustableColumn = True)
     mc.radioCollection()
     self.mouth = mc.radioButton( l='user import', select=1, p=cl1 )
     self.autoR = mc.radioButton( l='auto import', p=cl1 )
     mc.separator()
     mc.frameLayout('selected')
     mc.rowLayout(numberOfColumns=3, columnWidth3=(80, 75, 150), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
     mc.text(l='Mode')
     mc.columnLayout()
     mc.radioCollection()
     self.prop = mc.radioButton( l='Prop', select=1 )
     self.character = mc.radioButton( l='Character' )
     mc.setParent( '..' )
     mc.setParent( '..' )
     self.numText = mc.floatFieldGrp( l='Num' )
     self.txtProp = mc.textFieldButtonGrp( label='File Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
     #mc.separator()
     #self.txtCharacter = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
     #mc.separator()
     mc.separator(p=cl1)
     mc.button( 'importR', l='Import   Reference   File', p=cl1 )
     mc.setParent( '..' )
Пример #31
0
            zero = mc.setKeyframe(animC, insert=1, float=0.0, value=0.0)

            mc.connectAttr(ctrl[0] + str(controlAttr), animC + '.input')
            mc.connectAttr(animC + '.output', grp + str(rota))


## Window starts here
windowID = 'setAnimCurveUU'

if mc.window(windowID, exists=True):
    mc.deleteUI(windowID)

mc.window(windowID, title='Set AnimCurveUU for curl')
mc.rowColumnLayout(numberOfColumns=5)
mc.text(label='Control&Attribute')
mc.button(label='Pick Control', command=pickControl)
showControl = mc.textScrollList(numberOfRows=1)
attrMenu = mc.optionMenu('optionTest',
                         numberOfItems=3,
                         changeCommand=changeControlAttr)
mc.text(label='')

mc.text(label='Min Float:')
mc.floatField('minFloat')
mc.text(label='Min Value:')
mc.floatField('minValue')
mc.text(label='')

mc.text(label='Max Float:')
mc.floatField('maxFloat')
mc.text(label='Max Value:')
Пример #32
0
def build_gui_help_mirror_cluster_tool():
    window_name = "build_gui_help_mirror_cluster_tool"
    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name, window=True)

    cmds.window(window_name,
                title=script_name + " Help",
                mnb=False,
                mxb=False,
                s=True)
    cmds.window(window_name, e=True, s=True, wh=[1, 1])

    main_column = cmds.columnLayout(p=window_name)

    # Title Text
    cmds.separator(h=12, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)],
                         p=main_column)  # Window Size Adjustment
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)],
                         p=main_column)  # Title Column
    cmds.text(script_name + " Help",
              bgc=[0, .5, 0],
              fn="boldLabelFont",
              align="center")
    cmds.separator(h=10, style='none', p=main_column)  # Empty Space

    # Body ====================
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column)
    cmds.text(l='Script mirroring clusters on mesh objects.', align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Step 1:', align="left", fn="boldLabelFont")
    cmds.text(l='Load your mesh by selecting it in the viewport or in the',
              align="left")
    cmds.text(l='outliner, then click on \"Select Mesh\".', align="left")
    cmds.text(l='Requirements: Must be one single mesh transform.',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Step 2:', align="left", fn="boldLabelFont")
    cmds.text(l='Load your clusterHandle by selecting it in the viewport ',
              align="left")
    cmds.text(l='or in the outliner, then click on \"Select Cluster\".',
              align="left")
    cmds.text(l='Requirements: Must be one single clusterHandle.',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Step 3:', align="left", fn="boldLabelFont")
    cmds.text(l='Select your mirror axis ', align="left")
    cmds.text(l='X, Y or Z. It will always mirror on the negative direction',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='Step 4:', align="left", fn="boldLabelFont")
    cmds.text(l='To save time you can automatically rename the mirrored',
              align="left")
    cmds.text(l='clusters using the search and replace text fields.',
              align="left")
    cmds.text(l='For example search for "left_" and replace with "right_"',
              align="left")
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p=main_column)
    cmds.text('Guilherme Trevisan  ')
    cmds.text(
        l='<a href="mailto:[email protected]">[email protected]</a>',
        hl=True,
        highlightColor=[1, 1, 1])
    cmds.rowColumnLayout(nc=2,
                         cw=[(1, 140), (2, 140)],
                         cs=[(1, 10), (2, 0)],
                         p=main_column)
    cmds.separator(h=15, style='none')  # Empty Space
    cmds.text(l='<a href="https://github.com/TrevisanGMW">Github</a>',
              hl=True,
              highlightColor=[1, 1, 1])
    cmds.separator(h=7, style='none')  # Empty Space

    # Close Button
    cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column)
    cmds.separator(h=10, style='none')
    cmds.button(l='OK', h=30, c=lambda args: close_help_gui())
    cmds.separator(h=8, style='none')

    # Show and Lock Window
    cmds.showWindow(window_name)
    cmds.window(window_name, e=True, s=False)

    # Set Window Icon
    qw = omui.MQtUtil.findWindow(window_name)
    widget = wrapInstance(long(qw), QWidget)
    icon = QIcon(':/question.png')
    widget.setWindowIcon(icon)

    def close_help_gui():
        if cmds.window(window_name, exists=True):
            cmds.deleteUI(window_name, window=True)
Пример #33
0
    def __init__(self, CTL_TREE, allStartingWeights, allNeutralWeights,
                 allCurrentGenWeights, strongestShapes, minMaxWeights,
                 allSymmetryNames, OTHER_FACE_IDS):

        self.ctlTree = CTL_TREE
        self.allStartingWeights = allStartingWeights
        self.allCurrentGenWeights = allCurrentGenWeights
        self.allCurrentWeights = allCurrentGenWeights
        self.allNeutralWeights = allNeutralWeights
        self.allMinMaxWeights = minMaxWeights
        self.strongestShapes = strongestShapes
        self.strongestShapesTree = {}
        self.generationSelection = []
        self.nextGeneration = []
        self.allSymmetryNames = allSymmetryNames
        self.buttonList = []
        self.newShapes = {}
        self.startingCurves = {}
        self.currentGenCurves = {}
        self.OTHER_FACE_IDS = OTHER_FACE_IDS
        self.originalStrongest = strongestShapes
        self.symGroups = {}
        self.lastElite = self.saveFaceCurves()
        self.NextGenePool = []
        self.CurrentGenePool = []
        self.EliteGenes = []

        print "strongestShapes"
        print strongestShapes

        newShapes = self.flattenDictToVals(self.strongestShapes)
        targetShapes = self.flattenDictToChildren(self.strongestShapes)
        strongestShapesTree = self.cropTreeToStrongestShapes()
        # strongestShapesNeutrals = self.getStrongestNeutralVals(self.strongestShapes)

        # self.strongestShapesNeutrals = strongestShapesNeutrals

        print "newShapes:"
        print newShapes
        print "targetShapes"
        print targetShapes
        print "strongestShapesTree"
        print strongestShapesTree
        # print "strongestShapesNeutrals"
        # print strongestShapesNeutrals

        self.strongestShapesTree = strongestShapesTree

        flattenedSyms = self.flattenDictToChildren(self.allSymmetryNames)

        newShapesSym = self.correctSymmetryNames(newShapes, flattenedSyms)

        self.linearBlendshape(self.strongestShapesTree)
        self.EliteGenes = self.saveFaceCurves()
        self.sampleNonLinear(2, [1, 2, 3])

        selectionUI = 'altUI'

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

        cmds.window(selectionUI, width=1000, height=200)
        form = cmds.formLayout()
        tabs = cmds.tabLayout(innerMarginWidth=10,
                              innerMarginHeight=10,
                              mcw=400,
                              width=750,
                              height=100)
        cmds.formLayout(form,
                        edit=True,
                        attachForm=((tabs, 'top', 0), (tabs, 'left', 0),
                                    (tabs, 'bottom', 0), (tabs, 'right', 0)))

        child2 = cmds.gridLayout(numberOfColumns=4, cellWidthHeight=(300, 32))
        cmds.text("ELITE:", font="boldLabelFont", al="center")
        cmds.text("SAMPLE 1:", font="boldLabelFont", al="center")
        cmds.text("SAMPLE 2:", font="boldLabelFont", al="center")
        cmds.text("SAMPLE 3:", font="boldLabelFont", al="center")

        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="Set Elite:  ")
        controlGroup1 = cmds.optionMenu("controlGroup1")
        for key in range(1, 4):
            cmds.menuItem(label="SAMPLE " + str(key))
        cmds.button(label='    Set    ',
                    command=partial(self.setFaceAsElite, 1))
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'right', 0)])
        cmds.text("                                ")
        cmds.checkBox("face1cB", editable=True, label="  Select")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'right', 0)])
        cmds.text("                                ")
        cmds.checkBox("face2cB", editable=True, label="  Select")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'right', 0)])
        cmds.text("                                ")
        cmds.checkBox("face3cB", editable=True, label="  Select")
        cmds.setParent('..')

        cmds.text(label='')
        cmds.separator()
        cmds.separator()
        cmds.separator()

        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Reset to Last Elite',
                    command=partial(self.resetToLastElite))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Sample Current Gen',
                    command=partial(self.sampleCurrentGen))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Add Selected to Gene Pool',
                    command=partial(self.addToGenePool))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Breed Next Gen', command=partial(self.breedNextGen))
        cmds.text(label="                 ")
        cmds.setParent('..')

        cmds.setParent('..')

        child1 = cmds.gridLayout(numberOfColumns=4, cellWidthHeight=(300, 32))
        cmds.text(label="")
        cmds.text("Choose Group to Act on:", font="boldLabelFont", al="center")
        controlGroupSourceGroup = cmds.optionMenu("controlGroupSourceGroup")
        cmds.menuItem(label='All')
        for key1 in strongestShapesTree.keys():
            cmds.menuItem(label=key1)
        cmds.text(label="")

        cmds.text("ELITE:", font="boldLabelFont", al="center")
        cmds.text("Choose Curve to Act on:", font="boldLabelFont", al="center")
        controlGroupSource = cmds.optionMenu("controlGroupSource")
        cmds.menuItem(label='All')
        for key1 in newShapesSym:
            cmds.menuItem(label=key1)
        cmds.text("OPTIONS:", font="boldLabelFont", al="center")

        cmds.text(label='')
        cmds.separator()
        cmds.separator()
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'right', 0)])
        cmds.text("                                ")
        cmds.checkBox(editable=True, label="  Symmetry", value=True)
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="Set Elite:  ")
        controlGroup2 = cmds.optionMenu("controlGroup2")
        for key in range(1, 4):
            cmds.menuItem(label="SAMPLE " + str(key))
        cmds.button(label='    Set    ',
                    command=partial(self.setFaceAsElite, 2))
        cmds.setParent('..')
        cmds.text("New Curves:", font="boldLabelFont", al="center")
        cmds.text("Modify Curves:", font="boldLabelFont", al="center")
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'right', 0)])
        cmds.text("                                ")
        cmds.checkBox("localiseFlag",
                      editable=True,
                      label="  Localise sampling")
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Reset Samples to Elite',
                    command=partial(self.copyEliteToSamples,
                                    self.strongestShapesTree))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 Number of New Keys:")
        cmds.intField("numKeys",
                      minValue=1,
                      maxValue=4,
                      value=2,
                      editable=True)
        cmds.text(label="                ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Sample Curve Amplitude',
                    command=partial(self.sampleAmpPhase, "Amp", [1, 2, 3]))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)],
                       w=100)

        cmds.text(label='                S.D: ')
        cmds.floatSliderGrp("sdVal",
                            field=True,
                            minValue=0.0,
                            maxValue=1.0,
                            fieldMinValue=0.0,
                            fieldMaxValue=1.0,
                            value=0.3,
                            cw=[(1, 50), (2, 120)])
        cmds.text(label='                   ')
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Reset to Last Elite',
                    command=partial(self.resetToLastElite))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Sample',
                    command=partial(self.sampleNonLinear, -1, [1, 2, 3]))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'left', 0), (2, 'both', 0),
                                     (3, 'right', 0)])
        cmds.text(label="                 ")
        cmds.button(label='Sample Curve Phase',
                    command=partial(self.sampleAmpPhase, "Phase", [1, 2, 3]))
        cmds.text(label="                 ")
        cmds.setParent('..')
        cmds.text(label="                 ")

        cmds.setParent('..')

        cmds.tabLayout(
            tabs,
            edit=True,
            tabLabel=((child2,
                       '\t\t\t\t\t\t\t\t\tEvolution\t\t\t\t\t\t\t\t\t'),
                      (child1,
                       '\t\t\t\t\t\t\tAdvanced Control\t\t\t\t\t\t\t')))

        cmds.showWindow()
Пример #34
0
    print(end-start)

    #A NE PAS UTILISER -> FAIT PLANTER LE SCRIPT PROBABLEMENT DU A UNE TROP GROSSE VARIATION DE TEMPS DE CALCUL A CHAQUE NOUVELLE ITERATION DE LA BOUCLE WHILE, CE QUI ENTRAINE DES TEMPS DE VEILLE NEGATIFS"
    #if(fps<30.1):
    #    time.sleep(1/fps-(end-start))


#------------------------------------------------------------------------------------
# INTERFACE
#------------------------------------------------------------------------------------

# Pour une raison non identifiée, la commande "if cmds.window("Mesh Modifier", exists=True): cmds.deleteUI("Mesh Modifer")" ne 
# fonctionne pas ici du fait que le système ne semble reconnaître que des fenêtres du nom de window1, window2, window3, 
# etc. à chaque nouvelle exécution du script. La boucle for ci-dessous a donc été ajoutée comme solution temporaire permettant 
# la suppression d'au plus 10 fenêtres de ce plug-in dans l'hypothèse où celles-ci n'auraient été successivement ouvertes que 
# via l'exécution partielle de ce script (c'est-à-dire sans que ne soit exécutée au préalable la commande ci-dessous automatisant
# la suppression de fenêtres pré-existantes).
for i in range(10):
    if cmds.window("window"+str(i+1),exists=True):
        cmds.deleteUI("window"+str(i+1))
    
cmds.window()
cmds.columnLayout(adjustableColumn=True)
    
cmds.separator(h=12)
    
cmds.button(label="Create Ground",c="createGround()")

cmds.separator(h=12)

cmds.showWindow()
Пример #35
0
    def arnoldProductionUI(self):
        if mc.window("arnoldProductionUI",ex=True):
            mc.deleteUI("arnoldProductionUI")
        mc.window("arnoldProductionUI",tlc=[180,200],wh=[430,400],menuBar=True,title=u"arnold模型属性修改",sizeable=False)
        mc.scrollLayout("A",hst=0,vst=8)
        mc.columnLayout(adjustableColumn=True)

        mc.rowLayout(nc=2,cw=[(1, 344),(2, 200)])
        mc.checkBox("aiSelfShadows",v=True,label="Self Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSelfShadows"))
        mc.setParent("..")
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiOpaque",v=True,label="Opaque",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiOpaque"))
        mc.setParent("..")
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiVisibleInDiffuse",v=True,label="Visible In Diffuse",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInDiffuse"))
        mc.setParent("..")
       

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiVisibleInGlossy",v=True,label="Visible In Glossy",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInGlossy"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportTangents",v=True,label="Export Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportColors",v=True,label="Export Vertex Colors",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportColors"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefPoints",v=True,label="Export Reference Points",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefPoints"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefNormals",v=True,label="Export Reference Normals",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefNormals"))
        mc.setParent("..")
 
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiMatte",v=True,label="Matte",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiMatte"))
        mc.setParent("..")

        mc.separator()

        mc.text("Subdivision")
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("Type",l="Type",h=20)
        mc.menuItem(l="none")
        mc.menuItem(l="catclart")
        mc.menuItem(l="linear")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("Type"))
        mc.setParent("..")
        mc.floatSliderButtonGrp("aiSubdivIterations",en=True,pre=0,label="Iterations",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivIterations"))
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("AdaptiveMetric",l="Adaptive Metric",h=20)
        mc.menuItem(l = "auto")
        mc.menuItem(l = "edge_length")
        mc.menuItem(l = "flatness")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("AdaptiveMetric"))
        mc.setParent("..")
        mc.floatSliderButtonGrp("aiSubdivPixelError",en=True,pre=3,label="Pixel Error",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivPixelError"))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("aiExportRefTangents",l="UV Smoothing",h=20)
        mc.menuItem(l="pin_corners")
        mc.menuItem(l="pin_borders")
        mc.menuItem(l="linears")
        mc.menuItem(l="smooth")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiSubdivSmoothDerivs",v=True,label="SmoothTangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSubdivSmoothDerivs"))
        mc.setParent("..")

        mc.separator()

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("ArnoldTranslatoer",l="Arnold Translatoer",h=20)
        mc.menuItem(l = "mesh_light")
        mc.menuItem(l = "polymesh")
        mc.menuItem(l = "procedural")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("ArnoldTranslatoer"))
        mc.setParent("..")

        mc.colorSliderButtonGrp('color', l = 'Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('color'))
     
        mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)])
        mc.text(l = "intensity")
        mc.floatField("intensity", precision = 3)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("intensity"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiExposure", en=True, pre=0, min = -5, max = 5, label="aiExposure",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiExposure"))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiUseColorTemperature",v=True,label="Use Color Temperature",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiUseColorTemperature"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiColorTemperature", en=True, pre=0, min = 1000, max = 15000, label="Temperature",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiColorTemperature"))
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("emitDiffuse",v=True,label="Emit Diffuse",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitDiffuse"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("emitSpecular",v=True,label="Emit Specular",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitSpecular"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("DecayType",l="Decay Type",h=20)
        mc.menuItem(l = "constant")
        mc.menuItem(l = "quadratic")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("DecayType"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("lightVisible",v=True,label="Light Visible",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("lightVisible"))
        mc.setParent("..")

        mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)])
        mc.text(l = "Samples")
        mc.floatField("aiSamples", precision = 0)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiSamples"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiNormalize",v=True,label="Normalize",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiNormalize"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiCastShadows",v=True,label="Cast Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastShadows"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiShadowDensity", en=True, pre=3, min = 0, max = 1, label="Shadow Density",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiShadowDensity"))

        mc.colorSliderButtonGrp('aiShadowColor', l = 'Shadow Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('aiShadowColor'))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiAffectVolumetrics",v=True,label="Affect Volumetrics",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiAffectVolumetrics"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiCastVolumetricShadows",v=True,label="Cast Volumetric Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastVolumetricShadows"))
        mc.setParent("..")

        mc.rowLayout(nc = 3,cw=[(1,86),(2,256),(3,200)])
        mc.text(l = "Volume Samples")
        mc.floatField("aiVolumeSamples", precision = 0)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiVolumeSamples"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiDiffuse", en=True, pre=3, min = 0, max = 1, label="Diffuse",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiDiffuse"))
        mc.floatSliderButtonGrp('aiSpecular', en = True, pre = 3, min = 0, max = 1, label = 'Specular', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSpecular"))
        mc.floatSliderButtonGrp('aiSss', en = True, pre = 3, min = 0, max = 1, label = 'SSS', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSss"))
        mc.floatSliderButtonGrp('aiIndirect', en = True, pre = 3, min = 0, max = 1, label = 'Indiret', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiIndirect"))
        mc.floatSliderButtonGrp('aiVolume', en = True, pre = 3, min = 0, max = 1, label = 'Volume', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiVolume"))
        
        mc.rowLayout(nc = 3,cw=[(1,66),(2,276),(3,200)])
        mc.text(l = "Max Bounces")
        mc.floatField("aiMaxBounces", precision = 0, value = 999)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiMaxBounces"))
        mc.setParent("..")

        mc.showWindow("arnoldProductionUI")
Пример #36
0
    def ui(cls):
        cmds.window(cls.uiWidgets['winName'], title='Set Skin Weights UI')

        cls.uiWidgets['mainMenuBarLo'] = cmds.menuBarLayout(
            p=cls.uiWidgets['winName'])
        cls.uiWidgets['optMenu'] = cmds.menu(p=cls.uiWidgets['mainMenuBarLo'],
                                             label='Options')
        cls.uiWidgets['hideZroInfMenuItem'] = cmds.menuItem(
            p=cls.uiWidgets['optMenu'],
            checkBox=True,
            label='Hide Zero Influences',
            c=cls.loadInf)
        cls.uiWidgets['sortHierMenuItem'] = cmds.menuItem(
            p=cls.uiWidgets['optMenu'],
            checkBox=False,
            label='Sort by Hierarchy',
            c=cls.loadInf)

        cls.uiWidgets['mainColLo'] = cmds.columnLayout(
            p=cls.uiWidgets['winName'], adj=True)

        cls.uiWidgets['mainTabLo'] = cmds.tabLayout(
            p=cls.uiWidgets['mainColLo'], tv=False)
        cls.uiWidgets['infWghtRowColLo'] = cmds.rowColumnLayout(
            p=cls.uiWidgets['mainTabLo'],
            numberOfColumns=2,
            columnWidth=[(1, 140), (2, 140)],
            columnSpacing=[(2, 5)])
        cls.uiWidgets['infFrmLo'] = cmds.frameLayout(
            p=cls.uiWidgets['infWghtRowColLo'], label='Influences')
        cls.uiWidgets['infTxtScrLs'] = cmds.textScrollList(
            p=cls.uiWidgets['infFrmLo'],
            h=200,
            sc=cls.infTxtScrLsSelCmd,
            allowMultiSelection=True,
            append='Select a skined vertex(s)')
        cls.uiWidgets['infPopMenu'] = cmds.popupMenu(
            p=cls.uiWidgets['infTxtScrLs'])
        cls.uiWidgets['loadInfMenu'] = cmds.menuItem(
            p=cls.uiWidgets['infPopMenu'],
            label='Load Influences',
            c=cls.loadInf)

        cls.uiWidgets['wghtFrmLo'] = cmds.frameLayout(
            p=cls.uiWidgets['infWghtRowColLo'], label='Weight Value')
        cls.uiWidgets['wghtTxtScrLs'] = cmds.textScrollList(
            p=cls.uiWidgets['wghtFrmLo'],
            h=200,
            enable=False,
            allowMultiSelection=True)

        cls.uiWidgets['wghtPrsRowColLo'] = cmds.rowColumnLayout(
            p=cls.uiWidgets['mainColLo'],
            numberOfColumns=5,
            columnWidth=[(1, 50), (2, 50), (3, 50), (4, 50), (5, 50)],
            columnSpacing=[(1, 7), (2, 7), (3, 7), (4, 7), (5, 7)])
        cmds.button(p=cls.uiWidgets['wghtPrsRowColLo'],
                    label='0',
                    c=partial(cls.setWeight, 0.0))
        cmds.button(p=cls.uiWidgets['wghtPrsRowColLo'],
                    label='0.25',
                    c=partial(cls.setWeight, 0.25))
        cmds.button(p=cls.uiWidgets['wghtPrsRowColLo'],
                    label='0.5',
                    c=partial(cls.setWeight, 0.5))
        cmds.button(p=cls.uiWidgets['wghtPrsRowColLo'],
                    label='0.75',
                    c=partial(cls.setWeight, 0.75))
        cmds.button(p=cls.uiWidgets['wghtPrsRowColLo'],
                    label='1',
                    c=partial(cls.setWeight, 1.0))

        cls.uiWidgets['wghtSubAddRowColLo'] = cmds.rowColumnLayout(
            p=cls.uiWidgets['mainColLo'],
            numberOfColumns=4,
            columnWidth=[(1, 107), (2, 50), (3, 50), (4, 50)],
            columnSpacing=[(1, 7), (2, 7), (3, 7), (4, 7)])
        cmds.button(p=cls.uiWidgets['wghtSubAddRowColLo'],
                    label='Set Custom Weight',
                    c=partial(cls.subAddWeight, 'default'))
        cls.uiWidgets['rltvWghtValfloatFld'] = cmds.floatField(
            p=cls.uiWidgets['wghtSubAddRowColLo'],
            v=0.050,
            min=0.001,
            max=1.000,
            step=0.010,
            precision=3)
        cmds.button(p=cls.uiWidgets['wghtSubAddRowColLo'],
                    label='-',
                    c=partial(cls.subAddWeight, 'sub'))
        cmds.button(p=cls.uiWidgets['wghtSubAddRowColLo'],
                    label='+',
                    c=partial(cls.subAddWeight, 'add'))

        cls.uiWidgets['copyPasteRowColLo'] = cmds.rowColumnLayout(
            p=cls.uiWidgets['mainColLo'],
            numberOfColumns=3,
            columnWidth=[(1, 88), (2, 88), (3, 88)],
            columnSpacing=[(1, 7), (2, 7), (3, 7)])
        cmds.button(p=cls.uiWidgets['copyPasteRowColLo'],
                    label='Copy Weights',
                    c="mel.eval('artAttrSkinWeightCopy;')")
        cmds.button(p=cls.uiWidgets['copyPasteRowColLo'],
                    label='Paste Weights',
                    c="mel.eval('artAttrSkinWeightPaste;')")
        cmds.button(
            p=cls.uiWidgets['copyPasteRowColLo'],
            label='Solid Weights',
            c=cls.solidSkinWeight,
            ann=
            'Copy first vertex skin weights in selection list and paste to the others.'
        )

        cls.uiWidgets['wghtTrsfRowColLo'] = cmds.rowColumnLayout(
            p=cls.uiWidgets['mainColLo'],
            numberOfColumns=4,
            columnWidth=[(1, 93), (2, 20), (3, 93), (4, 50)],
            columnSpacing=[(1, 7), (2, 7), (3, 7), (4, 7)])
        cls.uiWidgets['srcInfTxtFld'] = cmds.textField(
            p=cls.uiWidgets['wghtTrsfRowColLo'])
        cmds.popupMenu()
        cmds.menuItem(label='Load Selected Influence',
                      c=partial(cls.loadSelInf, cls.uiWidgets['srcInfTxtFld']))
        cmds.text(p=cls.uiWidgets['wghtTrsfRowColLo'], label='>>>')
        cls.uiWidgets['trgInfTxtFld'] = cmds.textField(
            p=cls.uiWidgets['wghtTrsfRowColLo'])
        cmds.popupMenu()
        cmds.menuItem(label='Load Selected Influence',
                      c=partial(cls.loadSelInf, cls.uiWidgets['trgInfTxtFld']))
        cmds.button(p=cls.uiWidgets['wghtTrsfRowColLo'],
                    label='Transfer',
                    c=cls.transferWght)

        cmds.window(cls.uiWidgets['winName'], e=True, w=200, h=200)
        cmds.showWindow(cls.uiWidgets['winName'])
Пример #37
0
#2017-12-05
#============================================
import maya.cmds as cmds

if cmds.window(custom_outliner_window, ex=True):
    cmds.deleteUI(custom_outliner_window)
custom_outliner_window = cmds.window(title='Custom Outliner',
                                     minimizeButton=False,
                                     maximizeButton=False)

custom_outliner_column = cmds.columnLayout(parent=custom_outliner_window,
                                           adjustableColumn=True)
custom_outliner_row_buttons = cmds.rowLayout(parent=custom_outliner_column,
                                             numberOfColumns=6)
custom_outliner_add_button = cmds.button(parent=custom_outliner_row_buttons,
                                         label='Add',
                                         command='outliner_add()')
custom_outliner_remove_button = cmds.button(parent=custom_outliner_row_buttons,
                                            label='Remove',
                                            command='outliner_remove()')
custom_outliner_clear_button = cmds.button(parent=custom_outliner_row_buttons,
                                           label='Clear',
                                           command='outliner_clear()')
custom_outliner_sort_button = cmds.button(parent=custom_outliner_row_buttons,
                                          label='Sort',
                                          command='outliner_sort()')
custom_outliner_up_button = cmds.button(parent=custom_outliner_row_buttons,
                                        label='Up',
                                        command='outliner_up()')
custom_outliner_down_button = cmds.button(parent=custom_outliner_row_buttons,
                                          label='Down',
Пример #38
0
      
   
    

      
#ImagesPaths
imagePath  = cmds.internalVar(usd = True) 
Path = imagePath + 'RdMTools/'
Icons = Path + 'icons/'


    
#Window
cmds.window( "AutoArms", width=250, title="AutoArms" , toolbox = True  )
cmds.columnLayout( adjustableColumn=True )
cmds.separator(h = 10)
cmds.symbolButton(image=Icons + 'Locator.png', c = LocatorsBtn)
cmds.separator(h = 10)
cmds.symbolButton(image=Icons + 'Joint.png', c = JointsBtn)
cmds.separator(h = 10)
RadioControlador = cmds.floatSliderGrp (l = 'Size:', min = 1 , max = 20, field = True, v = 1, hlc = (1,0,0))
cmds.separator(h = 10)
cmds.button( label='Create IK FK Arms', command=IKFK, bgc = (0.8,0,0), h = 40)
cmds.separator(h = 10)
cmds.text( label='By: Render de Martes', fn ='fixedWidthFont')
cmds.text( label='*****@*****.**', fn ='fixedWidthFont')
cmds.showWindow("AutoArms")



Пример #39
0
def create():
    """
    """
    # Window
    win = 'nDynamicsUI'
    if cmds.window(win, ex=True): cmds.deleteUI(win)
    win = cmds.window(win, t='nDynamics', s=True, mb=True, wh=[650, 390])

    # ---------------
    # - Main Window -
    # ---------------

    # Menu
    cmds.menu(label='Edit', tearOff=1)
    cmds.menuItem(label='Reset', c='glTools.ui.nDynamics.create()')

    # FormLayout
    FL = cmds.formLayout(numberOfDivisions=100)

    # UI Elements
    nucleusTXT = cmds.text(l='Nucleus List:', al='left')
    nucleusTSL = cmds.textScrollList('nDyn_nucleusTSL', allowMultiSelection=False)

    nucleus_createB = cmds.button(label='Create', c='glTools.ui.nDynamics.createNucleusFromUI()')
    nucleus_deleteB = cmds.button(label='Delete', c='glTools.ui.nDynamics.deleteNucleusFromUI()')
    nucleus_enableB = cmds.button(label='Enable', c='glTools.ui.nDynamics.toggleNucleusFromUI(1)')
    nucleus_disableB = cmds.button(label='Disable', c='glTools.ui.nDynamics.toggleNucleusFromUI(0)')

    nDyn_refreshB = cmds.button(label='Refresh', c='glTools.ui.nDynamics.create()')
    nDyn_closeB = cmds.button(label='Close', c='cmds.deleteUI("' + win + '")')

    # TabLayout
    nDynTabLayout = cmds.tabLayout('nDynTabLayout', innerMarginWidth=5, innerMarginHeight=5)

    # Layout
    cmds.formLayout(FL, e=True, af=[(nucleusTXT, 'left', 5), (nucleusTXT, 'top', 5)], ap=[(nucleusTXT, 'right', 5, 35)])
    cmds.formLayout(FL, e=True, af=[(nucleusTSL, 'left', 5)], ap=[(nucleusTSL, 'right', 5, 35)],
                  ac=[(nucleusTSL, 'top', 5, nucleusTXT), (nucleusTSL, 'bottom', 5, nucleus_createB)])

    cmds.formLayout(FL, e=True, af=[(nucleus_createB, 'left', 5)], ap=[(nucleus_createB, 'right', 5, 18)],
                  ac=[(nucleus_createB, 'bottom', 5, nucleus_enableB)])
    cmds.formLayout(FL, e=True,
                  ac=[(nucleus_deleteB, 'left', 5, nucleus_createB), (nucleus_deleteB, 'right', 5, nDynTabLayout),
                      (nucleus_deleteB, 'bottom', 5, nucleus_disableB)])

    cmds.formLayout(FL, e=True, af=[(nucleus_enableB, 'left', 5)], ap=[(nucleus_enableB, 'right', 5, 18)],
                  ac=[(nucleus_enableB, 'bottom', 5, nDyn_refreshB)])
    cmds.formLayout(FL, e=True,
                  ac=[(nucleus_disableB, 'left', 5, nucleus_enableB), (nucleus_disableB, 'right', 5, nDynTabLayout),
                      (nucleus_disableB, 'bottom', 5, nDyn_refreshB)])

    cmds.formLayout(FL, e=True, af=[(nDyn_refreshB, 'left', 5), (nDyn_refreshB, 'bottom', 5)],
                  ap=[(nDyn_refreshB, 'right', 5, 50)])
    cmds.formLayout(FL, e=True, af=[(nDyn_closeB, 'right', 5), (nDyn_closeB, 'bottom', 5)],
                  ap=[(nDyn_closeB, 'left', 5, 50)])

    cmds.formLayout(FL, e=True, af=[(nDynTabLayout, 'top', 5), (nDynTabLayout, 'right', 5)],
                  ac=[(nDynTabLayout, 'left', 5, nucleusTSL), (nDynTabLayout, 'bottom', 5, nDyn_closeB)])

    # UI Callbacks

    cmds.textScrollList(nucleusTSL, e=True, sc='glTools.ui.nDynamics.setCurrentNucleus()')
    cmds.textScrollList(nucleusTSL, e=True, dcc='glTools.ui.utils.selectFromTSL("' + nucleusTSL + '")')
    cmds.textScrollList(nucleusTSL, e=True, dkc='glTools.ui.nDynamics.deleteNucleusFromUI()')

    # Popup menu
    nClothPUM = cmds.popupMenu(parent=nucleusTSL)
    cmds.menuItem(l='Select Hilited Nodes', c='glTools.ui.utils.selectFromTSL("' + nucleusTSL + '")')
    cmds.menuItem(l='Select Connected nCloth', c='glTools.ui.nDynamics.selectConnectedMeshFromUI("' + nucleusTSL + '")')
    cmds.menuItem(l='Select Connected nRigid', c='glTools.ui.nDynamics.selectConnectedSolverFromUI("' + nucleusTSL + '")')
    # Attr Presets
    nucleusPresetList = glTools.utils.attrPreset.listNodePreset('nucleus')
    if nucleusPresetList:
        cmds.menuItem(allowOptionBoxes=False, label='Apply Preset', subMenu=True, tearOff=False)
        for nucleusPreset in nucleusPresetList:
            cmds.menuItem(l=nucleusPreset,
                        c='glTools.ui.nDynamics.applyPreset("' + nucleusTSL + '","' + nucleusPreset + '")')

    # -----------------
    # - nCloth Layout -
    # -----------------

    cmds.setParent(nDynTabLayout)

    # FormLayout
    nClothFL = cmds.formLayout(numberOfDivisions=100)

    # UI Elements
    nClothVisRB = cmds.radioButtonGrp('nClothVisRB', cw=[(1, 60), (2, 60), (3, 80)], label='Display:',
                                    labelArray2=['All', 'Current'], numberOfRadioButtons=2, sl=1,
                                    cc='glTools.ui.nDynamics.toggleNClothVis()')

    nClothTSL = cmds.textScrollList('nDyn_nClothTSL', allowMultiSelection=True)
    nCloth_createB = cmds.button(label='Create from Mesh', c='glTools.ui.nDynamics.createNClothFromUI()')
    nCloth_deleteB = cmds.button(label='Delete Selected', c='glTools.ui.nDynamics.deleteNClothFromUI()')
    nCloth_addToNucleusB = cmds.button(label='Assign to Nucleus', c='glTools.ui.nDynamics.addNClothToNucleusFromUI()')
    nCloth_enableB = cmds.button(label='Enable', c='glTools.ui.nDynamics.toggleNClothStateFromUI(1)')
    nCloth_disableB = cmds.button(label='Disable', c='glTools.ui.nDynamics.toggleNClothStateFromUI(0)')
    nCloth_saveCacheB = cmds.button(label='Save Cache', c='glTools.ui.nDynamics.saveNClothCacheFromUI()')
    nCloth_loadCacheB = cmds.button(label='Load Cache', c='glTools.ui.nDynamics.loadNClothCacheFromUI()')

    # Layout
    cmds.formLayout(nClothFL, e=True, af=[(nClothVisRB, 'top', 5), (nClothVisRB, 'left', 5), (nClothVisRB, 'right', 5)])
    cmds.formLayout(nClothFL, e=True, af=[(nClothTSL, 'left', 5), (nClothTSL, 'bottom', 5)],
                  ap=[(nClothTSL, 'right', 5, 55)], ac=[(nClothTSL, 'top', 5, nClothVisRB)])

    cmds.formLayout(nClothFL, e=True, af=[(nCloth_createB, 'right', 5)],
                  ac=[(nCloth_createB, 'left', 5, nClothTSL), (nCloth_createB, 'top', 5, nClothVisRB)])
    cmds.formLayout(nClothFL, e=True, af=[(nCloth_deleteB, 'right', 5)],
                  ac=[(nCloth_deleteB, 'left', 5, nClothTSL), (nCloth_deleteB, 'top', 5, nCloth_createB)])
    cmds.formLayout(nClothFL, e=True, af=[(nCloth_addToNucleusB, 'right', 5)],
                  ac=[(nCloth_addToNucleusB, 'left', 5, nClothTSL), (nCloth_addToNucleusB, 'top', 5, nCloth_deleteB)])

    cmds.formLayout(nClothFL, e=True, af=[(nCloth_enableB, 'right', 5)],
                  ac=[(nCloth_enableB, 'left', 5, nClothTSL), (nCloth_enableB, 'top', 5, nCloth_addToNucleusB)])
    cmds.formLayout(nClothFL, e=True, af=[(nCloth_disableB, 'right', 5)],
                  ac=[(nCloth_disableB, 'left', 5, nClothTSL), (nCloth_disableB, 'top', 5, nCloth_enableB)])

    cmds.formLayout(nClothFL, e=True, af=[(nCloth_saveCacheB, 'right', 5)],
                  ac=[(nCloth_saveCacheB, 'left', 5, nClothTSL), (nCloth_saveCacheB, 'top', 5, nCloth_disableB)])
    cmds.formLayout(nClothFL, e=True, af=[(nCloth_loadCacheB, 'right', 5)],
                  ac=[(nCloth_loadCacheB, 'left', 5, nClothTSL), (nCloth_loadCacheB, 'top', 5, nCloth_saveCacheB)])

    # UI Callbacks
    cmds.textScrollList(nClothTSL, e=True, dcc='glTools.ui.utils.selectFromTSL("' + nClothTSL + '")')
    cmds.textScrollList(nClothTSL, e=True, dkc='glTools.ui.nDynamics.deleteNClothFromUI()')
    cmds.radioButtonGrp(nClothVisRB, e=True,
                      cc='glTools.ui.nDynamics.refreshNodeList("' + nClothTSL + '","nCloth","' + nClothVisRB + '")')

    cmds.setParent('..')

    # Popup menu
    nClothPUM = cmds.popupMenu(parent=nClothTSL)
    cmds.menuItem(l='Select Hilited Nodes', c='glTools.ui.utils.selectFromTSL("' + nClothTSL + '")')
    cmds.menuItem(l='Select Connected Mesh', c='glTools.ui.nDynamics.selectConnectedMesh("' + nClothTSL + '")')
    cmds.menuItem(l='Select Connected Solver', c='glTools.ui.nDynamics.selectConnectedSolver("' + nClothTSL + '")')
    # Attr Presets
    nClothPresetList = glTools.utils.attrPreset.listNodePreset('nCloth')
    if nClothPresetList:
        cmds.menuItem(allowOptionBoxes=False, label='Apply Preset', subMenu=True, tearOff=False)
        for nClothPreset in nClothPresetList:
            cmds.menuItem(l=nClothPreset,
                        c='glTools.ui.nDynamics.applyPreset("' + nClothTSL + '","' + nClothPreset + '")')

    # -----------------
    # - nRigid Layout -
    # -----------------

    cmds.setParent(nDynTabLayout)

    # FormLayout
    nRigidFL = cmds.formLayout(numberOfDivisions=100)

    # UI Elements
    nRigidVisRB = cmds.radioButtonGrp('nRigidVisRB', cw=[(1, 60), (2, 60), (3, 80)], label='Display:',
                                    labelArray2=['All', 'Current'], numberOfRadioButtons=2, sl=1,
                                    cc='glTools.ui.nDynamics.toggleNClothVis()')

    nRigidTSL = cmds.textScrollList('nDyn_nRigidTSL', allowMultiSelection=True)
    nRigid_createB = cmds.button(label='Create from Mesh', c='glTools.ui.nDynamics.createNRigidFromUI()')
    nRigid_deleteB = cmds.button(label='Delete Selected', c='glTools.ui.nDynamics.deleteNRigidFromUI()')
    nRigid_addToNucleusB = cmds.button(label='Add to Nucleus', c='glTools.ui.nDynamics.addNRigidToNucleusFromUI()')

    nRigid_enableB = cmds.button(label='Enable', c='glTools.ui.nDynamics.toggleNRigidStateFromUI(1)')
    nRigid_disableB = cmds.button(label='Disable', c='glTools.ui.nDynamics.toggleNRigidStateFromUI(0)')

    # Layout
    cmds.formLayout(nRigidFL, e=True, af=[(nRigidVisRB, 'top', 5), (nRigidVisRB, 'left', 5), (nRigidVisRB, 'right', 5)])
    cmds.formLayout(nRigidFL, e=True, af=[(nRigidTSL, 'left', 5), (nRigidTSL, 'bottom', 5)],
                  ap=[(nRigidTSL, 'right', 5, 55)], ac=[(nRigidTSL, 'top', 5, nRigidVisRB)])

    cmds.formLayout(nRigidFL, e=True, af=[(nRigid_createB, 'right', 5)],
                  ac=[(nRigid_createB, 'left', 5, nRigidTSL), (nRigid_createB, 'top', 5, nRigidVisRB)])
    cmds.formLayout(nRigidFL, e=True, af=[(nRigid_deleteB, 'right', 5)],
                  ac=[(nRigid_deleteB, 'left', 5, nRigidTSL), (nRigid_deleteB, 'top', 5, nRigid_createB)])
    cmds.formLayout(nRigidFL, e=True, af=[(nRigid_addToNucleusB, 'right', 5)],
                  ac=[(nRigid_addToNucleusB, 'left', 5, nRigidTSL), (nRigid_addToNucleusB, 'top', 5, nRigid_deleteB)])

    cmds.formLayout(nRigidFL, e=True, af=[(nRigid_enableB, 'right', 5)],
                  ac=[(nRigid_enableB, 'left', 5, nRigidTSL), (nRigid_enableB, 'top', 5, nRigid_addToNucleusB)])
    cmds.formLayout(nRigidFL, e=True, af=[(nRigid_disableB, 'right', 5)],
                  ac=[(nRigid_disableB, 'left', 5, nRigidTSL), (nRigid_disableB, 'top', 5, nRigid_enableB)])

    # UI Callbacks
    cmds.textScrollList(nRigidTSL, e=True, dcc='glTools.ui.utils.selectFromTSL("' + nRigidTSL + '")')
    cmds.textScrollList(nRigidTSL, e=True, dkc='glTools.ui.nDynamics.deleteNRigidFromUI()')
    cmds.radioButtonGrp(nRigidVisRB, e=True,
                      cc='glTools.ui.nDynamics.refreshNodeList("' + nRigidTSL + '","nRigid","' + nRigidVisRB + '")')

    cmds.setParent('..')

    # Popup menu
    nRigidPUM = cmds.popupMenu(parent=nRigidTSL)
    cmds.menuItem(l='Select Hilited Nodes', c='glTools.ui.utils.selectFromTSL("' + nRigidTSL + '")')
    cmds.menuItem(l='Select Connected Mesh', c='glTools.ui.nDynamics.selectConnectedMesh("' + nRigidTSL + '")')
    cmds.menuItem(l='Select Connected Solver', c='glTools.ui.nDynamics.selectConnectedSolver("' + nRigidTSL + '")')
    # Attr Presets
    nRigidPresetList = glTools.utils.attrPreset.listNodePreset('nRigid')
    if nRigidPresetList:
        cmds.menuItem(allowOptionBoxes=False, label='Apply Preset', subMenu=True, tearOff=False)
        for nRigidPreset in nRigidPresetList:
            cmds.menuItem(l=nRigidPreset,
                        c='glTools.ui.nDynamics.applyPreset("' + nRigidTSL + '","' + nRigidPreset + '")')

    # --------------------
    # - nParticle Layout -
    # --------------------

    cmds.setParent(nDynTabLayout)

    # FormLayout
    nParticleFL = cmds.formLayout(numberOfDivisions=100)

    # UI Elements
    nParticleVisRB = cmds.radioButtonGrp('nParticleVisRB', cw=[(1, 60), (2, 60), (3, 80)], label='Display:',
                                       labelArray2=['All', 'Current'], numberOfRadioButtons=2, sl=1,
                                       cc='glTools.ui.nDynamics.toggleNClothVis()')

    nParticleTSL = cmds.textScrollList('nDyn_nParticleTSL', allowMultiSelection=True)
    nParticle_createB = cmds.button(label='Fill Mesh', c='glTools.ui.nDynamics.createNParticleFromUI()')
    nParticle_deleteB = cmds.button(label='Delete Selected', c='glTools.ui.nDynamics.deleteNParticleFromUI()')
    nParticle_addToNucleusB = cmds.button(label='Add to Nucleus', c='glTools.ui.nDynamics.addNParticleToNucleusFromUI()')

    # Layout
    cmds.formLayout(nParticleFL, e=True,
                  af=[(nParticleVisRB, 'top', 5), (nParticleVisRB, 'left', 5), (nParticleVisRB, 'right', 5)])
    cmds.formLayout(nParticleFL, e=True, af=[(nParticleTSL, 'left', 5), (nParticleTSL, 'bottom', 5)],
                  ap=[(nParticleTSL, 'right', 5, 55)], ac=[(nParticleTSL, 'top', 5, nParticleVisRB)])

    cmds.formLayout(nParticleFL, e=True, af=[(nParticle_createB, 'right', 5)],
                  ac=[(nParticle_createB, 'left', 5, nParticleTSL), (nParticle_createB, 'top', 5, nParticleVisRB)])
    cmds.formLayout(nParticleFL, e=True, af=[(nParticle_deleteB, 'right', 5)],
                  ac=[(nParticle_deleteB, 'left', 5, nParticleTSL), (nParticle_deleteB, 'top', 5, nParticle_createB)])
    cmds.formLayout(nParticleFL, e=True, af=[(nParticle_addToNucleusB, 'right', 5)],
                  ac=[(nParticle_addToNucleusB, 'left', 5, nParticleTSL),
                      (nParticle_addToNucleusB, 'top', 5, nParticle_deleteB)])

    # UI Callbacks
    cmds.textScrollList(nParticleTSL, e=True, dcc='glTools.ui.utils.selectFromTSL("' + nParticleTSL + '")')
    cmds.textScrollList(nParticleTSL, e=True, dkc='glTools.ui.nDynamics.deleteNParticleFromUI()')
    cmds.radioButtonGrp(nParticleVisRB, e=True,
                      cc='glTools.ui.nDynamics.refreshNodeList("' + nParticleTSL + '","nParticle","' + nParticleVisRB + '")')

    cmds.setParent('..')

    # Popup menu
    nParticlePUM = cmds.popupMenu(parent=nParticleTSL)
    cmds.menuItem(l='Select Hilited Nodes', c='glTools.ui.utils.selectFromTSL("' + nParticleTSL + '")')
    cmds.menuItem(l='Select Connected Mesh', c='glTools.ui.nDynamics.selectConnectedMesh("' + nParticleTSL + '")')
    cmds.menuItem(l='Select Connected Solver', c='glTools.ui.nDynamics.selectConnectedSolver("' + nParticleTSL + '")')
    # Attr Presets
    nParticlePresetList = glTools.utils.attrPreset.listNodePreset('nParticleTSL')
    if nParticlePresetList:
        cmds.menuItem(allowOptionBoxes=False, label='Apply Preset', subMenu=True, tearOff=False)
        for nParticlePreset in nParticlePresetList:
            cmds.menuItem(l=nParticlePreset,
                        c='glTools.ui.nDynamics.applyPreset("' + nParticleTSL + '","' + nParticlePreset + '")')

    # -----------------
    # - nCache Layout -
    # -----------------

    cmds.setParent(nDynTabLayout)

    # FormLayout
    nCacheFL = cmds.formLayout(numberOfDivisions=100)

    cmds.setParent('..')

    # --------------
    # - End Layout -
    # --------------

    # Set TabLayout Labels
    cmds.tabLayout(nDynTabLayout, e=True, tabLabel=(
    (nClothFL, 'nCloth'), (nRigidFL, 'nRigid'), (nParticleFL, 'nParticle'), (nCacheFL, 'nCache')))

    # Display UI
    cmds.showWindow(win)
    refreshUI()
Пример #40
0
cmds.frameLayout(label='Primary axis')
cmds.rowLayout(numberOfColumns=3)
collection1 = cmds.radioCollection()
aX = cmds.radioButton('jointExtractX', label='X')
aY = cmds.radioButton('jointExtractY', label='Y')
aZ = cmds.radioButton('jointExtractZ', label='Z')
cmds.setParent('..')

cmds.rowLayout(numberOfColumns=1)
applyRot = cmds.checkBox(label='Apply rotation', v=True)
cmds.setParent('..')

cmds.rowLayout(numberOfColumns=1)
enableRemap = cmds.checkBox(label='Enable rotation weighting', v=True)
cmds.setParent('..')

cmds.rowLayout(numberOfColumns=1)
verifyJoints = cmds.checkBox(label='Verify joints', v=False)
cmds.setParent('..')

cmds.rowLayout(numberOfColumns=2)
cmds.button(label='Apply',
            command=functools.partial(applyCallback, collection1, applyRot,
                                      verifyJoints, enableRemap))
cmds.button(label='Cancel', command=cancelCallback)
cmds.setParent('..')

cmds.radioCollection(collection1, edit=True, select=aX)

cmds.showWindow(UIWindow)
Пример #41
0
def FSrenamerUI():
	'''
	Create UI Window
	'''
	# Size Parameters

	windowWidth = 540
	windowHeight = 300
	paddingFrameSize = 116
	materialSize = 80
	colorSize = 80
	positionSize = 50
	nameSize = 200
	paddingSize = 50
	extensionSize =50
	spacingSize = 7
	searchSize = 80
	searchInputSize = 300
	prefixSize = 80
	prefixInputSize = 150
	frameLayoutMargin = 10
	namespaceButtonSize = 200

	#Color
	frame_bgc = [0.18, 0.18, 0.18]

	
	# Parameters Lists

	materialList = ['concrete', 'stone','paint','metal','wood','plastic','rubber','cloth','glass','ceramic','skin','hair','nail','bone','liquid','polysterene','leather','default','paper','felt','light','plant']
	materialList.sort()
	colorList = ['Grey','Black','White','Yellow','Red','Green','Blue','Orange','Purple','Brown','Pink','Colour','Clear','Mixed']
	colorList.sort()
	positionList = ['C','R', 'L', 'F', 'B', 'FR','BR','FL','BL']
	extensionList = ['GEP','GES','GED','GEV','PLY','NRB','CRV','GRP','LOC']


	# Window Creation

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

	window = cmds.window("FSRenamer_window", title= __title__+ ' ' +__version__, iconName='FSRenamer', width=windowWidth, height=windowHeight, sizeable=False)

	cmds.columnLayout( adjustableColumn=True )


	'''
	Search and Replace
	'''

	cmds.frameLayout(label="Search and Replace", collapsable=True, collapse=True, marginWidth=frameLayoutMargin, bgc=frame_bgc)
	cmds.separator( height=5, style='none' )

	cmds.rowLayout(numberOfColumns=2)
	cmds.text(label='Search For :', width=searchSize, align='right')
	cmds.textField('searchFor_textField', width=searchInputSize)
	cmds.setParent(upLevel=True)

	cmds.rowLayout(numberOfColumns=2)
	cmds.text(label='Replace with :', width=searchSize, align='right')
	cmds.textField('replaceWith_textField', width=searchInputSize)
	cmds.setParent(upLevel=True)

	cmds.rowLayout(numberOfColumns=4)
	cmds.separator(width=searchSize, style=None)
	cmds.radioCollection('searchAndReplaceOptions_radioCollection')
	cmds.radioButton('hierarchy_radioButton' ,label='Hierarchy', sl=True)
	cmds.radioButton('selected_radioButton' ,label='Selected')
	cmds.radioButton('all_radioButton' ,label='All')
	cmds.setParent(upLevel=True)

	cmds.button('searchAndReplace_button', label='Replace', height=30, command=searchAndReplace)


	cmds.separator( height=10, style='none' )
	cmds.setParent(upLevel=True)
	

	'''
	Prefix and Suffix
	'''

	cmds.frameLayout(label="Prefix and Suffix", collapsable=True, collapse=True,  marginWidth=frameLayoutMargin, bgc=frame_bgc)
	cmds.separator( height=5, style='none' )

	cmds.rowLayout(numberOfColumns=3)
	cmds.text(label='Prefix :', width=prefixSize, align='center')
	cmds.textField('addPrefix_textField', width=prefixInputSize)
	cmds.button('addPrefix_button', width=prefixSize, label='Add Prefix', command=partial(addPrefixSuffix, 'prefix'))
	cmds.setParent(upLevel=True)

	cmds.rowLayout(numberOfColumns=3)
	cmds.text(label='Suffix :', width=prefixSize, align='center')
	cmds.textField('addSuffix_textField', width=prefixInputSize)
	cmds.button('addSuffix_button', width=prefixSize, label='Add Suffix', command=partial(addPrefixSuffix, 'suffix'))
	cmds.setParent(upLevel=True)

	#cmds.checkBox('keepNamespacePrefix_checkbox', l='Keep Namespaces', v=0)

	cmds.separator( height=10, style='none' )
	cmds.setParent(upLevel=True)

	
	'''
	Namespaces Utilities
	'''

	cmds.frameLayout(label="Namespace Utilities", collapsable=True, collapse=True, marginWidth=frameLayoutMargin, bgc=frame_bgc)
	cmds.separator( height=5, style='none' )

	cmds.rowLayout(numberOfColumns=2)

	cmds.columnLayout(rowSpacing=5)
	cmds.textScrollList('namespaces_list',allowMultiSelection=True, height=150, width=360)

	displayNamespacesList()

	cmds.setParent(upLevel=True)

	cmds.columnLayout(rowSpacing=5)
	cmds.button('removeSelectedNamespaces_button', label='Remove Selected Namespaces', width=namespaceButtonSize, command=removeSelectedNamespaces)
	cmds.button('removeAllNamespaces_button', label='Remove All Namespaces', width=namespaceButtonSize, command=removeAllNamespaces)
	cmds.separator(height=20, style='none')
	cmds.button('refreshNamespaces_button', label="Refresh", width=namespaceButtonSize, command=refreshNamespacesListTrigger)
	cmds.setParent(upLevel=True)
	cmds.setParent(upLevel=True)

	
	cmds.separator( height=5, style='none' )
	cmds.setParent(upLevel=True)

	
	'''
	Lettering and numbering
	'''

	cmds.frameLayout(label="Padding", collapsable=True, collapse=False, marginWidth=frameLayoutMargin, bgc=frame_bgc)
	cmds.separator( height=5, style='none' )

	cmds.rowLayout(numberOfColumns=4)
	cmds.separator(width=paddingFrameSize*2, style='none' )
	cmds.text(label='Number of Digits', width=paddingFrameSize, align='center')
	cmds.text(label='Start Value (Offset)', width=paddingFrameSize, align='center')
	cmds.setParent(upLevel=True)

	cmds.rowLayout(numberOfColumns=4)
	cmds.radioCollection('numbersOrLetters_radioCollection')
	cmds.radioButton('numbers_radioButton' ,label='Numbers', width=paddingFrameSize, sl=True , onc=toggleNumberOfDigits)
	cmds.radioButton('letters_radioButton', label='Letters' , width=paddingFrameSize, onc=toggleNumberOfDigits)
	cmds.intField('paddingField', minValue=1, maxValue=10, value=4 , step=1, width=paddingFrameSize)
	cmds.intField('paddingStartField', minValue=1, step=1, value=1, width=paddingFrameSize)

	cmds.setParent(upLevel=True)
	cmds.separator( height=5, style='none' )
	cmds.setParent(upLevel=True)


	'''
	Renaming input fields
	'''

	cmds.frameLayout(label="Renaming Input Fields", collapsable=True, collapse=False, marginWidth=frameLayoutMargin, bgc=frame_bgc)
	cmds.separator( height=10, style='none' )


	# Titles
	
	cmds.rowLayout(numberOfColumns=9)
	cmds.text(label="Material", align='center', width=materialSize)
	cmds.text(label="Color", align='center', width=colorSize)
	cmds.separator(style='none', width=spacingSize)
	cmds.text(label="Position", align='center', width=positionSize)
	cmds.separator(style='none', width=spacingSize)
	cmds.text(label="Name", align='center', width=nameSize)
	cmds.text(label="Padding", align='center', width=paddingSize)
	cmds.separator(style='none', width=spacingSize)
	cmds.text(label="Extension", align='center', width=extensionSize)
	cmds.setParent(upLevel=True)

		# Input fields

	cmds.rowLayout(numberOfColumns=9)

	cmds.optionMenu('materialMenu', width=materialSize)
	for m in materialList:
		cmds.menuItem( label=m )

	cmds.optionMenu('colorMenu', width=colorSize)
	for c in colorList:
		cmds.menuItem( label=c )

	cmds.text(label="_", align='center')

	cmds.optionMenu('positionMenu', width=positionSize)
	for p in positionList:
		cmds.menuItem( label=p )

	cmds.text(label="_", align='center')

	cmds.textField('nameField', width=nameSize)

	cmds.text(label="# # # #", align='center', width=paddingSize)

	cmds.text(label="_", align='center')

	cmds.optionMenu('extensionMenu', width=extensionSize)
	for e in extensionList:
		cmds.menuItem( label=e )



	cmds.setParent(upLevel=True)


	# Group Naming Template, Keep Namespace switch

	cmds.checkBox('keepNamespace_checkbox', l='Keep Namespaces', v=0)
	cmds.checkBox('groupNaming_checkbox', l='Group Naming Template', v=0, onc=enableGroupRename, ofc=disableGroupRename)
	cmds.checkBox('disablePadding_checkbox', l='Disable Padding For Single Group', v=1, en=0)

	cmds.separator( height=10, style='none' )
	cmds.setParent(upLevel=True)


	'''
	Buttons
	'''

	cmds.separator( height=10, style='none' )

	cmds.button( 'renameButton', label = 'Rename Selection', height=50, command=renameSelection )

	cmds.separator( height=20, style='double' )

	cmds.button( label='Close', height=30, command=('cmds.deleteUI(\"' + window + '\", window=True)') )

	cmds.setParent(upLevel=True)
	cmds.window(window, e=True, width=windowWidth, height=windowHeight)
	cmds.showWindow( window )
Пример #42
0
def cleanUI(*args):
    """the UI for the clean/tangent functions"""

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

    widgets["win"] = cmds.window("cleanWin", t="zbw_cleanKeys", w=300, h=220)
    widgets["mainCLO"] = cmds.columnLayout()
    # widgets["tabLO"] = cmds.tabLayout()

    widgets["cleanCLO"] = cmds.columnLayout("Clean Keys")
    #some explanation
    cmds.text("Options for which keys to clean/delete:")
    cmds.separator(h=10)
    #radio button group for all selected or for hierarchy under selected
    widgets["hierarchyRBG"] = cmds.radioButtonGrp(
        nrb=2,
        l1="Selected Objs Only",
        l2="Hierarchy Under Selected",
        sl=2,
        cw=[(1, 120), (2, 75), (3, 75)],
        cc=enableCurve)
    #radioButtons for time (timeslider, all anim, range)
    widgets["timeRBG"] = cmds.radioButtonGrp(nrb=3,
                                             l1="Timeslider",
                                             l2="All Anim",
                                             l3="Frame Range",
                                             sl=2,
                                             cw=[(1, 100), (2, 75), (3, 75)],
                                             cc=partial(
                                                 enableFR, "timeRBG",
                                                 "frameRangeIFG", "keepCBG"))
    #int field group for frame range
    widgets["frameRangeIFG"] = cmds.intFieldGrp(nf=2,
                                                l="Start/End",
                                                v1=1,
                                                v2=24,
                                                en=False,
                                                cal=[(1, "left"), (2, "left"),
                                                     (3, "left")],
                                                cw=[(1, 75), (2, 75), (3, 75)])

    #radio button group for nurbs curves only or for all transforms
    widgets["curvesRBG"] = cmds.radioButtonGrp(
        nrb=2,
        l1="Curves/Volume Primatives Only",
        l2="All DAG",
        sl=1,
        cw=[(1, 190), (2, 110)])

    cmds.separator(h=10, style="single")

    #area to create/keep buffer curves
    widgets["bufCBG"] = cmds.checkBoxGrp(ncb=2,
                                         l1="Buffer Original Curve",
                                         l2="Overwrite Existing Buffer",
                                         v1=1,
                                         v2=0,
                                         cw=([1, 140], [2, 50], [3,
                                                                 100], [4,
                                                                        50]),
                                         cal=([1, "left"], [2, "left"],
                                              [3, "left"], [4, "left"]))

    cmds.separator(h=10, style="single")
    #check box for singlets and couplets
    cmds.text("Singletons have only one key. Couplets have only 2 keys")
    widgets["keepCBG"] = cmds.checkBoxGrp(ncb=2,
                                          l1="Keep Singletons",
                                          l2="Keep Identical Couplets",
                                          v1=0,
                                          v2=0)

    cmds.separator(h=10)
    widgets["buttonRCLO"] = cmds.rowColumnLayout(w=300,
                                                 nc=2,
                                                 cw=[(1, 200), (2, 100)])
    widgets["cleanBut"] = cmds.button(l="Clean Animation Curves!",
                                      w=200,
                                      h=40,
                                      bgc=(.6, .8, .6),
                                      c=clean)
    widgets["selectBut"] = cmds.button(l="Select\nHierarchy!",
                                       w=100,
                                       h=40,
                                       bgc=(.8, .6, .6),
                                       c=selectHier)

    cmds.showWindow(widgets["win"])
    cmds.window(widgets["win"], e=True, w=300, h=220)
		def create_ui(): # NEED TO REFACTOR
			if cmds.window(obj.main_window_name, exists = True):
				cmds.deleteUI(obj.main_window_name)
			obj.close_progressbar()
			
			cmds.window(obj.main_window_name, title = obj.main_window_label,
														mxb = False, s = True)
			cmds.window(obj.main_window_name, e = True, rtf = True,
								wh = (10, 10), cc = "obj.close_progressbar()")
			
			cmds.columnLayout(obj.UI_layout, rs = 4, adj = True)
			
			# Translate layout
			cmds.frameLayout(obj.T_layout_name, l = obj.TL_label, cll = 1,
								bgc = obj.frame_color_1, parent = obj.UI_layout,
								cc = ('obj.resize_UI()'))
			
			cmds.floatSliderGrp(obj.T_sliderSmooth_name, l = obj.smooth_label, f = True,
								cc = ('obj.T_print_smooth()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.goal_smooth_ann,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			cmds.floatSliderGrp(obj.T_sliderScale_name, l = obj.scale_label, f = True,
								cc = ('obj.T_print_scale()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.time_scale_ann,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			cmds.floatSliderGrp(obj.T_sliderWeight_name, l = obj.weight_label, f = True,
								cc = ('obj.T_print_weight()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.goal_weight_annn,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			
			cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [(1, obj.rW1), (2, obj.rW2), (3, obj.rW3)])
			
			cmds.button(label = obj.reset_button_label, command = ('obj.reset_translation_sliders()'),
								bgc = obj.yellow_button, h = obj.slider_height,
								ann = obj.T_reset_ann)
			
			cmds.separator(h = obj.slider_height / 1.25, style = 'none')
			
			#cmds.button(label = obj.TB_run_label, command = ('obj.translate_simulation()'),
			cmds.button(label = obj.TB_run_label,
					command = ('obj.run_simulation(obj.prefix_base_layer[1])'),
					bgc = obj.green_button, h = obj.slider_height)
			
			
			
			# Rotate layout
			cmds.frameLayout(obj.R_layout_name, l = obj.RL_label, cll = 1,
								bgc = obj.frame_color_1, parent = obj.UI_layout,
								cc = ('obj.resize_UI()'))
			
			cmds.floatSliderGrp(obj.R_sliderSmooth_name, l = obj.smooth_label, f = True,
								cc = ('obj.R_print_smooth()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.goal_smooth_ann,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			cmds.floatSliderGrp(obj.R_sliderScale_name, l = obj.scale_label, f = True,
								cc = ('obj.R_print_scale()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.time_scale_ann,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			cmds.floatSliderGrp(obj.R_sliderWeight_name, l = obj.weight_label, f = True,
								cc = ('obj.R_print_weight()'), pre = obj.precision,
								w = obj.sl_Width, ann = obj.goal_weight_annn,
								cal = (1, "left"), cw3 = (45, 50, 10) )
			
			
			cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [(1, obj.rW1), (2, obj.rW2), (3, obj.rW3)])
			
			cmds.button(label = obj.reset_button_label, command = ('obj.reset_rotation_sliders()'),
								bgc = obj.yellow_button, h = obj.slider_height,
								ann = obj.R_reset_ann)
			
			cmds.separator(h = obj.slider_height / 1.25, style = 'none')
			
			cmds.button(label = obj.RB_run_label,
										#command = ('obj.rotate_simulation()'),
					command = ('obj.run_simulation(obj.prefix_base_layer[2])'),
					bgc = obj.green_button, h = obj.slider_height)
			
			
			
			# Checkbox layout
			cmds.frameLayout(obj.CH1_layout_name, l = obj.CH1_label, cll = 1,
								bgc = obj.frame_color_1, p = obj.UI_layout,
								cc = ('obj.resize_UI()'))
			
			
			
## Надо решить
			columns_count1 = 3
			cWraw1 = obj.window_width / columns_count1
			cellOffset1 = 10
			cHeight1 = obj.slider_height / 1.3
## Надо решить
			
			cmds.rowColumnLayout(numberOfColumns = columns_count1, columnWidth = [
															(1, cWraw1),
															(2, cWraw1 - cellOffset1),
															(3, cWraw1 + cellOffset1)])
			
			cmds.separator(h = obj.slider_height / 4, style = 'none')
			cmds.separator(style = 'none')
			cmds.separator(style = 'none')
			
			## Cell #1 ##
			## Reset button ##
			cmds.button(label = obj.reset_button_label, command = ('obj.reset_checkboxes()'),
								bgc = obj.yellow_button, h = cHeight1,
								ann = obj.CH1_reset_ann)
			
			## Cell #2 ##
			## Aim reverse #1 ##
			cmds.checkBox(obj.aimReverse_checkbox_name, label = obj.Aim_reverse_label,
								cc = ('obj.print_check_vector()'),
								bgc = (obj.Bg1, obj.Bg1, obj.Bg1), ann = obj.aim_reverse_ann)
			
			## Cell #3 ##
			## Cycle #2 ##
			cmds.checkBox(obj.cycle_checkbox_name, label = obj.Cycle_checkbox_label,
								h = cHeight1, cc = ('obj.print_check_cycle()'),
								bgc = (obj.Bg1, obj.Bg1, obj.Bg1),
								ann = obj.cycle_checkbox_ann)
			
			## Cell #4 ##
			## Empty ##
			cmds.separator(style = 'none')
			
## Надо решить
			## Cell #5 ##
			## Checkbox #3 ##
			cmds.checkBox("test_checkbox_5", label = "", v = False, en = False,
					cc = ('print "Hello TEST!!!"'), h = cHeight1, bgc = (obj.Bg1, obj.Bg1, obj.Bg1),
					ann = "Work in progress")
## Надо решить
			## Cell #6 ##
			## Hierarchy mode #4 ##
			cmds.checkBox(obj.hierarchy_checkbox_name, label = "Hierarchy mode",
									h = cHeight1, cc = ('obj.print_hierarchy_mode()'),
									bgc = (obj.Bg1, obj.Bg1, obj.Bg1),
									ann = "Work in progress")
## Надо решить
			
			
			
			
			
			# Button layout
			cmds.frameLayout(obj.B1_layout_name, l = obj.B1_label, cll = 1, bgc = obj.frame_color_1,
										parent = obj.UI_layout, cc = ('obj.resize_UI()'))
			
## Надо решить
			columns_count2 = 5
			cWraw2 = obj.window_width / columns_count2
## Надо решить
			
			cmds.rowColumnLayout(numberOfColumns = columns_count2, columnWidth = [
											(1, cWraw2), (2, cWraw2), (3, cWraw2),
											(4, cWraw2), (5, cWraw2)], p = obj.B1_layout_name)
			## Cell #1 ##
			cmds.button(label = obj.resetAll_button_label, command = ('obj.reset_all()'),
								bgc = obj.yellow_button, h = obj.slider_height, ann = obj.resetAll_ann)
			## Cell #2 ##
			cmds.button(label = "", command = ('print "button 2"'), en = False,
								h = obj.slider_height, ann = "")
			## Cell #3 ##
			cmds.button(label = obj.delete_label, command = ('obj.delete_overlappy_layer()'),
								bgc = obj.red_button, h = obj.slider_height, ann = obj.delete_ann)
			## Cell #4 ##
			cmds.button(label = "", command = ('print "some command"'), en = False,
								h = obj.slider_height, ann = "")
			## Cell #5 ##
			cmds.button(label = obj.move_label, command = ('obj.move_layers_to_safe()'), en = True,
								bgc = obj.blue_button, h = obj.slider_height, ann = obj.move_ann)
			
			
			
			## Cell #6 ##
			cmds.button(label = "", command = ('print "some command"'), en = False,
												h = obj.slider_height, ann = "")
			## Cell #7 ##
			cmds.button(label = "", command = ('print "some command"'), en = False,
												h = obj.slider_height, ann = "")
			## Cell #8 ##
			cmds.button(label = "", command = ('print "some command"'), en = False,
												h = obj.slider_height, ann = "")
			## Cell #9 ##
			cmds.button(label = "", command = ('print "some command"'), en = False,
												h = obj.slider_height, ann = "")
			## Cell #10 ##
			cmds.button(label = "HIERARCHY", command = ('obj.SelectTransformHierarchy()'),
								en = True, h = obj.slider_height,
								ann = "Select transform hierarchy (without shapes)")
			
			
			
			# About layout
			cmds.columnLayout(obj.about_layout_name, rs = 4, adj = True,
								parent = obj.UI_layout, bgc = obj.end_color_1)
			
			cmds.frameLayout(l = obj.about_label, cll = 1, bgc = obj.frame_color_2,
								cl = 1, p = obj.about_layout_name, cc = ('obj.resize_UI()'))
			
			cmds.text(obj.aboutText[0], h = 20)
			cmds.text(obj.aboutText[1], hl = True, h = 20, bgc = obj.link_color_1)
			cmds.text(obj.aboutText[2], hl = True, h = 20, bgc = obj.link_color_1)
			cmds.text(obj.aboutText[3], hl = True, h = 20, bgc = obj.link_color_2)
			cmds.text(obj.aboutText[4], hl = True, h = 20, bgc = obj.link_color_2)
			
			cmds.showWindow(obj.main_window_name)
Пример #44
0
def editCharacter(*args):

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

        cmds.deleteUI("artEditCharacterUI")

    window = cmds.window("artEditCharacterUI",
                         w=300,
                         h=400,
                         title="Edit Character",
                         mxb=False,
                         mnb=False,
                         sizeable=False)

    mainLayout = cmds.columnLayout(w=300, h=400, rs=5, co=["both", 5])

    #banner image

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

    if os.path.exists(toolsPath):

        f = open(toolsPath, 'r')

        mayaToolsDir = f.readline()

        f.close()

    cmds.image(w=300,
               h=50,
               image=mayaToolsDir + "/General/Icons/ART/artBanner300px.bmp",
               parent=mainLayout)

    cmds.text(label="", h=1, parent=mainLayout)

    optionMenu = cmds.optionMenu("artProjOptionMenu",
                                 label="Project:",
                                 w=290,
                                 h=40,
                                 cc=getProjCharacters,
                                 parent=mainLayout)

    textScrollList = cmds.textScrollList("artProjCharacterList",
                                         w=290,
                                         h=300,
                                         parent=mainLayout)

    button = cmds.button(
        w=290,
        h=40,
        label="Edit Export File",
        c=editSelectedCharacter,
        ann=
        "Edit the character's skeleton settings, joint positions, or skin weights.",
        parent=mainLayout)

    button2 = cmds.button(
        w=290,
        h=40,
        label="Edit Rig File",
        c=editSelectedCharacterRig,
        ann=
        "Edit the character's control rig that will be referenced in by animation.",
        parent=mainLayout)

    cmds.text(label="", h=1)

    cmds.showWindow(window)

    getProjects()

    getProjCharacters()
                        
        else:
 
            # 3. Generate a UI that asks the name and number of twist joints
            if cmds.window('joint_twist_UI', exists = True):
                cmds.deleteUI('joint_twist_UI')
            else:  
                cmds.window('joint_twist_UI')
                cmds.window('joint_twist_UI',e=True,w=350,h=100)
                cmds.showWindow('joint_twist_UI')
                
                cmds.columnLayout('main_cl')
                cmds.rowColumnLayout('text_rcl',nc=2)
                cmds.text(label='Name:')   # This prints out a label
                cmds.textField('name_textField')  # This is to create a typing field
                cmds.text(label='# of Joints')
                cmds.intField('joint_num_intField',value = 1,minValue=1)
            
 
                # When the Create Joints is pressed, the create_joints def will be called. 
                cmds.checkBox('local_axis',label='Display Local Rotation Axis')
                cmds.checkBox('clear_orient',label='Zero Out Current Joint Orient')
                cmds.button('create_button',label='Create Joints',command='create_joints()')  
                cmds.button('cancel_button',label='Cancel',command='cmds.deleteUI("joint_twist_UI")')
             
else:
    cmds.warning('You need to select a joint.')      

             

Пример #46
0
    def displayUI(self):
        RigGUI = 'autoRigging'
        if rig.window(RigGUI, exists=True):
            rig.deleteUI(RigGUI)
        rig.window(RigGUI,
                   title=' 2009 AutoRig',
                   menuBar=True,
                   wh=(400, 500),
                   minimizeButton=True,
                   maximizeButton=True)

        #===============================================================================
        # 开始菜单
        #===============================================================================
        rig.menu(label='File', tearOff=True)
        rig.menuItem(label='New')
        rig.menuItem(label='Open')
        rig.menuItem(label='Save')
        rig.menuItem(divider=True)
        rig.menuItem(label='Quit')
        rig.menu(label='Help', helpMenu=True)
        rig.menuItem('Application..."',
                     label=u'帮助文档',
                     c='from RIG.Help.helpUI import *;SK_helptUI()')

        self.tabs = rig.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
        #===============================================================================
        # 开始"AutoRiggingLayout"
        #===============================================================================
        self.AutoRiggingLayout = rig.columnLayout(w=100,
                                                  h=600,
                                                  columnAlign='center')

        rig.button(label=u'     导入模版     ', w=322, c='SK_BodyJointPosition()')
        rig.separator(w=322, h=15, style='in')
        rig.setParent(self.AutoRiggingLayout)

        rig.intSliderGrp('fingerNumsField',
                         field=True,
                         label=u'手指个数:',
                         minValue=0,
                         maxValue=5,
                         fieldMinValue=0,
                         fieldMaxValue=100,
                         value=5,
                         columnAttach=[(1, 'left', 0), (2, 'left', 0),
                                       (3, 'both', 0)],
                         columnWidth3=(55, 50, 222))
        rig.intSliderGrp('toesNumsField',
                         field=True,
                         label=u'脚趾个数:',
                         minValue=0,
                         maxValue=5,
                         fieldMinValue=0,
                         fieldMaxValue=100,
                         value=5,
                         columnAttach=[(1, 'left', 0), (2, 'left', 0),
                                       (3, 'both', 0)],
                         columnWidth3=(55, 50, 222))
        rig.intSliderGrp('neckSegsField',
                         field=True,
                         label=u'脖子段数:',
                         minValue=2,
                         maxValue=5,
                         fieldMinValue=2,
                         fieldMaxValue=100,
                         value=2,
                         columnAttach=[(1, 'left', 0), (2, 'left', 0),
                                       (3, 'both', 0)],
                         columnWidth3=(55, 50, 222))
        rig.intSliderGrp('waistSegsField',
                         field=True,
                         label=u'腰部段数:',
                         minValue=3,
                         maxValue=10,
                         fieldMinValue=4,
                         fieldMaxValue=100,
                         value=0,
                         columnAttach=[(1, 'left', 0), (2, 'left', 0),
                                       (3, 'both', 0)],
                         columnWidth3=(55, 50, 222))
        rig.setParent(self.AutoRiggingLayout)

        rig.separator(w=322, h=15, style='in')

        rig.rowColumnLayout(numberOfColumns=2,
                            columnWidth=[(1, 161), (2, 161)],
                            columnAttach=(2, 'both', 0))
        rig.button(label=u' 刷新模版  ', w=130, c='SK_refreshTemp()')
        rig.button(label=u' 镜像骨骼 ', w=130, c='orientAndMirrorJoint ()')
        rig.setParent(self.AutoRiggingLayout)

        rig.separator(w=322, h=15, style='in')

        rig.text(l=u'选择项目')  #选择项目
        rig.radioCollection()
        rig.rowColumnLayout(nc=3, columnWidth=[(1, 100), (2, 100), (3, 100)])
        self.OrigenRB = rig.radioButton(label=u'初始版本', sl=1)
        self.WoodliesRB = rig.radioButton(label='Woodlies')
        self.WinxTVRB = rig.radioButton(label='WinxTV', vis=False)
        rig.setParent(self.AutoRiggingLayout)

        rig.button(label=u' 生成身体设置  ',
                   w=322,
                   h=40,
                   c=lambda x: self.buildSetup())

        rig.separator(w=322, h=15, style='in')

        rig.columnLayout('MeshListLayout')
        rig.textScrollList('meshList',
                           w=322,
                           h=100,
                           allowMultiSelection=True,
                           deleteKeyCommand='SK_delMeshList() ')
        rig.setParent(self.AutoRiggingLayout)

        rig.separator(w=322, h=15, style='in')

        rig.rowColumnLayout(numberOfColumns=2,
                            columnWidth=[(1, 161), (2, 161)],
                            columnAttach=(2, 'both', 0))
        rig.button(label=u' 添加绑定模型 ', w=130, c='SK_addMeshList()')
        rig.button(label=u' 对绑定模型蒙皮 ', w=130, c='SK_rigSkin()')
        rig.setParent(self.AutoRiggingLayout)

        rig.separator(w=322, h=15, style='in')
        rig.button(l=u'IK<-->FK', w=322, h=40, c='SK_IKFKSwitchCommand()')

        rig.separator(w=322, h=15, style='in')
        rig.button(l=u'恢复初始POSE', w=322, h=40, c='SK_creatConDefaultPos(0)')

        rig.setParent(self.tabs)
        #===============================================================================
        # 开始"assemblageLayout"
        #===============================================================================
        self.assemblageLayout = rig.columnLayout(w=300, h=355)

        rig.text(u'1:->选择你要复制的部件2:->在下面的输入复制的数量\n3:->完成复制4:->完成镜像')
        rig.rowColumnLayout('skinningLayout',
                            numberOfColumns=3,
                            columnWidth=[(1, 109), (2, 109), (3, 109)],
                            columnAttach=(2, 'both', 0))
        rig.intField('numOfduplicate', min=1, max=100, value=1, step=1)
        rig.button(label=u' 完成复制 ', c='SK_duplicateJnt()')
        rig.button(label=u' 完成镜像 ', c='SK_mirrorDupJoint ()')
        rig.setParent('..')
        rig.separator(w=332, h=15, style='in')

        rig.setParent(self.tabs)
        #===============================================================================
        # 开始"RiggingToolsLayout"
        #===============================================================================
        self.RiggingToolsLayout = rig.columnLayout(w=300, h=355)

        #------------------------------------------------------------------------------
        modelFL = rig.frameLayout(w=327,
                                  label=u"模型工具",
                                  borderStyle='in',
                                  cll=True,
                                  cl=True)
        rig.frameLayout(modelFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + modelFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(modelFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + modelFL +
                        "\" ,edit=True,h=20)")
        rig.columnLayout()

        rig.separator(w=312, h=5, style='in')
        rig.button(
            label=u' 打开模型工具窗口 ',
            w=312,
            c='from RIG.tools.modelTools.modelUI import *; SK_modelUI()')

        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        simulationFL = rig.frameLayout(w=327,
                                       label=u"解算设置工具",
                                       borderStyle='in',
                                       cll=True,
                                       cl=True)
        rig.frameLayout(simulationFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + simulationFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(simulationFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + simulationFL +
                        "\" ,edit=True,h=20)")
        rig.columnLayout()

        rig.separator(w=312, h=5, style='in')
        rig.text(u'增加布料设置')
        rig.button(
            label=u' 打开布料设置窗口 ',
            w=312,
            c='from RIG.simulation.simulationUI import *; SK_simulationUI()')

        rig.separator(w=312, h=5, style='in')
        rig.text(u'增加动力学IK设置')
        rig.button(
            label=u' 打开动力学IK设置设置窗口 ',
            w=312,
            c='from RIG.tools.dynamicCurve.DC_dynamicCurveUI import *; SK_dynamicIKUI()'
        )

        rig.separator(w=312, h=5, style='in')
        rig.text(u'导入导出头发Cache工具')
        rig.button(
            label=u' 打开头发Cache窗口 ',
            w=312,
            c='from RIG.tools.ImportExportHairCache.hairCacheUI import *; SK_HairCacheUI()'
        )

        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        fingerFL = rig.frameLayout(w=327,
                                   label=u"手指工具",
                                   borderStyle='in',
                                   cll=True,
                                   cl=True)
        rig.frameLayout(fingerFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + fingerFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(fingerFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + fingerFL +
                        "\" ,edit=True,h=20)")
        rig.scrollLayout()
        fingerMoLayout = rig.columnLayout()

        rig.separator(w=312, h=5, style='in')
        rig.text(u' 增加手指工具')
        rig.button(label=u' 打开窗口 ', w=312, c='SK_fingerAnimUI()')
        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        resetFL = rig.frameLayout(w=327,
                                  label=u"恢复工具",
                                  borderStyle='in',
                                  cll=True,
                                  cl=True)
        rig.frameLayout(resetFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + resetFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(resetFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + resetFL +
                        "\" ,edit=True,h=20)")
        rig.scrollLayout()
        resetMoLayout = rig.columnLayout()

        rig.text(u"重新恢复到模版文件")
        rig.button(label=u' 恢复 ', w=312, c='SK_restoreJoint(True)')
        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        curveFL = rig.frameLayout(w=327,
                                  label=u"曲线工具",
                                  borderStyle='in',
                                  cll=True,
                                  cl=True)
        rig.frameLayout(curveFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + curveFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(curveFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + curveFL +
                        "\" ,edit=True,h=20)")
        curveMoScr = rig.scrollLayout()
        rig.columnLayout()

        rig.text(u" 导入-导出控制器形状 ")
        rig.button(
            label=u' 打开窗口',
            w=312,
            c='from RIG.tools.importExputCurveShape import *\nSK_ImportExportUI().displayUI()'
        )
        rig.separator(w=312, h=15, style='in')

        rig.text(u"镜像控制器形状")
        rig.rowColumnLayout('curveMirrorLayout',
                            numberOfColumns=2,
                            columnWidth=[(1, 156), (2, 156)],
                            columnAttach=(2, 'both', 0))
        rig.button(l=u'左 ——>右', c='SK_MirrorCurveControlCmd(1)')
        rig.button(l=u'右 ——>左', c='SK_MirrorCurveControlCmd(0)')
        rig.separator(w=312, h=15, style='in')
        rig.setParent('..')

        rig.text(u" 增加控制器到bodySet ")
        rig.button(
            label=u' 增加',
            w=312,
            c='from RIG.tools.addSet import *\nSK_AddToSet("bodySet",rig.ls(sl = True),True)'
        )
        rig.separator(w=312, h=15, style='in')
        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        extraFL = rig.frameLayout('extraFrame',
                                  w=327,
                                  label=u"附加工具",
                                  borderStyle='in',
                                  cll=True,
                                  cl=True)
        rig.frameLayout(extraFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + extraFL +
                        "\" ,edit=True,h=300)")
        rig.frameLayout(extraFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + extraFL +
                        "\" ,edit=True,h=20)")
        rig.columnLayout()

        #   选择骨骼增加控制器
        rig.text(u'为选择的骨骼添加控制器:')
        rig.button(label=u'确定', w=312, c='buildSKTOCON()')
        rig.separator(w=312, h=15, style='in')

        #   将软选择变形器转为CLUSTER
        rig.text(u'将softMod转为cluster:')
        rig.button(label=u'确定', w=312, c='softModToCluster()')
        rig.separator(w=312, h=15, style='in')

        rig.text(u'重设簇的形节点位置:')
        rig.button(label=u'确定', w=312, c='resetClusterPos()')
        rig.separator(w=312, h=15, style='in')

        rig.text(u'关闭场景中局部旋转轴向显示:')
        rig.button(label=u'确定', w=312, c='TL_CloseDisplayLocalAxis()')
        rig.separator(w=312, h=15, style='in')

        rig.text(u'创建线性IK:')
        rig.button(
            label=u'打开窗口',
            w=312,
            c='from RIG.tools.IKsplineTool.ikSpline import * \nIKSplineUI()')
        rig.setParent(self.RiggingToolsLayout)
        #------------------------------------------------------------------------------
        skinFL = rig.frameLayout('skinTools',
                                 w=327,
                                 label=u"权重工具",
                                 borderStyle='in',
                                 cll=True,
                                 cl=True)
        rig.frameLayout(skinFL,
                        edit=True,
                        expandCommand="rig.frameLayout(\"" + skinFL +
                        "\" ,edit=True,h=200)")
        rig.frameLayout(skinFL,
                        edit=True,
                        collapseCommand="rig.frameLayout(\"" + skinFL +
                        "\" ,edit=True,h=20)")
        rig.columnLayout()

        rig.separator(w=312, h=5, style='in')
        rig.text(u' 将一个物体的权重拷给多个物体')
        rig.button(
            label=u' 确定 ',
            w=312,
            c='from RIG.tools.copyWeigths import *\nSK_copyWeightToOtherObj()')

        rig.separator(w=312, h=5, style='in')
        rig.text(u'检测是否有影响物体重叠')
        rig.button(
            label=u' 确定 ',
            w=312,
            c='from RIG.tools.detectInfluence import *\ndetectInfluenceObj()')

        rig.separator(w=312, h=5, style='in')
        rig.text(u'导入导出权重')
        rig.button(
            label=u' 打开工具窗口 ',
            w=312,
            c='from RIG.tools.IOWeights.IOWeightsUI import *\nSK_IOWeightsUI()'
        )

        rig.setParent(self.RiggingToolsLayout)
        rig.setParent(self.tabs)
        #===============================================================================
        # 开始"faceRiggingLayout"
        #===============================================================================
        self.faceRiggingLayout = rig.columnLayout(w=300, h=355)

        rig.button(l=u'打开面部设置窗口',
                   c='from RIG.face.faceUI import *\nOpenFaceUI()',
                   w=325)

        rig.separator(w=325, h=5, style='in')
        rig.button(l=u'打开最新面部设置窗口',
                   c='import RIG.WDface.WD_FaceUI as face;face.WD_SelectUI()',
                   w=325)

        rig.separator(w=325, h=5, style='in')
        rig.text(u' 增加下颚设置')
        rig.rowColumnLayout(numberOfColumns=2,
                            columnWidth=[(1, 162), (2, 162)])
        rig.button(label=u' 确定 ',
                   c='from RIG.tools.AddJawSetup import *\nSK_AddJawSetup()')
        rig.button(
            l=u'移除设置',
            c='from RIG.tools.AddJawSetup import *\nSK_removeJawSetup()')
        rig.setParent('..')

        rig.separator(w=325, h=5, style='in')
        rig.text(u' 增加眼睛设置')
        rig.rowColumnLayout(numberOfColumns=3,
                            columnWidth=[(1, 108), (2, 108), (3, 108)],
                            columnAttach=(3, 'both', 0))
        rig.button(
            l=u'导入控制器',
            c='from RIG.tools.AddEyeSetup import SK_AddEyeSetup\nSK_AddEyeSetup(True)'
        )
        rig.button(
            l=u'完成设置',
            c='from RIG.tools.AddEyeSetup import SK_AddEyeSetup\nSK_AddEyeSetup(False)'
        )
        rig.button(
            l=u'移除设置',
            c='from RIG.tools.AddEyeSetup import SK_removeEyeSetup\nSK_removeEyeSetup()'
        )

        rig.setParent(self.tabs)
        rig.tabLayout( self.tabs,edit=True,tabLabel=((self.AutoRiggingLayout,'AutoRigging'), (self.assemblageLayout,'assemblage'),  (self.RiggingToolsLayout,'RiggingTools'),(self.faceRiggingLayout,'faceRigging')),\
                       selectTabIndex = self.getOptionVar(),changeCommand = lambda x = 0:self.setOptionVar())

        rig.showWindow(RigGUI)
        rig.window(RigGUI, e=True, wh=(344, 680))
Пример #47
0
    def createCorrectiveTarget(cls, *args):
        # Check working uint
        curUnit = cmds.currentUnit(q=True, linear=True)
        if curUnit != 'cm':
            cmds.currentUnit(linear='cm')

        # Remove HUD
        cmds.headsUpDisplay('sclptHUD', remove=True)

        # Refresh new corrective name text field
        cmds.textField(UI.widgets['correctiveTrgNameTxtFld'], e=True, text='')

        # Show cache geometry and inverse geometry shape.
        cls.shpVisOnOff(cls.geo, 'on')
        cls.shpVisOnOff(cls.invGeo, 'on')

        # Add invGeo and sculptGeo to blendshape node
        for cls.correctiveTrgName in [cls.sculptGeo, cls.invGeo]:
            if cls.bsNodeName != 'None':
                bsAttrList = cmds.aliasAttr(cls.bsNodeName, q=True)
                if not bsAttrList:
                    cmds.blendShape(cls.bsNodeName,
                                    edit=True,
                                    target=(cls.geo, 0, cls.correctiveTrgName,
                                            1.0))
                    cmds.setAttr(
                        '%s.%s' % (cls.bsNodeName, cls.correctiveTrgName), 1)
                else:
                    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(cls.bsNodeName,
                                    edit=True,
                                    target=(cls.geo, bsIndex,
                                            cls.correctiveTrgName, 1.0))
                    cmds.setAttr(
                        '%s.%s' % (cls.bsNodeName, cls.correctiveTrgName), 1)
            elif cls.bsNodeName == 'None':
                cls.bsNodeName = '{0}_correctiveBS'.format(cls.geo)
                cmds.blendShape(cls.correctiveTrgName,
                                cls.geo,
                                n=cls.bsNodeName,
                                frontOfChain=True)[0]
                cmds.setAttr('%s.%s' % (cls.bsNodeName, cls.correctiveTrgName),
                             1)

                # Fill blend shape node option menu
                # Load BS nodes
                cls.bsList = []
                allConnections = cmds.listHistory(cls.geo)
                for item in allConnections:
                    if cmds.objectType(item) == 'blendShape':
                        cls.bsList.append(item)

                # If already exists menu item in the bsOptMenu, delete menu items before populate
                bsOptItems = cmds.optionMenu(UI.widgets['bsNodeOptMenu'],
                                             q=True,
                                             itemListLong=True)
                if bsOptItems != None:
                    for bsOptItem in bsOptItems:
                        cmds.deleteUI(bsOptItem)
                if cls.bsList:
                    for bsNode in cls.bsList:
                        cmds.menuItem(label=bsNode,
                                      p=UI.widgets['bsNodeOptMenu'])

        # Build node network for inverse target
        mulNode = cmds.shadingNode('multiplyDivide',
                                   n=cls.sculptGeo + '_mul',
                                   asUtility=True)
        cmds.setAttr('%s.input2X' % mulNode, -1)
        cmds.connectAttr('%s.%s' % (cls.bsNodeName, cls.sculptGeo),
                         '%s.input1X' % mulNode)
        cmds.connectAttr('%s.outputX' % mulNode,
                         '%s.%s' % (cls.bsNodeName, cls.invGeo))

        # Add corrective and inverse target geometry to geo_grp
        correctiveTrgGeoGrpName = cls.geo + '_correctiveTrg_geo_grp'
        if cmds.objExists(correctiveTrgGeoGrpName):
            cmds.parent(cls.sculptGeo, correctiveTrgGeoGrpName)
            cmds.parent(cls.invGeo, correctiveTrgGeoGrpName)
        else:
            cmds.createNode('transform', n=correctiveTrgGeoGrpName)
            cmds.parent(cls.sculptGeo, correctiveTrgGeoGrpName)
            cmds.parent(cls.invGeo, correctiveTrgGeoGrpName)
        # Visibility off for sculpt and inverse geo shapes.
        cls.shpVisOnOff(cls.sculptGeo, 'off')
        cls.shpVisOnOff(cls.invGeo, 'off')

        # Refresh corrective target list
        cls.populateCorrectiveTrgList()

        # Return working unit
        cmds.currentUnit(linear=curUnit)

        # Button enable control
        cmds.button(UI.widgets['sculptBtn'], e=True, enable=True)
        cmds.button(UI.widgets['cancelBtn'], e=True, enable=False)
        cmds.button(UI.widgets['createBtn'], e=True, enable=False)
Пример #48
0
            cmds.parent(sphere, structure.GetControl())

            StickObjectToMesh(vtxObject, sphere[0])

            cmds.connectAttr('%s.translate' % sphere[0],
                             '%s.translate' % joint)
            cmds.connectAttr('%s.rotate' % sphere[0], '%s.rotate' % joint)
            cmds.connectAttr('%s.scale' % sphere[0], '%s.scale' % joint)


#*********************  Setup Window  ************************************************

window = ""

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

window = cmds.window(title="Setup stick Ctrls",
                     iconName='Stick Ctrls',
                     widthHeight=(300, 100),
                     sizeable=False)
cmds.columnLayout(adj=True)
cmds.separator(h=10)
cmds.text('Sticky Ctrls by Ronin Garay V1.')
cmds.separator(h=10)
radiusText = cmds.textFieldGrp(l='Ctrl Radius:  ', ed=True)
cmds.button(label='Create Ctrls', command='stickyCtrl()')
cmds.button(label='Close',
            command=('cmds.deleteUI(\"' + window + '\", window=True)'))
cmds.setParent('..')
cmds.showWindow(window)
Пример #49
0
    def build_gui_help_path_manager(self):
        ''' Creates the Help GUI for GT Path Manager '''
        window_name = "build_gui_help_path_manager"
        if cmds.window(window_name, exists=True):
            cmds.deleteUI(window_name, window=True)

        cmds.window(window_name,
                    title=script_name + " Help",
                    mnb=False,
                    mxb=False,
                    s=True)
        cmds.window(window_name, e=True, s=True, wh=[1, 1])

        main_column = cmds.columnLayout(p=window_name)

        # Title Text
        cmds.separator(h=12, style='none')  # Empty Space
        cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)],
                             p=main_column)  # Window Size Adjustment
        cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)],
                             p=main_column)  # Title Column
        cmds.text(script_name + " Help",
                  bgc=[.4, .4, .4],
                  fn="boldLabelFont",
                  align="center")
        cmds.separator(h=10, style='none', p=main_column)  # Empty Space

        # Body ====================
        cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column)
        # cmds.text(l='Script for managing paths', align="center")
        # cmds.separator(h=15, style='none') # Empty Space

        cmds.text(
            l=
            'This script displays a list with the name, type and path\n of any common nodes found in Maya.',
            align="center")
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(
            l=
            'You can select the node listed by clicking on it or \nchange its name or path by double clicking the cell.',
            align="center")

        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(
            l=
            'The icon on the left describes the validity of the path.\nIf the file or directory is found in the system it shows\n a green confirm icon otherwise it shows a red icon.',
            align="center")

        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(l='Auto Path Repair', align="center", font='boldLabelFont')
        cmds.text(
            l=
            'This function walks through the folders under the\nprovided directory looking for missing files. \nIf it finds a match, the path is updated.',
            align="center")
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(l='Search and Replace', align="center", font='boldLabelFont')
        cmds.text(
            l=
            'This function allows you to search and replace strings\nin the listed paths.',
            align="center")
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(l='Refresh', align="center", font='boldLabelFont')
        cmds.text(
            l='Re-populates the list while re-checking for path validity.',
            align="center")
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(l='Search Path', align="center", font='boldLabelFont')
        cmds.text(l='A directory path used when looking for missing files.',
                  align="center")

        cmds.separator(h=15, style='none')  # Empty Space
        cmds.rowColumnLayout(nc=2,
                             cw=[(1, 140), (2, 140)],
                             cs=[(1, 10), (2, 0)],
                             p=main_column)
        cmds.text('Guilherme Trevisan  ')
        cmds.text(
            l=
            '<a href="mailto:[email protected]">[email protected]</a>',
            hl=True,
            highlightColor=[1, 1, 1])
        cmds.rowColumnLayout(nc=2,
                             cw=[(1, 140), (2, 140)],
                             cs=[(1, 10), (2, 0)],
                             p=main_column)
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text(l='<a href="https://github.com/TrevisanGMW">Github</a>',
                  hl=True,
                  highlightColor=[1, 1, 1])
        cmds.separator(h=7, style='none')  # Empty Space

        # Close Button
        cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column)

        cmds.separator(h=5, style='none')
        cmds.button(l='OK', h=30, c=lambda args: close_help_gui())
        cmds.separator(h=8, style='none')

        # Show and Lock Window
        cmds.showWindow(window_name)
        cmds.window(window_name, e=True, s=False)

        # Set Window Icon
        qw = omui.MQtUtil.findWindow(window_name)
        widget = wrapInstance(long(qw), QtWidgets.QWidget)
        icon = QtGui.QIcon(':/question.png')
        widget.setWindowIcon(icon)

        def close_help_gui():
            ''' Closes Help UI in case it's opened. '''
            if cmds.window(window_name, exists=True):
                cmds.deleteUI(window_name, window=True)
Пример #50
0
    def ui(cls):
        cmds.window(cls.winName, title='Correct Shape', menuBar=True)

        cls.widgets['createMenu'] = cmds.menu(label='Create',
                                              tearOff=True,
                                              p=cls.winName)
        cls.widgets['addBsMenuItem'] = cmds.menuItem(
            label='Add Blend Shape Node', c=Functions.addBsNode)

        cls.widgets['editMenu'] = cmds.menu(label='Edit',
                                            tearOff=True,
                                            p=cls.winName)
        cls.widgets['selBsMenuItem'] = cmds.menuItem(
            label='Select Blend Shape Node', c=Functions.selBsNode)

        cls.widgets['helpMenu'] = cmds.menu(label='Help',
                                            tearOff=True,
                                            p=cls.winName)

        cls.widgets['mainColLo'] = cmds.columnLayout(adj=True)

        cmds.separator(h=5, p=cls.widgets['mainColLo'])

        cls.widgets['geoRowColLo'] = cmds.rowColumnLayout(numberOfColumns=3)
        cmds.text(label='Geometry: ', p=cls.widgets['geoRowColLo'])
        cls.widgets['geoTxtFld'] = cmds.textField(p=cls.widgets['geoRowColLo'])
        cmds.button(label='<<',
                    p=cls.widgets['geoRowColLo'],
                    c=Functions.loadGeoBS)

        cls.widgets['bsNodeRowColLo'] = cmds.rowColumnLayout(
            numberOfColumns=2, p=cls.widgets['mainColLo'])
        cmds.text(label='Blend Shape Node: ', p=cls.widgets['bsNodeRowColLo'])
        cls.widgets['bsNodeOptMenu'] = cmds.optionMenu(
            cc=Functions.populateCorrectiveTrgList,
            p=cls.widgets['bsNodeRowColLo'])

        cmds.separator(h=10, style='in', p=cls.widgets['mainColLo'])

        cls.widgets['correctiveTrgNameRowColLo'] = cmds.rowColumnLayout(
            numberOfColumns=4,
            columnSpacing=[(3, 30)],
            p=cls.widgets['mainColLo'])
        cmds.text(label='New Corrective: ',
                  p=cls.widgets['correctiveTrgNameRowColLo'])
        cls.widgets['correctiveTrgNameTxtFld'] = cmds.textField(
            p=cls.widgets['correctiveTrgNameRowColLo'])

        cls.widgets['scltBtnRowColLo'] = cmds.rowColumnLayout(
            numberOfColumns=2,
            columnWidth=[(1, 205), (2, 205)],
            columnSpacing=[(2, 5)],
            p=cls.widgets['mainColLo'])
        cls.widgets['sculptBtn'] = cmds.button(
            label='Sculpt',
            p=cls.widgets['scltBtnRowColLo'],
            c=Functions.sculptMode)
        cls.widgets['cancelBtn'] = cmds.button(
            label='Cancel',
            p=cls.widgets['scltBtnRowColLo'],
            c=Functions.cancelSculpt,
            enable=False)
        cls.widgets['createBtn'] = cmds.button(
            label='Create',
            h=40,
            p=cls.widgets['mainColLo'],
            c=Functions.createCorrectiveTarget,
            enable=False)

        cmds.separator(h=5, style='none', p=cls.widgets['mainColLo'])

        cls.widgets['correctiveTrgFrmLo'] = cmds.frameLayout(
            label='Corrective List',
            collapsable=True,
            p=cls.widgets['mainColLo'])
        cls.widgets['correctiveTrgColLo'] = cmds.columnLayout(
            adj=True, p=cls.widgets['correctiveTrgFrmLo'])
        cls.widgets['correctiveTrgTxtScrList'] = cmds.textScrollList(
            allowMultiSelection=True,
            sc=Functions.selBsNode,
            p=cls.widgets['correctiveTrgColLo'])
        cmds.popupMenu()
        cmds.menuItem(label='Refresh List',
                      c=Functions.populateCorrectiveTrgList)
        cls.widgets['popMenuRename'] = cmds.menuItem(label='Rename',
                                                     c=Functions.rename)
        cls.widgets['popMenuBreak'] = cmds.menuItem(label='Delete Key',
                                                    c=Functions.delKey)
        cls.widgets['popMenuRmv'] = cmds.menuItem(label='Remove',
                                                  c=Functions.removeTrg)
        cls.widgets['slderRowColLo'] = cmds.rowColumnLayout(
            numberOfColumns=2,
            columnWidth=[(1, 370)],
            p=cls.widgets['correctiveTrgColLo'])
        cls.widgets['trgFltSldrGrp'] = cmds.floatSliderGrp(
            field=True,
            columnWidth=[(1, 30)],
            min=0.00,
            max=1.00,
            step=0.01,
            dc=Functions.trgSldrDragCmd,
            cc=Functions.trgSldrDragCmd,
            enable=True,
            p=cls.widgets['slderRowColLo'])
        cmds.symbolButton(image='setKeyframe.png',
                          c=Functions.setKey,
                          p=cls.widgets['slderRowColLo'])

        cmds.window(cls.winName, e=True, w=400, h=300)
        cmds.showWindow(cls.winName)
    def buildUi(self):
        self.wind = cmds.window(
            self.winName,
            title='Matrix collision setup | PaulWinex | v2.0',
            widthHeight=[390, 270])
        cmds.columnLayout(adjustableColumn=True)

        cmds.frameLayout(label='Naming')
        self.elementName = cmds.textFieldGrp(label='Element Name')
        self.sideNameMenu = cmds.optionMenuGrp(label='Side',
                                               columnWidth=(2, 180))
        for k in '', 'center', 'left', 'right', 'lower', 'upper':
            cmds.menuItem(label=k)
        cmds.setParent('..')

        cmds.frameLayout(label='Orient collision plane to')
        cmds.rowLayout(numberOfColumns=4)
        cmds.columnLayout()
        collection1 = cmds.radioCollection()
        self.rbMeshNormal = cmds.radioButton(label='Mesh Normal', sl=1)
        self.rbRigControl = cmds.radioButton(label='Rig Control')
        cmds.setParent('..')

        cmds.columnLayout()
        self.fromCamera = cmds.radioButton(label='From Camera')
        self.ontocamera = cmds.radioButton(label='Onto Camera')
        cmds.setParent('..')

        cmds.columnLayout()
        self.rbX = cmds.radioButton(label='X')
        self.rbY = cmds.radioButton(label='Y')
        self.rbZ = cmds.radioButton(label='Z')
        cmds.setParent('..')

        cmds.columnLayout()
        self.rbXn = cmds.radioButton(label='-X')
        self.rbYn = cmds.radioButton(label='-Y')
        self.rbZn = cmds.radioButton(label='-Z')
        cmds.setParent('..')

        cmds.setParent('..')

        cmds.frameLayout(label='Source Objects')
        cmds.rowLayout(numberOfColumns=3,
                       columnWidth3=(90, 75, 40),
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'both', 0), (2, 'both', 0),
                                     (3, 'both', 0)])
        cmds.text('Rig Control')
        self.text2 = cmds.textField(editable=0)
        self.set2 = cmds.button(label='set', c=partial(self.setObject, 2))
        cmds.setParent('..')
        cmds.rowLayout(numberOfColumns=3,
                       columnWidth3=(90, 75, 40),
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[(1, 'both', 0), (2, 'both', 0),
                                     (3, 'both', 0)])
        cmds.text('Collision Mesh')
        self.text3 = cmds.textField(editable=0)
        self.set3 = cmds.button(label='set', c=partial(self.setObject, 3))
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.columnLayout(adjustableColumn=True)
        self.export = cmds.button(label='Do setup', c=self.doSetup)
Пример #52
0
cmds.columnLayout(adjustableColumn=True)
cmds.separator(h=20)
locatorNum = cmds.intSliderGrp(l='Spine joints: ',
                               min=3,
                               max=10,
                               field=True,
                               v=5,
                               hlc=(0.8, 0.2, 0.5))
cmds.separator(h=10)
cmds.symbolButton(image=Icons + 'Locator.png', c=LocatorsBtn)
cmds.separator(h=10)
cmds.symbolButton(image=Icons + 'Joint.png', c=JointsBtn)
cmds.separator(h=10)
cmds.separator(h=10)
RadioControlador = cmds.floatSliderGrp(l='Size:',
                                       min=1,
                                       max=20,
                                       field=True,
                                       v=1,
                                       hlc=(0.8, 0.2, 0.5))
cmds.separator(h=10)
cmds.button(label='Create Spine',
            command=SpineBtn,
            hlc=(0.8, 0.2, 0.5),
            bgc=(0.8, 0.2, 0.5),
            h=40)
cmds.separator(h=10)
cmds.text(label='By: Render de Martes', fn='fixedWidthFont')
cmds.text(label='*****@*****.**', fn='fixedWidthFont')
cmds.showWindow("AutoSpine")
Пример #53
0
    def __init__(self):
        name = 'cmt_orientjoints'
        if cmds.window(name, exists=True):
            cmds.deleteUI(name, window=True)
        if cmds.windowPref(name, exists=True):
            cmds.windowPref(name, remove=True)
        self.window = cmds.window(name,
                                  title='CMT Orient Joints',
                                  widthHeight=(358, 330))
        cmds.columnLayout(adjustableColumn=True)
        margin_width = 4
        cmds.frameLayout(bv=False,
                         label='Quick Actions',
                         collapsable=True,
                         mw=margin_width)
        cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
        cmds.button(label='Make Planar Orientation', command=self.make_planar)
        cmds.button(label='Project to Planar Position',
                    command=partial(make_position_planar))
        cmds.button(label='Align Up With Child', command=self.align_with_child)
        cmds.button(label='Zero Orient', command=self.zero_orient)
        cmds.button(label='Orient to World', command=self.orient_to_world)
        cmds.rowColumnLayout(numberOfColumns=4)

        height = 20
        label_width = 60
        icon_left = 'nudgeLeft.png'
        icon_right = 'nudgeRight.png'
        cmds.text(label='Offset X', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_left,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_x, direction=-1))
        self.offset_x = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_right,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_x, direction=1))
        cmds.text(label='Offset Y', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_left,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_y, direction=-1))
        self.offset_y = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_right,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_y, direction=1))
        cmds.text(label='Offset Z', align='right', width=label_width)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_left,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_z, direction=-1))
        self.offset_z = cmds.floatField(value=90.0)
        cmds.iconTextButton(style='iconOnly',
                            image1=icon_right,
                            label='spotlight',
                            h=height,
                            w=height,
                            c=partial(self.offset_orient_z, direction=1))

        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.frameLayout(bv=False,
                         label='Manual Orient',
                         collapsable=True,
                         mw=margin_width)
        cmds.columnLayout(adj=True)
        cmds.rowLayout(numberOfColumns=2, cw2=(150, 150))
        self.reorient_children = cmds.checkBox(label='Reorient children',
                                               value=True,
                                               align='left')
        self.reset_orientation = cmds.checkBox(label='Reset orientation',
                                               value=True,
                                               align='left')
        cmds.setParent('..')
        cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
        cmds.button(label='Template Joints',
                    command=partial(self.template_joints))
        cmds.button(label='Rebuild Joints', command=partial(rebuild_joints))
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.showWindow(self.window)
Пример #54
0
    def build_gui_search_replace_path_manager(self):
        ''' Creates the GUI for Searching and Replacing Paths '''
        window_name = "build_gui_search_replace_path_manager"
        if cmds.window(window_name, exists=True):
            cmds.deleteUI(window_name, window=True)

        cmds.window(window_name,
                    title='Search and Replace',
                    mnb=False,
                    mxb=False,
                    s=True)
        cmds.window(window_name, e=True, s=True, wh=[1, 1])

        main_column = cmds.columnLayout(p=window_name)

        # Body
        cmds.separator(h=12, style='none')  # Empty Space
        cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)], p=main_column)
        cmds.text(l='This will search and replace strings in your paths',
                  align="center")
        cmds.separator(h=12, style='none')  # Empty Space
        cmds.rowColumnLayout(nc=1, cw=[(1, 310)], cs=[(1, 10)],
                             p=main_column)  # Window Size Adjustment
        cmds.rowColumnLayout(nc=1, cw=[(1, 300)], cs=[(1, 10)],
                             p=main_column)  # Title Column
        cmds.text('Search for:',
                  bgc=[.4, .4, .4],
                  fn="boldLabelFont",
                  align="center")
        search_txtfield = cmds.textField(placeholderText='Type search here')
        cmds.separator(h=10, style='none')  # Empty Space
        cmds.text('Replace with:',
                  bgc=[.4, .4, .4],
                  fn="boldLabelFont",
                  align="center")
        replace_txtfield = cmds.textField(placeholderText='Type replace here')

        # Close Button
        cmds.separator(h=5, style='none')
        cmds.rowColumnLayout(nc=2,
                             cw=[(1, 148), (2, 148)],
                             cs=[(1, 10), (2, 4)],
                             p=main_column)

        # Apply Button
        cmds.button(l='Search and Replace',
                    h=30,
                    c=lambda args: apply_search_replace())

        #cmds.separator(h=10, style='none')
        cmds.button(l='Cancel', h=30, c=lambda args: close_snr_gui())
        cmds.separator(h=8, style='none')

        # Show and Lock Window
        cmds.showWindow(window_name)
        cmds.window(window_name, e=True, s=False)

        # Set Window Icon
        qw = omui.MQtUtil.findWindow(window_name)
        widget = wrapInstance(long(qw), QtWidgets.QWidget)
        icon = QtGui.QIcon(':/search.png')
        widget.setWindowIcon(icon)

        def apply_search_replace():
            ''' Runs Search and Replace Function '''
            self.search_string = cmds.textField(search_txtfield,
                                                q=True,
                                                text=True)
            self.replace_string = cmds.textField(replace_txtfield,
                                                 q=True,
                                                 text=True)

            if self.search_string != '':
                try:
                    gt_path_manager_dialog.show()
                except:
                    pass
                self.refresh_table(is_search_replace=True)
                if cmds.window(window_name, exists=True):
                    cmds.deleteUI(window_name, window=True)
            else:
                cmds.warning('"Search for" string can\'t be empty.')

        def close_snr_gui():
            ''' Closes Search and Replace GUI in case it's opened. '''
            if cmds.window(window_name, exists=True):
                cmds.deleteUI(window_name, window=True)
Пример #55
0
    def displayUI(self):
        IDMTRigGUI = 'simulation'
        if rig.window(IDMTRigGUI, exists=True):
            rig.deleteUI(IDMTRigGUI)
        rig.window(IDMTRigGUI,
                   title=u'simulation',
                   menuBar=True,
                   wh=(320, 500),
                   minimizeButton=True,
                   maximizeButton=True)
        self.mainCLT = rig.columnLayout()

        rig.rowColumnLayout(numberOfColumns=3,
                            columnWidth=[(1, 100), (2, 150), (3, 73)],
                            columnAttach=(3, 'both', 0))
        rig.text(u'载入Ploygon物体:')
        self.ploygonTF = rig.textField(tx=u'')
        rig.button(l=u'>>', w=30, c=lambda x: self.loadSeleteObj())
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        rig.rowColumnLayout(numberOfColumns=5,
                            columnWidth=[(1, 100), (2, 35), (3, 10), (4, 35),
                                         (5, 50)],
                            columnAttach=(5, 'left', 0))
        rig.text(u'输入控制器数量:')
        self.columnIF = rig.intField(min=1,
                                     max=1000,
                                     v=2,
                                     cc=lambda x: self.computeCount())
        rig.text(l='X')
        self.rowIF = rig.intField(min=1,
                                  max=1000,
                                  v=2,
                                  cc=lambda x: self.computeCount())
        self.countTX = rig.text(l='  4', fn="boldLabelFont")
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        rig.rowColumnLayout(numberOfColumns=3,
                            columnWidth=[(1, 100), (2, 150)],
                            columnAttach=(2, 'both', 0))
        rig.text(u'输入控制器名字:')
        self.inputName = rig.textField(tx=u'Pre_3_M')
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        self.inputSizeFSG = rig.floatSliderGrp(field=True,
                                               label=u'控制器大小:',
                                               minValue=0.0001,
                                               maxValue=2,
                                               fieldMinValue=0.0001,
                                               fieldMaxValue=10000,
                                               value=1,
                                               columnAttach=[(1, 'left', 20),
                                                             (2, 'left', 0),
                                                             (3, 'both', 0)],
                                               columnWidth3=(100, 30, 150))
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        self.inputShapeOM = rig.optionMenuGrp(label=u'选择控制器形状: ',
                                              columnWidth=[(1, 100), (2, 100)])
        rig.menuItem(label=u'球形')
        rig.menuItem(label=u'正方形')
        rig.menuItem(label=u'长圆形')
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        self.inputColorOM = rig.optionMenuGrp(label=u'选择控制器颜色: ',
                                              columnWidth=[(1, 100), (2, 100)])
        rig.menuItem(label=u'红色')
        rig.menuItem(label=u'黄色')
        rig.menuItem(label=u'蓝色')
        rig.setParent(self.mainCLT)
        rig.separator(w=312, h=15, style='in')

        rig.button(l=u'导入定位点', w=325, c=lambda x: self.importLocatorPoint())
        rig.separator(w=312, h=15, style='in')

        rig.rowColumnLayout(numberOfColumns=3,
                            columnWidth=[(1, 125), (2, 125), (3, 73)],
                            columnAttach=(1, 'left', 0))
        rig.text(u'载入增加属性的控制器:')
        self.MasterTF = rig.textField(tx=u'Master')
        rig.button(l=u'>>', w=30, c=lambda x: self.loadMasterObj())
        rig.setParent(self.mainCLT)
        rig.button(l=u'自动生成布料设置', w=325, c=lambda x: self.autoClothSetup())

        rig.button(l=u'生成设置', w=325, c=lambda x: self.setup())
        rig.window(IDMTRigGUI, e=True, wh=(325, 500))
        rig.showWindow(IDMTRigGUI)
def TreeWindow():
    if mc.window('TreeGeneratorUI', exists=True):
        mc.deleteUI('TreeGeneratorUI')

    window = mc.window("TreeGeneratorUI",
                       title='L System Tree',
                       widthHeight=(200, 400),
                       sizeable=0,
                       minimizeButton=0,
                       maximizeButton=0)
    mc.columnLayout()

    mc.text(label="Number of branches (2-15): ")
    branchesText = mc.intField(minValue=2, value=9, maxValue=15)
    #branchNum = mc.intField(branchesText, query = True, value = True)

    mc.text(label="Branch Angle (0-90): ")
    angleText = mc.intField(minValue=0, value=35, maxValue=90)
    #angle = mc.intField(angleText, query = True, value = True)

    mc.text(label="Angle Variance (0-50)")
    angleVarianceText = mc.intField(minValue=0, value=6, maxValue=50)
    #angleVariance = mc.intField(angleVarianceText, query = True, value = True)

    mc.text(label="Length Decay (0-100): ")
    lengthFactorText = mc.intField(minValue=0, value=85, maxValue=100)
    #lengthFactor = mc.intField(lengthFactorText, query = True, value = True)

    mc.text(label="Length Variance (0-100): ")
    lengthVarianceText = mc.intField(minValue=0, value=15, maxValue=100)
    #lengthVariance = mc.intField(lengthVarianceText, query = True, value = True)

    mc.text(label="Radius Decay (0-100): ")
    radiusFactorText = mc.intField(minValue=0, value=90, maxValue=100)
    #radiusFactor = mc.intField(radiusFactorText, query = True, value = True)

    mc.text(label="Radius Variance(0-100): ")
    radiusVarianceText = mc.intField(minValue=0, value=10, maxValue=100)
    #radiusVariance = mc.intField(radiusVarianceText, query = True, value = True)

    mc.text(label="initial radius (0-2) ")
    initialRadiusText = mc.floatField(minValue=0, value=0.2, maxValue=2)
    #initialRadius = mc.floatField(initialRadiusText, query = True, value = True)

    mc.text(label="initial length (0-100): ")
    initialLengthText = mc.intField(minValue=0, value=20, maxValue=100)
    #initialLength = mc.intField(initialLengthText, query = True, value = True)

    mc.button(label="Draw Tree",
              command=lambda *args: drawTree(
                  branchesText, angleText, angleVarianceText, lengthFactorText,
                  lengthVarianceText, radiusFactorText, radiusVarianceText,
                  initialRadiusText, initialLengthText),
              width=100,
              height=30)
    mc.button(label="Reset Parameter",
              command=lambda *args:
              Reset(branchesText, angleText, angleVarianceText,
                    lengthFactorText, lengthVarianceText, radiusFactorText,
                    radiusVarianceText, initialRadiusText, initialLengthText),
              width=100,
              height=30)
Пример #57
0
import maya.cmds as mc

##OAT - Object Alignment Tool
#Instructions: first select source, then target

#This declares variable objAligner
string = objAligner

#This prevents the duplication of our window
if mc.window(objAligner, ex=True):
    mc.deleteUI(objAligner, window=True)

#Create a window for the object aligner that is not resizeable
objAligner = mc.window(title="Object Alignment Tool", s=False, wh=(300, 100))
#Create an adjustable column layout
mc.columnLayout(adj=True)
#Instructions
mc.text(l="Instructions: select source, then target")
#Add a button to our window
mc.button(l="Go Aligner Go!", w=300, h=100, c="aligner()")
#Show the window
mc.showWindow(objAligner)


#This creates a function (named "aligner()") that runs a series of code
def aligner():
    #This creates a parent constraint with no offset
    prtCns = mc.parentConstraint()
    #This removes the parent constraint
    mc.delete(prtCns)
Пример #58
0
            cmds.setAttr('{}|{}'.format(longCtrl[0],shape) + ".overrideEnabled", 1)
            cmds.setAttr('{}|{}'.format(longCtrl[0],shape) + ".overrideColor", Color)


wv = 25
winID = 'setNurbOverrideColorPanel'
# Create Window with buttons for each color override
if cmds.window(winID, exists=True):
    cmds.deleteUI(winID)

cmds.window(winID, title='Override NURB Color')
cmds.columnLayout(adjustableColumn=True, rowSpacing=5, width=200)

cmds.frameLayout(label='NURBS Colours', labelAlign='top')
cmds.rowColumnLayout(numberOfRows=1)
cmds.button(label='', ann='black', width=wv, command=partial(setNurbOverrideColor, 1), bgc=(0, 0, 0))
cmds.button(label='', ann='dark grey', width=wv, command=partial(setNurbOverrideColor, 2), bgc=(.2, .2, .2))
cmds.button(label='', ann='light grey', width=wv, command=partial(setNurbOverrideColor, 3), bgc=(.6, .6, .6))
cmds.button(label='', ann='white', width=wv, command=partial(setNurbOverrideColor, 16), bgc=(.9, .9, .9))

cmds.button(label='', ann='dark green', width=wv, command=partial(setNurbOverrideColor, 7), bgc=(.3, .6, .3))
cmds.button(label='', ann='soft green', width=wv, command=partial(setNurbOverrideColor, 23), bgc=(.4, .7, .4))
cmds.button(label='', ann='lime green', width=wv, command=partial(setNurbOverrideColor, 26), bgc=(.6, .8, .4))
cmds.button(label='', ann='light green', width=wv, command=partial(setNurbOverrideColor, 14), bgc=(.4, .9, .2))
cmds.button(label='', ann='light green', width=wv, command=partial(setNurbOverrideColor, 27), bgc=(.4, .8, .4))
cmds.button(label='', ann='light green', width=wv, command=partial(setNurbOverrideColor, 19), bgc=(.6, 1, .7))

cmds.button(label='', ann='dark purple', width=wv, command=partial(setNurbOverrideColor, 30), bgc=(.4, .3, .7))
cmds.button(label='', ann='navy', width=wv, command=partial(setNurbOverrideColor, 15), bgc=(.2, .3, .5))
cmds.button(label='', ann='dark blue', width=wv, command=partial(setNurbOverrideColor, 5), bgc=(.2, .2, .7))
cmds.button(label='', ann='blue', width=wv, command=partial(setNurbOverrideColor, 6), bgc=(.2, .3, 1))
Пример #59
0
    def __init__(self):

        windowName = "behaviour_UI_Ribbon"
        windowWidth = 400
        windowHeight = 160

        if mc.window(windowName, ex=True):
            mc.deleteUI(windowName)
            mc.windowPref(windowName, remove=True)

        mainWindow = mc.window(windowName,
                               t="behaviour_UI_Ribbon",
                               s=False,
                               mnb=False,
                               mxb=False)
        mc.window(windowName, e=True, wh=(windowWidth, windowHeight))
        mainFormL = mc.formLayout()

        prefixText = mc.text(l="prefix:")
        self.prefixField = mc.textField("prefix", pht="nombra me")
        numCtrlsText = mc.text(l="num_of_ctrls:")
        self.numCtrlsField = mc.intField("num_of_ctrls", min=1, v=5, step=1)
        numJntsText = mc.text(l="num_of_jnts:")
        self.numJntsField = mc.intField("num_of_jnts", min=1, v=29, step=1)

        self.equalCheckbox = mc.checkBox("equal", l="equal_dist", v=True)
        self.constrCheckbox = mc.checkBox("constrain", l="constrain", v=True)
        self.wireCheckbox = mc.checkBox("wire", l="wire", v=False)
        self.fkCheckbox = mc.checkBox("add_fk", l="add_fk", v=False)

        self.ribbonizeBtn = mc.button(l="Ribbon_ps", c=self.launch)

        mc.formLayout(mainFormL,
                      e=True,
                      attachForm=[
                          (prefixText, "left", 20),
                          (numCtrlsText, "left", 20),
                          (numJntsText, "left", 20),
                          (prefixText, "top", 19),
                          (self.prefixField, "top", 15),
                          (self.equalCheckbox, "left", 20),
                          (self.wireCheckbox, "left", 20),
                          (self.constrCheckbox, "left", 110),
                          (self.fkCheckbox, "left", 110),
                          (self.prefixField, "left", 110),
                          (self.numCtrlsField, "left", 110),
                          (self.numJntsField, "left", 110),
                          (self.ribbonizeBtn, "left", 200),
                          (self.ribbonizeBtn, "right", 15),
                          (self.ribbonizeBtn, "top", 15),
                          (self.ribbonizeBtn, "bottom", 15),
                      ],
                      attachControl=[
                          (numCtrlsText, "top", 11, prefixText),
                          (numJntsText, "top", 11, numCtrlsText),
                          (self.numCtrlsField, "top", 5, self.prefixField),
                          (self.numJntsField, "top", 5, self.numCtrlsField),
                          (self.equalCheckbox, "top", 20, self.numJntsField),
                          (self.wireCheckbox, "top", 5, self.equalCheckbox),
                          (self.constrCheckbox, "top", 20, self.numJntsField),
                          (self.fkCheckbox, "top", 5, self.constrCheckbox),
                          (self.prefixField, "right", 15, self.ribbonizeBtn),
                          (self.numCtrlsField, "right", 15, self.ribbonizeBtn),
                          (self.numJntsField, "right", 15, self.ribbonizeBtn),
                      ])
        mc.showWindow(mainWindow)
Пример #60
0
    def show(self):
        """ Build and show the dialog """
        windowTitle = self.getWindowTitle( )

        wnd = cmds.window( resizeToFitChildren=True,
                           title= windowTitle, 
                           minimizeButton=False,
                           maximizeButton=False,
                           retain=False )
        # build widgets
        topFormLayout = cmds.formLayout()
        topColumnLayout = cmds.columnLayout( rowSpacing=10 )

        self.imageNameField = cmds.textFieldButtonGrp( 
            label= maya.stringTable['y_adjustBackgroundImageWin.kImageName' ],
            fileName= "",
            editable= True,
            buttonLabel= maya.stringTable['y_adjustBackgroundImageWin.kLoad2' ],
            buttonCommand= self.onLoadImage,
            changeCommand = self.onImageFieldChange)
        self.adjustImageHPositionSlider = cmds.floatSliderGrp(
            label= maya.stringTable['y_adjustBackgroundImageWin.kHorizontalPosition' ],
            field= True,
            min= 0,
            max= 1000.0,
            precision= 2,
            value= 0,
            dragCommand = self.onAdjustImagePositionHorizontal,
            changeCommand= self.onAdjustImagePositionHorizontal )
        self.adjustImageVPositionSlider = cmds.floatSliderGrp(
            label= maya.stringTable['y_adjustBackgroundImageWin.kVerticalPosition' ],
            field= True,
            min= 0,
            max= 1000.0,
            precision= 2,
            value= 0,
            dragCommand = self.onAdjustImagePositionVertical,
            changeCommand =self.onAdjustImagePositionVertical )
        self.adjustImageScaleSlider = cmds.floatSliderGrp(
            label= maya.stringTable['y_adjustBackgroundImageWin.kScale' ],
            field= True,
            min= 0.1,
            max= 10.0,
            fieldMaxValue= 1000.0,
            precision= 2,
            value=0,
            dragCommand = self.onAdjustImageScale,
            changeCommand = self.onAdjustImageScale )

        cmds.setParent( upLevel=True )

	adjustImageFitToWidthButton = cmds.button(
            label = maya.stringTable['y_adjustBackgroundImageWin.kFitToWidth' ],
            command = self.onFitToWidth )

	adjustImageFitToHeightButton = cmds.button(
            label= maya.stringTable['y_adjustBackgroundImageWin.kFitToHeight' ],
            command= self.onFitToHeight )

	cmds.formLayout( topFormLayout, edit=True,
                         attachForm = [	(topColumnLayout,	'left',	5),
                                        (topColumnLayout,	'top',	5),
                                        (topColumnLayout,	'right',5),
                                        (adjustImageFitToWidthButton, 'left',5),
                                        (adjustImageFitToHeightButton, 'right',5)],
                         attachNone = [	(adjustImageFitToHeightButton,'bottom'),
                                        (topColumnLayout,	'bottom'),
                                        (adjustImageFitToWidthButton,'bottom')],
                         attachControl =[ (adjustImageFitToWidthButton,	'top',	10,topColumnLayout),
                                          (adjustImageFitToHeightButton,'left',5,adjustImageFitToWidthButton),
                                          (adjustImageFitToHeightButton,'top',10,topColumnLayout)],
                         attachPosition = [(adjustImageFitToWidthButton,'right',5,50)] )

	self.update() 
        self.activate( wnd )
        cmds.showWindow( wnd )