Python maya.cmds.text() Examples

The following are 30 code examples for showing how to use maya.cmds.text(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module maya.cmds , or try the search function .

Example 1
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 6 votes vote down vote up
def atualizeSkinFooter(self, *args):
        """ Edit the label of skin footer text.
        """
        try:
            # get the number of selected items for each textScrollLayout:
            nSelectedJoints = cmds.textScrollList( self.allUIs["jntTextScrollLayout"], query=True, numberOfSelectedItems=True)
            nSelectedGeoms  = cmds.textScrollList( self.allUIs["modelsTextScrollLayout"], query=True, numberOfSelectedItems=True)
            
            # verify if there are not any selected items:
            if nSelectedJoints == 0:
                nJointItems = cmds.textScrollList( self.allUIs["jntTextScrollLayout"], query=True, numberOfItems=True)
                if nJointItems != 0:
                    nSelectedJoints = nJointItems
            if nSelectedGeoms == 0:
                nGeomItems = cmds.textScrollList( self.allUIs["modelsTextScrollLayout"], query=True, numberOfItems=True)
                if nGeomItems != 0:
                    nSelectedGeoms = nGeomItems
            
            # edit the footerB text:
            if nSelectedJoints != 0 and nSelectedGeoms != 0:
                cmds.text(self.allUIs["footerBText"], edit=True, label=str(nSelectedJoints)+" "+self.langDic[self.langName]['i025_joints']+" "+str(nSelectedGeoms)+" "+self.langDic[self.langName]['i024_geometries'])
            else:
                cmds.text(self.allUIs["footerBText"], edit=True, label=self.langDic[self.langName]['i029_skinNothing'])
        except:
            pass 
Example 2
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 6 votes vote down vote up
def info(self, title, description, text, align, width, height, *args):
        """ Create a window showing the text info with the description about any module.
        """
        # declaring variables:
        self.info_title       = title
        self.info_description = description
        self.info_text        = text
        self.info_winWidth    = width
        self.info_winHeight   = height
        self.info_align       = align
        # creating Info Window:
        if cmds.window('dpInfoWindow', query=True, exists=True):
            cmds.deleteUI('dpInfoWindow', window=True)
        dpInfoWin = cmds.window('dpInfoWindow', title='dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i013_info']+' - '+self.langDic[self.langName][self.info_title], iconName='dpInfo', widthHeight=(self.info_winWidth, self.info_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        infoColumnLayout = cmds.columnLayout('infoColumnLayout', adjustableColumn=True, columnOffset=['both', 20], parent=dpInfoWin)
        cmds.separator(style='none', height=10, parent=infoColumnLayout)
        infoLayout = cmds.scrollLayout('infoLayout', parent=infoColumnLayout)
        if self.info_description:
            infoDesc = cmds.text(self.langDic[self.langName][self.info_description], align=self.info_align, parent=infoLayout)
        if self.info_text:
            infoText = cmds.text(self.info_text, align=self.info_align, parent=infoLayout)
        # call Info Window:
        cmds.showWindow(dpInfoWin) 
Example 3
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 6 votes vote down vote up
def donateWin(self, *args):
        """ Simple window with links to donate in order to support this free and openSource code via PayPal.
        """
        # declaring variables:
        self.donate_title       = 'dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i167_donate']
        self.donate_description = self.langDic[self.langName]['i168_donateDesc']
        self.donate_winWidth    = 305
        self.donate_winHeight   = 300
        self.donate_align       = "center"
        # creating Donate Window:
        if cmds.window('dpDonateWindow', query=True, exists=True):
            cmds.deleteUI('dpDonateWindow', window=True)
        dpDonateWin = cmds.window('dpDonateWindow', title=self.donate_title, iconName='dpInfo', widthHeight=(self.donate_winWidth, self.donate_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        donateColumnLayout = cmds.columnLayout('donateColumnLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpDonateWin)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        infoDesc = cmds.text(self.donate_description, align=self.donate_align, parent=donateColumnLayout)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        brPaypalButton = cmds.button('brlPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - R$ - Real", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"BRL"), parent=donateColumnLayout)
        #usdPaypalButton = cmds.button('usdPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - USD - Dollar", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"USD"), parent=donateColumnLayout)
        # call Donate Window:
        cmds.showWindow(dpDonateWin) 
Example 4
Project: dpAutoRigSystem   Author: nilouco   File: dpFacialControl.py    License: GNU General Public License v2.0 6 votes vote down vote up
def dpLoadBSNode(self, *args):
        """ Load selected object as blendShapeNode
        """
        selectedList = cmds.ls(selection=True)
        if selectedList:
            if cmds.objectType(selectedList[0]) == "blendShape":
                cmds.textField(self.bsNodeTextField, edit=True, text=selectedList[0])
                self.dpLoadBSTgtList(selectedList[0])
                self.bsNode = selectedList[0]
            elif cmds.objectType(selectedList[0]) == "transform":
                meshList = cmds.listRelatives(selectedList[0], children=True, shapes=True, noIntermediate=True, type="mesh")
                if meshList:
                    bsNodeList = cmds.listConnections(meshList[0], type="blendShape")
                    if bsNodeList:
                        self.dpLoadBSTgtList(bsNodeList[0])
                        self.bsNode = bsNodeList[0]
                    else:
                        mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
                else:
                    mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
            else:
                mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";")
        else:
            mel.eval("warning \""+self.langDic[self.langName]["e018_selectBlendShape"]+"\";") 
Example 5
Project: dpAutoRigSystem   Author: nilouco   File: dpRivet.py    License: GNU General Public License v2.0 6 votes vote down vote up
def dpCreateRivetFromUI(self, *args):
        """ Just collect all information from UI and call the main function to create Rivet setup.
        """
        # getting UI values
        geoToAttach = cmds.textField(self.geoToAttachTF, query=True, text=True)
        uvSet = cmds.textField(self.uvSetTF, query=True, text=True)
        itemList = cmds.textScrollList(self.itemScrollList, query=True, allItems=True)
        attachTranslate = cmds.checkBox(self.attachTCB, query=True, value=True)
        attachRotate = cmds.checkBox(self.attachRCB, query=True, value=True)
        addFatherGrp = cmds.checkBox(self.fatherGrpCB, query=True, value=True)
        addInvert = cmds.checkBox(self.addInvertCB, query=True, value=True)
        invT = cmds.checkBox(self.invertTCB, query=True, value=True)
        invR = cmds.checkBox(self.invertRCB, query=True, value=True)
        
        # call run function to create Rivet setup using UI values
        self.dpCreateRivet(geoToAttach, uvSet, itemList, attachTranslate, attachRotate, addFatherGrp, addInvert, invT, invR, RIVET_GRP, True) 
Example 6
Project: dpAutoRigSystem   Author: nilouco   File: dpRivet.py    License: GNU General Public License v2.0 6 votes vote down vote up
def dpLoadGeoToAttach(self, geoName=None, geoFromUI=None, *args):
        """ Load selected object a geometry to attach rivet.
        """
        if geoName:
            selectedList = [geoName]
        elif geoFromUI:
            selectedList = [cmds.textField(self.geoToAttachTF, query=True, text=True)]
        else:
            selectedList = cmds.ls(selection=True)
        if selectedList:
            if self.dpCheckGeometry(selectedList[0]):
                self.geoToAttach = selectedList[0]
                cmds.textField(self.geoToAttachTF, edit=True, text=self.geoToAttach)
                self.dpLoadUVSet(self.geoToAttach)
        else:
            mel.eval("warning \"Select a geometry in order use it to attach rivets, please.\";") 
Example 7
Project: dpAutoRigSystem   Author: nilouco   File: dpLayoutClass.py    License: GNU General Public License v2.0 6 votes vote down vote up
def loadGeo(self, *args):
        """ Loads the selected node to geoTextField in selectedModuleLayout.
        """
        isGeometry = False
        selList = cmds.ls(selection=True)
        if selList:
            if cmds.objExists(selList[0]):
                childList = cmds.listRelatives(selList[0], children=True, allDescendents=True)
                if childList:
                    for item in childList:
                        itemType = cmds.objectType(item)
                        if itemType == "mesh" or itemType == "nurbsSurface":
                            isGeometry = True
        if isGeometry:
            cmds.textField(self.geoTF, edit=True, text=selList[0])
            cmds.setAttr(self.moduleGrp+".geo", selList[0], type='string') 
Example 8
Project: ml_tools   Author: morganloomis   File: ml_colorControl.py    License: MIT License 6 votes vote down vote up
def colorControlLayout(self, label=''):
        mc.rowLayout( numberOfColumns=4,
                      columnWidth4=(150, 200, 90, 80),
                      adjustableColumn=2,
                      columnAlign=(1, 'right'),
                      columnAttach=[(1, 'both', 0),
                                    (2, 'both', 0),
                                    (3, 'both', 0),
                                    (4, 'both', 0)] )
        mc.text(label=label)
        colorSlider = mc.colorSliderGrp( label='', adj=2, columnWidth=((1,1),(3,1)))
        mc.button(label='From Selected',
                  ann='Get the color of the selected object.',
                  command=partial(self.setFromSelected, colorSlider))
        mc.button(label='Randomize',
                  ann='Set a random color.',
                  command=partial(self.randomizeColors, colorSlider))
        controls = mc.layout(colorSlider, query=True, childArray=True)

        mc.setParent('..')

        return colorSlider 
Example 9
Project: ml_tools   Author: morganloomis   File: ml_softWeights.py    License: MIT License 6 votes vote down vote up
def ui():
    '''
    User interface for ml_softWeights
    '''

    with utl.MlUi('ml_softWeights', 'Soft Weights', width=400, height=180, info='''Set deformer weights based on current soft-selection.
Follow the instructions below for either cluster or skin.
''') as win:

        mc.text(label='Select vertices with soft selection.')
        win.buttonWithPopup(label='Create Cluster', command=softSelectionClusterWeights,
                            annotation='Select a vertex with soft selection to create a cluster.')
        mc.separator(height=20)
        mc.text(label='Select vertices with soft selection, followed by a joint.')
        win.buttonWithPopup(label='Set Joint Weights', command=softSelectionSkinWeights,
                            annotation='Select vertices with soft selection, followed by a joint.') 
Example 10
Project: ml_tools   Author: morganloomis   File: ml_breakdown.py    License: MIT License 6 votes vote down vote up
def quickBreakDownUI():
    winName = 'ml_quickBreakdownWin'
    if mc.window(winName, exists=True):
        mc.deleteUI(winName)

    mc.window(winName, title='ml :: QBD', iconName='Quick Breakdown', width=100, height=500)

    mc.columnLayout(adj=True)

    mc.paneLayout(configuration='vertical2', separatorThickness=1)
    mc.text('<<')
    mc.text('>>')
    mc.setParent('..')

    for v in (10,20,50,80,90,100,110,120,150):
        mc.paneLayout(configuration='vertical2',separatorThickness=1)

        mc.button(label=str(v)+' %', command=partial(weightPrevious,v/100.0))
        mc.button(label=str(v)+' %', command=partial(weightNext,v/100.0))
        mc.setParent('..')

    mc.showWindow(winName)

    mc.window(winName, edit=True, width=100, height=250) 
Example 11
Project: ml_tools   Author: morganloomis   File: ml_utilities.py    License: MIT License 6 votes vote down vote up
def about(self, *args):
        '''
        This pops up a window which shows the revision number of the current script.
        '''

        text='by Morgan Loomis\n\n'
        try:
            __import__(self.module)
            module = sys.modules[self.module]
            text = text+'Revision: '+str(module.__revision__)+'\n'
        except StandardError:
            pass
        try:
            text = text+'ml_utilities Rev: '+str(__revision__)+'\n'
        except StandardError:
            pass

        mc.confirmDialog(title=self.name, message=text, button='Close') 
Example 12
Project: ml_tools   Author: morganloomis   File: ml_utilities.py    License: MIT License 6 votes vote down vote up
def _populateSelectionField(self, channel, field, *args):

        selectedChannels = None
        if channel:
            selectedChannels = getSelectedChannels()
            if not selectedChannels:
                raise RuntimeError('Please select an attribute in the channelBox.')
            if len(selectedChannels) > 1:
                raise RuntimeError('Please select only one attribute.')

        sel = mc.ls(sl=True)
        if not sel:
            raise RuntimeError('Please select a node.')
        if len(sel) > 1:
            raise RuntimeError('Please select only one node.')

        selection = sel[0]
        if selectedChannels:
            selection = selection+'.'+selectedChannels[0]

        mc.textFieldButtonGrp(field, edit=True, text=selection) 
Example 13
Project: ml_tools   Author: morganloomis   File: ml_stopwatch.py    License: MIT License 6 votes vote down vote up
def ui():
    '''
    User interface for stopwatch
    '''

    with utl.MlUi('ml_stopwatch', 'Stopwatch', width=400, height=175, info='''Press the start button to start recording.
Continue pressing to set marks.
When finished, press the stop button and the report will pop up.''') as win:

        mc.checkBoxGrp('ml_stopwatch_round_checkBox',label='Round to nearest frame', value1=True, annotation='Only whole number frames')

        mc.text('ml_stopwatch_countdown_text', label='Ready...')

        mc.button('ml_stopwatch_main_button', label='Start', height=80)
        _setButtonStart()
        mc.button(label='Stop', command=_stopButton, annotation='Stop the recording.') 
Example 14
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpARLoadingWindow():
    """ Just create a Loading window in order to show we are working to user when calling dpAutoRigSystem.
    """
    loadingString = "Loading dpAutoRigSystem v%s ... " %DPAR_VERSION
    print loadingString,
    path = os.path.dirname(__file__)
    randImage = random.randint(0,7)
    clearDPARLoadingWindow()
    cmds.window('dpARLoadWin', title='dpAutoRigSystem', iconName='dpAutoRig', widthHeight=(285, 203), menuBar=False, sizeable=False, minimizeButton=False, maximizeButton=False)
    cmds.columnLayout('dpARLoadLayout')
    cmds.image('loadingImage', image=(path+"/Icons/dp_loading_0%i.png" %randImage), backgroundColor=(0.8, 0.8, 0.8), parent='dpARLoadLayout')
    cmds.text('versionText', label=loadingString, parent='dpARLoadLayout')
    cmds.showWindow('dpARLoadWin') 
Example 15
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 5 votes vote down vote up
def populateJoints(self, *args):
        """ This function is responsable to list all joints or only dpAR joints in the interface in order to use in skinning.
        """
        # get current jointType (all or just dpAutoRig joints):
        jntSelectedRadioButton = cmds.radioCollection(self.allUIs["jntCollection"], query=True, select=True)
        chooseJnt = cmds.radioButton(jntSelectedRadioButton, query=True, annotation=True)
        
        # list joints to be populated:
        jointList, sortedJointList = [], []
        allJointList = cmds.ls(selection=False, type="joint")
        if chooseJnt == "allJoints":
            jointList = allJointList
            cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=False)
            cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=False)
        elif chooseJnt == "dpARJoints":
            cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=True)
            cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=True)
            displayJnt = cmds.checkBox(self.allUIs["_JntCB"], query=True, value=True)
            displayJis = cmds.checkBox(self.allUIs["_JisCB"], query=True, value=True)
            for jointNode in allJointList:
                if cmds.objExists(jointNode+'.'+BASE_NAME+'joint'):
                    if displayJnt:
                        if "_Jnt" in jointNode:
                            jointList.append(jointNode)
                    if displayJis:
                        if "_Jis" in jointNode:
                            jointList.append(jointNode)
        
        # sort joints by name filter:
        jointName = cmds.textField(self.allUIs["jointNameTF"], query=True, text=True)
        if jointList:
            if jointName:
                sortedJointList = utils.filterName(jointName, jointList, " ")
            else:
                sortedJointList = jointList
        
        # populate the list:
        cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, removeAll=True)
        cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, append=sortedJointList)
        # atualize of footerB text:
        self.atualizeSkinFooter() 
Example 16
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 5 votes vote down vote up
def initGuide(self, guideModule, guideDir, rigType=Base.RigType.biped, *args):
        """ Create a guideModuleReference (instance) of a further guideModule that will be rigged (installed).
            Returns the guide instance initialised.
        """
        # creating unique namespace:
        cmds.namespace(setNamespace=":")
        # list all namespaces:
        namespaceList = cmds.namespaceInfo(listOnlyNamespaces=True)
        # check if there is "__" (double undersore) in the namespaces:
        for i in range(len(namespaceList)):
            if namespaceList[i].find("__") != -1:
                # if yes, get the name after the "__":
                namespaceList[i] = namespaceList[i].partition("__")[2]
        # send this result to findLastNumber in order to get the next moduleName +1:
        newSuffix = utils.findLastNumber(namespaceList, BASE_NAME) + 1
        # generate the current moduleName added the next new suffix:
        userSpecName = BASE_NAME + str(newSuffix)
        # especific import command for guides storing theses guides modules in a variable:
        basePath = utils.findEnv("PYTHONPATH", "dpAutoRigSystem")
        self.guide = __import__(basePath+"."+guideDir+"."+guideModule, {}, {}, [guideModule])
        reload(self.guide)
        # get the CLASS_NAME from guideModule:
        guideClass = getattr(self.guide, self.guide.CLASS_NAME)
        # initialize this guideModule as an guide Instance:
        guideInstance = guideClass(self, self.langDic, self.langName, self.presetDic, self.presetName, userSpecName, rigType)
        self.moduleInstancesList.append(guideInstance)
        # edit the footer A text:
        self.allGuidesList.append([guideModule, userSpecName])
        self.modulesToBeRiggedList = utils.getModulesToBeRigged(self.moduleInstancesList)
        cmds.text(self.allUIs["footerAText"], edit=True, label=str(len(self.modulesToBeRiggedList)) +" "+ self.langDic[self.langName]['i005_footerA'])
        return guideInstance 
Example 17
Project: dpAutoRigSystem   Author: nilouco   File: dpAutoRig.py    License: GNU General Public License v2.0 5 votes vote down vote up
def updateWin(self, rawResult, text, *args):
        """ Create a window showing the text info with the description about any module.
        """
        # declaring variables:
        self.update_checkedNumber = rawResult[0]
        self.update_remoteVersion = rawResult[1]
        self.update_remoteLog     = rawResult[2]
        self.update_text          = text
        self.update_winWidth      = 305
        self.update_winHeight     = 300
        # creating Update Window:
        if cmds.window('dpUpdateWindow', query=True, exists=True):
            cmds.deleteUI('dpUpdateWindow', window=True)
        dpUpdateWin = cmds.window('dpUpdateWindow', title='dpAutoRigSystem - '+self.langDic[self.langName]['i089_update'], iconName='dpInfo', widthHeight=(self.update_winWidth, self.update_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        updateLayout = cmds.columnLayout('updateLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpUpdateWin)
        if self.update_text:
            updateDesc = cmds.text("\n"+self.langDic[self.langName][self.update_text], align="center", parent=updateLayout)
            cmds.text("\n"+DPAR_VERSION+self.langDic[self.langName]['i090_currentVersion'], align="left", parent=updateLayout)
        if self.update_remoteVersion:
            cmds.text(self.update_remoteVersion+self.langDic[self.langName]['i091_onlineVersion'], align="left", parent=updateLayout)
            cmds.separator(height=30)
            if self.update_remoteLog:
                remoteLog = self.update_remoteLog.replace("\\n", "\n")
                cmds.text(self.langDic[self.langName]['i171_updateLog']+":\n", align="center", parent=updateLayout)
                cmds.text(remoteLog, align="left", parent=updateLayout)
                cmds.separator(height=30)
            whatsChangedButton = cmds.button('whatsChangedButton', label=self.langDic[self.langName]['i117_whatsChanged'], align="center", command=partial(utils.visitWebSite, DPAR_WHATSCHANGED), parent=updateLayout)
            visiteGitHubButton = cmds.button('visiteGitHubButton', label=self.langDic[self.langName]['i093_gotoWebSite'], align="center", command=partial(utils.visitWebSite, DPAR_GITHUB), parent=updateLayout)
            if (int(cmds.about(version=True)[:4]) < 2019) and platform.system() == "Darwin": #Maya 2018 or older on macOS
                upgradeSSLmacOSButton = cmds.button('upgradeSSLmacOSButton', label=self.langDic[self.langName]['i164_sslMacOS'], align="center", backgroundColor=(0.8, 0.4, 0.4), command=partial(utils.visitWebSite, SSL_MACOS), parent=updateLayout)
            downloadButton = cmds.button('downloadButton', label=self.langDic[self.langName]['i094_downloadUpdate'], align="center", command=partial(self.downloadUpdate, DPAR_MASTERURL, "zip"), parent=updateLayout)
            installButton = cmds.button('installButton', label=self.langDic[self.langName]['i095_installUpdate'], align="center", command=partial(self.installUpdate, DPAR_MASTERURL, self.update_remoteVersion), parent=updateLayout)
        # automatically check for updates:
        cmds.separator(height=30)
        self.autoCheckUpdateCB = cmds.checkBox('autoCheckUpdateCB', label=self.langDic[self.langName]['i092_autoCheckUpdate'], align="left", value=self.userDefAutoCheckUpdate, changeCommand=self.setAutoCheckUpdatePref, parent=updateLayout)
        cmds.separator(height=30)
        # call Update Window:
        cmds.showWindow(dpUpdateWin)
        print self.langDic[self.langName][self.update_text] 
Example 18
Project: dpAutoRigSystem   Author: nilouco   File: dpTranslator.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpTranslatorSame(self, *args):
        """ Get the text from source scrollField in order to use it as a translated text.
        """
        # get info from source scrollField:
        if self.langIndex <= self.keyLen:
            self.newLangList[self.langIndex] = cmds.scrollField(self.sourceTextSF, query=True, text=True)
            self.dpTranslatorForward() 
Example 19
Project: dpAutoRigSystem   Author: nilouco   File: dpTranslator.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpTranslatorForward(self, *args):
        """ Move index forward and update UI in order to get a new translated sentence.
        """
        # if finished keyLen then disable Same and Next buttons and enable Finish button
        if self.langIndex >= self.keyLen:
            cmds.button(self.sameBT, edit=True, enable=False, backgroundColor=(0.8, 0.8, 0.8))
            cmds.button(self.nextBT, edit=True, enable=False, backgroundColor=(0.8, 0.8, 0.8))
            cmds.button(self.finishBT, edit=True, enable=True, backgroundColor=(0.1, 0.9, 1.0))
        else:
            cmds.button(self.backBT, edit=True, enable=True, backgroundColor=(0.3, 0.7, 0.8))
            # pass to next index to get a new translated text from user:
            self.langIndex += 1
            self.dpTranslatorUpdateUI() 
Example 20
Project: dpAutoRigSystem   Author: nilouco   File: dpTranslator.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpGetUserInfoUI(self, *args):
        """ First window UI to get the basic user info for sentence ids starting with "_".
        """
        self.dpClearTranslatorUI(1)
        # starting window:
        dpARTranslatorWin1 = cmds.window('dpARTranslatorWin1', title=self.translatorString, iconName='dpAutoRig', widthHeight=(500, 180), menuBar=False, sizeable=True, minimizeButton=True, maximizeButton=True)
        dpARTranslatorLayout1 = cmds.columnLayout('dpARTranslatorLayout1', adjustableColumn=True, columnOffset=('both', 10), rowSpacing=10, parent=dpARTranslatorWin1)
        cmds.separator(style='none', parent=dpARTranslatorLayout1)
        self.authorTFG = cmds.textFieldGrp('authorTFG', label=self.langDic[self.langName]['t002_yourName'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1)
        self.emailTFG = cmds.textFieldGrp('emailTFG', label=self.langDic[self.langName]['t003_emailContact'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1)
        self.websiteTFG = cmds.textFieldGrp('websiteTFG', label=self.langDic[self.langName]['t004_websiteContact'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1)
        self.newLanguageTFG = cmds.textFieldGrp('newLanguageTFG', label=self.langDic[self.langName]['t005_langName'], text='', adjustableColumn2=1, parent=dpARTranslatorLayout1)
        cmds.button('startTranslationBT', label=self.langDic[self.langName]['t006_startTranslator'], command=self.dpCollectUserInfo, parent=dpARTranslatorLayout1)
        # show UI:
        cmds.showWindow(dpARTranslatorWin1) 
Example 21
Project: dpAutoRigSystem   Author: nilouco   File: dpTargetMirror.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpLoadOriginalModel(self, *args):
        """ Load selected object as original model
        """
        selectedList = cmds.ls(selection=True)
        if selectedList:
            if self.dpCheckGeometry(selectedList[0]):
                cmds.textField(self.originalModelTextField, edit=True, text=selectedList[0])
        else:
            print "Original Model > None" 
Example 22
Project: dpAutoRigSystem   Author: nilouco   File: dpTargetMirror.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpChangeRename(self, value, *args):
        """ Enable or disable text fields
        """
        cmds.text(self.fromTxt, edit=True, enable=value)
        cmds.text(self.toTxt, edit=True, enable=value)
        cmds.textField(self.fromNameTF, edit=True, enable=value)
        cmds.textField(self.toNameTF, edit=True, enable=value) 
Example 23
Project: dpAutoRigSystem   Author: nilouco   File: dpFacialControl.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpChangeConnectCB(self, *args):
        """ Set values enable or disable when the user change the connect check box for Facial BlendShapes.
        """
        # get
        cbValue = cmds.checkBox(self.connectCB, query=True, value=True)
        # set
        cmds.button(self.loadBSButton, edit=True, enable=cbValue)
        cmds.textField(self.bsNodeTextField, edit=True, text="", enable=cbValue)
        cmds.text(self.bsTgtListTxt, edit=True, enable=cbValue)
        cmds.textScrollList(self.bsTargetScrollList, edit=True, removeAll=True, enable=cbValue) 
Example 24
Project: dpAutoRigSystem   Author: nilouco   File: dpFacialControl.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpChangeConnectFJ(self, *args):
        """ Set values enable or disable when the user change the connect check box for Facial Joints.
        """
        # get
        cbValue = cmds.checkBox(self.connectFJ, query=True, value=True)
        # set
        cmds.text(self.jntTgtListTxt, edit=True, enable=cbValue)
        cmds.textScrollList(self.jntTargetScrollList, edit=True, removeAll=True, enable=cbValue)
        if cbValue:
            # reload all joint target:
            self.dpLoadJointNode(self.tweaksNameList) 
Example 25
Project: dpAutoRigSystem   Author: nilouco   File: dpRivet.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpLoadUVSet(self, item, *args):
        """ Verify the UV sets for polygon mesh and show a dialog box in order to choose if there are more than one UVSet map.
        """
        if self.itemType == "mesh":
            uvSetList = cmds.polyUVSet(self.geoToAttach, query=True, allUVSets=True)
            self.selectedUVSet = uvSetList[0]
            if len(uvSetList) > 1:
                self.dpSelectUVSetWin(uvSetList)
            cmds.textField(self.uvSetTF, edit=True, text=self.selectedUVSet)
        elif self.itemType == "nurbsSurface":
            cmds.textField(self.uvSetTF, edit=True, text="nurbsSurface") 
Example 26
Project: dpAutoRigSystem   Author: nilouco   File: sqStickyLipsSetup.py    License: GNU General Public License v2.0 5 votes vote down vote up
def dpMain(self, *args):
        self.edgeList = []
        self.baseCurve = []
        self.baseCurveA = []
        self.baseCurveB = []
        self.mainCurveA = []
        self.mainCurveB = []
        self.curveLenght = 0
        self.maxIter = 0
        self.clusterList = []
        self.receptList = []
        self.optionCtrl = "Option_Ctrl"
        self.wireNodeList = []
        
        if cmds.window('sqStickyLipsWindow', query=True, exists=True):
            cmds.deleteUI('sqStickyLipsWindow', window=True)
        cmds.window('sqStickyLipsWindow', title='sqStickyLips - v'+str(SQSL_VERSION)+' - UI', widthHeight=(300, 200), menuBar=False, sizeable=False, minimizeButton=True, maximizeButton=False)
        cmds.showWindow('sqStickyLipsWindow')
        
        slLayoutColumn = cmds.columnLayout('slLayoutColumn', adjustableColumn=True)
        cmds.text("Load meshes:", align="left", parent=slLayoutColumn)
        slLayoutA = cmds.rowColumnLayout('slLayoutA', numberOfColumns=2, columnWidth=[(1, 100), (2, 160)], parent=slLayoutColumn)
        cmds.button(label="Recept A >>", command=partial(self.sqSLLoad, "A"), parent=slLayoutA)
        self.receptA_TF = cmds.textField(parent=slLayoutA)
        cmds.button(label="Recept B >>", command=partial(self.sqSLLoad, "B"), parent=slLayoutA)
        self.receptB_TF = cmds.textField(parent=slLayoutA)
        cmds.text("Select a closed edgeLoop and press the run button", parent=slLayoutColumn)
        cmds.button(label="RUN - Generate Sticky Lips", command=self.sqGenerateStickyLips, backgroundColor=[0.3, 1, 0.7], parent=slLayoutColumn) 
Example 27
Project: dpAutoRigSystem   Author: nilouco   File: sqStickyLipsSetup.py    License: GNU General Public License v2.0 5 votes vote down vote up
def sqGetRecepts(self, receptA=None, receptB=None, *args):
        self.receptList = []
        self.receptList.append(receptA)
        self.receptList.append(receptB)
        if receptA == None:
            receptAName = cmds.textField(self.receptA_TF, query=True, text=True)
            if cmds.objExists(receptAName):
                self.receptList[0] = receptAName
        if receptB == None:
            receptBName = cmds.textField(self.receptB_TF, query=True, text=True)
            if cmds.objExists(receptBName):
                self.receptList[1] = receptBName 
Example 28
Project: dpAutoRigSystem   Author: nilouco   File: dpBaseClass.py    License: GNU General Public License v2.0 5 votes vote down vote up
def deleteModule(self, *args):
        """ Delete the Guide, ModuleLayout and Namespace.
        """
        # delete mirror preview:
        try:
            cmds.delete(self.moduleGrp[:self.moduleGrp.find(":")]+"_MirrorGrp")
        except:
            pass
        # delete the guide module:
        utils.clearNodeGrp(nodeGrpName=self.moduleGrp, attrFind='guideBase', unparent=True)
        # clear default 'dpAR_GuideMirror_Grp':
        utils.clearNodeGrp()
        # remove the namespaces:
        allNamespaceList = cmds.namespaceInfo(listOnlyNamespaces=True)
        if self.guideNamespace in allNamespaceList:
            cmds.namespace(moveNamespace=(self.guideNamespace, ':'), force=True)
            cmds.namespace(removeNamespace=self.guideNamespace, force=True)
        try:
            # delete the moduleFrameLayout from window UI:
            cmds.deleteUI(self.moduleFrameLayout)
            self.clearSelectedModuleLayout()
            # edit the footer A text:
            self.currentText = cmds.text("footerAText", query=True, label=True)
            cmds.text("footerAText", edit=True, label=str(int(self.currentText[:self.currentText.find(" ")]) - 1) +" "+ self.langDic[self.langName]['i005_footerA'])
        except:
            pass
        # clear module from instance list (clean dpUI list):
        delIndex = self.dpUIinst.moduleInstancesList.index(self)
        self.dpUIinst.moduleInstancesList.pop(delIndex) 
Example 29
Project: spore   Author: wiremas   File: AEsporeNodeTemplate.py    License: MIT License 5 votes vote down vote up
def add_instance_list(self, *args):
        """ builde the instance list layout """

        instanced_geo = node_utils.get_instanced_geo(self._node)
        if instanced_geo:
            instanced_geo = ['[{}]: {}'.format(i, name) for i, name in enumerate(instanced_geo)]

        form = cmds.formLayout()
        help_lbl = cmds.text(l='Select item(s) to specify an index',
                             align='left')
        scroll_list = cmds.textScrollList('instanceList', ams=True,
                                          append=instanced_geo)
        add_btn = cmds.symbolButton('addInstanceBtn', width=30, i='setEdAddCmd.png',
                                    c=pm.Callback(self.add_instance),
                                    ann='Add Selected Object')
        rm_btn = cmds.symbolButton('removeInstanceBtn', width=30,
                                   i='setEdRemoveCmd.png',
                                   c=pm.Callback(self.remove_instance),
                                   ann='Remove Selected Objects')
        instancer_btn = cmds.symbolButton('instancerBtn', width=30, i='info.png',
                                          c=pm.Callback(self.select_instancer),
                                          ann='Highlight Instancer')

        cmds.formLayout(form, e=True, height=115,
                        attachForm=[(help_lbl, 'left', 2),
                                    (help_lbl, 'right', 2),
                                    (help_lbl, 'top', 0),
                                    (add_btn, 'right', 2),
                                    (add_btn, 'top', 17),
                                    (rm_btn, 'top', 45),
                                    (rm_btn, 'right', 2),
                                    (instancer_btn, 'right', 2),
                                    (instancer_btn, 'bottom', 2),
                                    (scroll_list, 'right', 35),
                                    (scroll_list, 'top', 17),
                                    (scroll_list, 'left', 2),
                                    (scroll_list, 'bottom', 2)]) 
Example 30
Project: spore   Author: wiremas   File: AEsporeNodeTemplate.py    License: MIT License 5 votes vote down vote up
def add_brush_btn(self, attr):
        """ replace the default combobox with a button for each entry """

        cmds.rowLayout('instanceLayout', nc=8 ) #, adjustableColumn=6) #, w=270 ) #, columnWidth3=(80, 75, 150),  columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
        cmds.text(l='Tool', align='right', w=145)
        cmds.button('placeBtn', l='Place', c=pm.Callback(self.activateContext, 'place', attr, 0))
        cmds.button('sprayBtn', l='Spray', c=pm.Callback(self.activateContext, 'spray', attr, 1))
        cmds.button('scaleBtn', l='Scale', c=pm.Callback(self.activateContext, 'scale', attr, 2))
        cmds.button('alignBtn', l='Align', c=pm.Callback(self.activateContext, 'align', attr, 3))
        cmds.button('moveBtn', l='Move', c=pm.Callback(self.activateContext, 'move', attr, 4))
        cmds.button('idBtn', l='Id', c=pm.Callback(self.activateContext, 'id', attr, 5))
        cmds.button('removeBtn', l='Remove', c=pm.Callback(self.activateContext, 'remove', attr, 6))
        cmds.setParent('..')