示例#1
0
文件: modMgr.py 项目: Narinyir/mGui
 def _save(self, *arg, **kwargs):
     for v in self.ModMgr.Modules.values():
         if v.enabled:
             self.ModMgr.enable(v)
         if not v.enabled:
             self.ModMgr.disable(v)
     cmds.layoutDialog(dismiss="OK")
示例#2
0
def __createAsset_stage(*arg):

    n = mc.textField("tf_assetName_FRW", q=True, tx=True).strip()
    if not n:
        mc.confirmDialog(t=" ", m="Incorrect asset name.", b="ok")
        return
    rt = mc.optionMenu("om_rigType_FRW", q=True, v=True)
    at = mc.optionMenu("om_assetType_FRW", q=True, v=True)
    f = STAGING_DIR + at + "/" + n + "/" + n + ".py"
    if os.path.isfile(f):
        result = mc.confirmDialog(
            t="overwrite existing asset",
            m=
            "Asset with this name already exists. Do you want to overwrite it ?",
            b=["yes", "no"],
            cb="no",
            ds="no",
            db="no")
        if result == "no": return
    createAsset(rt, at, n)
    mc.layoutDialog(dis="cancel")
    __update()
    mc.textScrollList("tsl_type_FRW", e=True, si=at)
    __updateNames()
    mc.textScrollList("tsl_name_FRW", e=True, si=n)
    __update()
    def takePictureProcess(self, *args):
        global screenShotPanelVar
        #get asset name from main textScrollList
        assetNameVar=cmds.textScrollList('assetTextScroll',q=True,si=True)
        if assetNameVar==None:
            cmds.confirmDialog(icn='warning', t='Error', m='No asset selected from asset list.', button=['Ok'])
            raise StandardError, 'error : no asset selected from asset list'
        assetNameVar=assetNameVar[0]

        #determin asset type based on assetName Var
        assetTypeVar=''
        for chk in veRegCore.listAssetTable():
            if chk[1]==str(assetNameVar):
                assetTypeVar=chk[2]
        if assetTypeVar=='':
            cmds.confirmDialog(icn='warning', t='Error', m='Cannot find record for '+str(assetNameVar)+'!',\
                               button=['Ok'])
            raise ValueError, 'error : database anomaly record non exists'

        #image exporting instruction
        cmds.select(cl=True)
        cmds.setFocus(screenShotPanelVar)
        modelsPanelVar=apiUI.M3dView.active3dView()
        imageVar=api.MImage()
        modelsPanelVar.readColorBuffer(imageVar, True)
        imageVar.writeToFile(assetRootVar+'/'+assetTypeVar+'/'+assetNameVar+'/preview.png','png')

        #clear preview taking window
        cmds.layoutDialog(dismiss='SET AS PREVIEW')

        #refresh
        self.listLegacyAndPicture()
        return
示例#4
0
	def copy_To_Minor(self):
		'''
		this is engine. Where all functions get called in a manner.
		'''
		shNm = ""
		if (self.authenticatesql(self.host, self.user, self.pwss, self.dbnm) == 1):		# make connection to database
			if	(self.isfileNameEmpty() == 1):													# file name not present
#				self.ask_user_for_project_shot_other_details_once_then_save_file_in_format()
				print cmds.layoutDialog(ui=self.ask_user_for_project_shot_other_details_once_then_save_file_in_format)
			# extract shot name from file
			prjNm = cmds.file(query=True,shn=True,sn=True).split("_")[0]
			prjType = self.returnProjectType(prjNm)
			if not (prjType == "long"):
				shNm = cmds.file(query=True,shn=True,sn=True).split("_")[1]
			else:
				shNm = cmds.file(query=True,shn=True,sn=True).split("_")[2]

			self.minorFolderName = cmds.workspace(query=1,act=1) + "/scenes/" + shNm  + "/minor/"
			if not os.path.isdir(self.minorFolderName):
				os.mkdir(self.minorFolderName)
			print 'self.minorFolderName',self.minorFolderName,'\n'
			if	(self.isfileNameConventionPresent(self.returnFileName()) == 1):				# file name convention not existing
				message = ("\n" + (self.underscore*40) + "\n\tValid format :\n%s for a movie \nor\n%s for a commercial \nUse save to change to above matching format " + "\n" + (self.underscore*40)) % (self.fileformat_1 ,self.fileformat_2 )
				print message
			elif (self.is_folder_structure_proper(self.minorFolderName) == 1):
				message = "Check Folder structure. Save File in folder %s " % (self.minorFolderName)
				print message
			else:
				self.saveFileName(self.minorFolderName,self.ffilename)
				self.send_path_to_table(platform.node(),self.minorFolderName)
		else:
			message = "connection not made. connect to admin "
			print message
示例#5
0
def checkRefExist(*arg):
    #cmds.scriptEditorInfo(clearHistory=True)
    referencePathSet = []
    unExistRefPathSet = []
    referencePathSet = cmds.file(query=True, list=True)
    #print referencePathSet
    for i in referencePathSet:
        #判断文件路径是否存在
        #print i
        referenceExist = cmds.file(i, query=True, exists=True)
        if not referenceExist:
            #不存在的路径文件存放于此数组
            unExistRefPathSet.append(i)

    #检查数组是否存在路径,如没有表示祝贺,如有打印所有路径
    if len(unExistRefPathSet) == 0:
        cmds.layoutDialog(
            t='Prompt',
            ui="PromptWindow('Info','Great! The system files are complete.')")
        separator_delimiter()
    else:
        pathSel = ''
        for i in range(len(unExistRefPathSet)):
            pathSel = pathSel + unExistRefPathSet[i] + '\\n'
        print pathSel
        cmds.layoutDialog(
            t='Prompt',
            ui=
            "PromptWindow('These reference file does not exist and please check paths:','%s')"
            % pathSel)
        separator_delimiter()
示例#6
0
def cheakMat(type, selName, sentance1, sentance2):
    cmds.scriptEditorInfo(clearHistory=True)
    shadingGrps = []
    shadingGrps = model_mat_Relationship(type)
    #print shadingGrps
    #如有丢失材质球
    if len(shadingGrps) > 0:
        #判断是否存在对应的集合 missMatSel/multimatSel
        existSel = cmds.ls(selName, type="objectSet")
        #如不存在,创建集合并加入集合
        if len(existSel) == 0:
            cmds.select(shadingGrps)
            createSet = cmds.sets(name=selName)
        #如存在添加到集合
        if len(existSel) != 0:
            cmds.sets(shadingGrps, add=selName)
        cmds.select(cl=1)
        cmds.select(shadingGrps)
        print sentance1
        separator_delimiter()
        cmds.layoutDialog(t='Prompt',
                          ui="PromptWindow('Check Finished.','%s')" %
                          sentance1)
    else:
        cmds.select(cl=1)
        print sentance2
        separator_delimiter()
        cmds.layoutDialog(t='Prompt',
                          ui="PromptWindow('Check Finished.','%s')" %
                          sentance2)
示例#7
0
def checkFaceNum(*arg):
    noFace = []
    faceMore4 = []
    selcetPoly()
    ploygon = cmds.ls(sl=1)
    #print ploygon
    for i in ploygon:
        cmds.select(cl=1)
        cmds.select(i)
        # 顶点数和三角面数的查询
        count = cmds.polyEvaluate()
        triangleCount = count['triangle']
        vertexCount = count['vertex']

        #如三角面数等于0或者顶点数小于等于2,则加入数组
        if triangleCount == 0 or vertexCount <= 2:
            noFace.append(i)

    if len(noFace) > 0:
        #print noFace
        cmds.select(noFace)
        cmds.layoutDialog(
            t='Prompt',
            ui=
            ("PromptWindow('Check Finished','Selected models with problems,Please Cheak!')"
             ))
    else:
        cmds.select(cl=1)
        cmds.scriptEditorInfo(clearHistory=True)
        #cmds.inViewMessage( amg='所有模型 <hl>正常</hl>.', pos='midCenter', fade=True )
        cmds.layoutDialog(
            t='Prompt',
            ui=("PromptWindow('Check Finished','All models are normal.')"))
        print 'All models are normal.'
        separator_delimiter()
示例#8
0
    def getProject(cls, **kwargs):
        projects = []
        for prj in cls.instance().data:
            projects.append(prj['name'])

        if "all" in kwargs and kwargs["all"]:
            return projects
        elif "prompt" in kwargs and kwargs["prompt"] and projects:
            currentPrj = cmds.layoutDialog(ui=cls.__prompt__)
            for project in projects:
                if project == currentPrj:
                    cls.setProject(currentPrj)
                    return currentPrj
            return cmds.optionVar(q="PutaoTools_Project")
        else:
            currentPrj = cmds.optionVar(q="PutaoTools_Project")
            if (not currentPrj) and projects:
                currentPrj = cmds.layoutDialog(ui=cls.__prompt__)
                for project in projects:
                    if project == currentPrj:
                        cls.setProject(currentPrj)
                        return currentPrj
            else:
                for project in projects:
                    if project == currentPrj: return project
            return u""
示例#9
0
文件: modMgr.py 项目: alfsici/mGui
 def _save(self, *args, **kwargs):
     for v in self._manager.modules.values():
         if v.enabled:
             self._manager.enable(v)
         else:
             self._manager.disable(v)
     cmds.layoutDialog(dismiss="OK")
示例#10
0
文件: modMgr.py 项目: bob-white/mGui
 def _save(self, *args, **kwargs):
     for v in self._manager.modules.values():
         if v.enabled:
             self._manager.enable(v)
         else:
             self._manager.disable(v)
     cmds.layoutDialog(dismiss="OK")
示例#11
0
 def cancelUI(self, *args):
     self.dict["note"] = "__CANCEL__"
     self.dict["cam"] = cmds.checkBoxGrp(self.cam, q=True, v1=True)
     self.dict["shd"] = cmds.checkBoxGrp(self.shd, q=True, v1=True)
     # self.dict["rig"] = cmds.checkBoxGrp(self.rig, q=True, v1=True)
     # self.dict["freeze"] = cmds.checkBoxGrp(self.freeze, q=True, v1=True)
     cmds.layoutDialog(dismiss="cancel")
示例#12
0
 def dismissUI(self, *args):
     self.dict["note"] = cmds.scrollField(self.txt, q=True, tx=True)
     self.dict["cam"] = cmds.checkBoxGrp(self.cam, q=True, v1=True)
     self.dict["shd"] = cmds.checkBoxGrp(self.shd, q=True, v1=True)
     self.dict["rig"] = cmds.checkBoxGrp(self.rig, q=True, v1=True)
     self.dict["light"] = cmds.checkBoxGrp(self.light, q=True, v1=True)
     self.dict["freeze"] = cmds.checkBoxGrp(self.freeze, q=True, v1=True)
     cmds.layoutDialog(dismiss="got it")
示例#13
0
 def _close_parent_window(self):
     """helper routine closing the parent window if there is one"""
     p = self.parent()
     if isinstance(p, ui.Window):
         # If its not deferred, it will crash maya for some reason, maybe
         # something related to garbage collection.
         mutil.executeDeferred(self.parent().delete)
     elif isinstance(p, ui.FormLayout) and p.startswith("layoutDialog"):
         cmds.layoutDialog(dismiss="close")
示例#14
0
    def helpPromptButton(self, *args, **kwargs):
        '''Help dialog'''
        def helpFormUI():
            form = cmds.setParent(q=True)
            cmds.formLayout(form, e=True, width=300)
            t1 = cmds.text(l='Joint Orient Tool',
                           fn='boldLabelFont',
                           bgc=[0.2, 0.2, 0.2])
            t2 = cmds.text(
                l='This tool allows you to orient joints using a helper object to set the up vector, \nand optionally a contruction plane to snap your helper to. The workflow is:'
            )
            t3 = cmds.text(
                align='left',
                l='1) Axes: pick desired axes for down direction and up direction.\n   "Down" is the joint axis that will point at its child.\n   "Up" is the joint axis that will point at the "up object".'
            )
            t4 = cmds.text(
                align='left',
                l='2) Up Object: Create and position an "up object" (like a locator) where you want,\n    and enter its name into this box. Use "<<<<" to grab current selection.'
            )
            t5 = cmds.text(
                align='left',
                l='3) Select root of chain you wish to align and hit the "Orient Joint Chain" button.\n    This aligns the selected joint and all child joints until it hits a joint with more than 1 child.\n    I work by unparenting my joint chains as needed, orienting them, then reparenting.'
            )
            t6 = cmds.text(align='left', l='Helpers', bgc=[0.2, 0.2, 0.2])
            t7 = cmds.text(
                align='left',
                l='Make Plane: Lets you select any three objects then push "Make Plane" to create a live helper grid.\n    For example grabbing the three joints of an arm and running this will make a grid on the "plane" of that arm.\n    You can then snap joints or your up object to this grid if needed.\n    "Size" adjusts the grid size. Delete button makes plane not "live" and deletes.'
            )
            t8 = cmds.text(
                align='left',
                l='Tweak Joint: Makes a locator at the selected joint that you can rotate to directly manipulate joint orient.\n    When you are done simply delete locator.'
            )
            spacer = 8
            top = 5
            edge = 5
            cmds.formLayout(
                form,
                edit=True,
                attachForm=[(t1, 'top', top), (t1, 'left', edge),
                            (t1, 'right', edge), (t2, 'left', edge),
                            (t2, 'right', edge), (t3, 'left', edge),
                            (t3, 'right', edge), (t4, 'left', edge),
                            (t4, 'right', edge), (t5, 'left', edge),
                            (t5, 'right', edge), (t6, 'left', edge),
                            (t6, 'right', edge), (t7, 'left', edge),
                            (t7, 'right', edge), (t8, 'left', edge),
                            (t8, 'right', edge)],
                attachNone=[(t8, 'bottom')],
                attachControl=[
                    (t2, 'top', spacer, t1), (t3, 'top', spacer, t2),
                    (t4, 'top', spacer, t3), (t5, 'top', spacer, t4),
                    (t6, 'top', spacer, t5), (t7, 'top', spacer, t6),
                    (t8, 'top', spacer, t7)
                ],
            )

        cmds.layoutDialog(ui=helpFormUI)
 def viewLog(self,*args):
     #validate asset selection
     assetSelection=cmds.textScrollList('assetTextScroll',q=True,si=True)
     if assetSelection==None:
         cmds.confirmDialog(icn='warning',t='Error',message='No asset Selected',button=['OK'])
     else:
         assetSelection=assetSelection[0]
         cmds.layoutDialog(ui=lambda*args:self.viewLogUI(assetSelection),t='Log View')
     return
示例#16
0
def findExistTexMsg(sel, sen):
    if len(sel) > 0:
        fileNodeSel = ''
        for i in range(len(sel)):
            print sen, sel[i]
            fileNodeSel = fileNodeSel + sel[i] + '\\n'
        separator_delimiter()
        cmds.layoutDialog(t='Prompt',
                          ui="PromptWindow('%s','%s')" % (sen, fileNodeSel))
示例#17
0
 def camera_dialog_ok(cls):
     selection = cmds.textScrollList(cls.camera_tsl,
                                     q=True,
                                     selectItem=True)
     if not selection:
         camera = ""
     else:
         camera = selection[0]
     cmds.layoutDialog(dismiss=camera)
    def uploadAsset(self,*args):
        #get asset name
        assetNameVar=cmds.textScrollList('assetTextScroll',q=True,si=True)
        if assetNameVar==None:
            cmds.confirmDialog(icn='warning', t='Error', m='No asset selected from asset list.', button=['Ok'])
            raise StandardError, 'error : no asset selected from asset list'
        assetNameVar=assetNameVar[0]

        #get asset type
        assetTypeVar=''
        for chk in veRegCore.listAssetTable():
            if chk[1]==str(assetNameVar):assetTypeVar=chk[2]
        if assetTypeVar=='':
            cmds.confirmDialog(icn='warning', t='Error', m='Cannot find record for '+str(assetNameVar)+'!',\
                               button=['Ok'])
            raise ValueError, 'error : database anomaly record non exists'

        #get asset mode
        repVar=cmds.confirmDialog(icn='question', t='Save As', m='This will upload current asset to server. Select asset stage.',\
                                  button=['MODEL','SHADER','RIG','CANCEL'])

        #uploading instruction
        if repVar!='CANCEL':
            if repVar=='MODEL':
                mode=0
            elif repVar=='SHADER':
                mode=1
            elif repVar=='RIG':
                mode=2

            if mode==0:
                mode='model'
            elif mode==1:
                mode='shader'
            elif mode==2:
                mode='rig'

            if assetTypeVar=='CHAR':
                assetTypeVar=0
            elif assetTypeVar=='PROP':
                assetTypeVar=1
            elif assetTypeVar=='SETS':
                assetTypeVar=2

            try:
                veRegCore.uploadAsset(name=assetNameVar,assetType=assetTypeVar,assetTarget=mode)
                cmds.confirmDialog(icn='information', t='Done', m='Asset uploaded.', button=['Ok'])
            except Exception as e:
                cmds.confirmDialog(icn='warning', t='Error', m=str(e), button=['Ok'])
                raise StandardError, str(e)

            cmds.layoutDialog(ui=self.takePicture)

        #refresh
        self.listLegacyAndPicture()
        return
示例#19
0
    def onDismissButton(self, data, msg):
        # Same comment for data argument as for onPathBrowse() method.

        # Copy widget data.
        self.path = cmds.textFieldGrp(self._pathWidget, query=True, text=True)
        self.name = cmds.textFieldGrp(self._nameWidget, query=True, text=True)
        self.transformConnection = cmds.optionMenuGrp(
            self._transformConnectionWidget, query=True, value=True)

        cmds.layoutDialog(dismiss=msg)
示例#20
0
    def captureImage(self, name, directory=DIRECTORY, *args):
        if not os.path.exists(directory):
            os.mkdir(directory)

        path = os.path.join(directory, '%s' % name)
        w = RESX
        h = RESY
        currentTime = cmds.currentTime(query=True)
        cmds.playblast(v=False, frame=currentTime, wh=(w, h), p=100, orn=False, fmt="image", filename=path)
        cmds.layoutDialog(dismiss="1")
示例#21
0
    def setLocation(self, *args):

        # Get data for the selected location.
        data = self.getSelectedLocationData()

        # Update current location data.
        self.selector.setCurrentLocation(data[0], data[1], data[2])

        # Close the search dialog.
        cmds.layoutDialog(dismiss=True)
示例#22
0
	def assignNewColor(self, *args):
		colorMat = mc.textFieldGrp( 'customColorTextField', q = 1, tx = 1 )
		col = mc.colorSliderGrp( 'customColorColorSlider', q = 1, rgb = 1 )
		alph = mc.checkBox( 'customAlpha_chb', q = True, v = True )
		col.append( alph )
		mc.layoutDialog( dismiss="Cancel" )
		if mc.objExists( colorMat ):
			res = mc.confirmDialog( title='Confirm', message='There is a shader with this name, do you want to use it?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
			if res == 'Yes':
				self.createAssignColor( [colorMat, col] ) #ASSIGN COLOR
			else:
				self.assignCustomColorUI( [colorMat, col] ) #GO BACK TO SELECT COLOR
		else:
			self.createAssignColor( [colorMat, col] ) #ASSIGN COLOR
示例#23
0
def checkTexExist(*arg):
    #根据file节点查找贴图是否为空
    imageFiles = cmds.ls(type='file')
    if len(imageFiles) > 0:
        #创建一个集合,把丢失贴图的图片file节点放在里面
        #没有路径的节点
        undefinedPathSel = []
        #文件不存在的节点
        nonExistLocal = []
        #文件不存在于sourceimages文件夹中
        nonExistSourceiamges = []
        for i in imageFiles:
            #获取每个节点文件路径
            fileTexturePath = cmds.getAttr(i + '.fileTextureName')
            #判断文件路径是否存在
            exist = cmds.file(fileTexturePath, query=True, exists=True)
            #这个路径为空,则加载入undefinedPathSel
            if fileTexturePath == '':
                undefinedPathSel.append(i)
            #如果这个路径的文件不存在本地则加入
            elif not exist:
                nonExistLocal.append(i)
            #如果文件路径不存在sourceImages文件夹则放入nonExistSourceiamges
            elif not ('sourceimages' in fileTexturePath):
                nonExistSourceiamges.append(i)

        if len(undefinedPathSel) > 0:
            findExistTexMsg(undefinedPathSel, u'此节点丢失贴图:')
        if len(nonExistLocal) > 0:
            findExistTexMsg(nonExistLocal, u'此节点贴图已丢失不存在:')
        if len(nonExistSourceiamges) > 0:
            findExistTexMsg(nonExistSourceiamges, u'此节点贴图不存在sourceimage路径下:')
        #如果都没有节点,证明材质贴图没有问题
        if len(undefinedPathSel) == 0 and len(nonExistLocal) == 0 and len(
                nonExistSourceiamges) == 0:
            cmds.scriptEditorInfo(clearHistory=True)
            print 'Check finished. The file texture mapping status is normal.'
            cmds.layoutDialog(
                t='Prompt',
                ui=
                "PromptWindow('Check Finished','All file texture mapping status is normal.')"
            )
            separator_delimiter()
    else:
        #Prompt('No texture file in scene.')
        cmds.layoutDialog(
            t='Prompt',
            ui="PromptWindow('Check Finished','No texture file in scene.')")
        separator_delimiter()
示例#24
0
def _create_registered_asset():
    while True:
        result = cmds.layoutDialog(ui=_asset_naming_dialog).strip()
        if not result or result == "dismiss":
            return "", ""
        else:
            return result.split(".")
示例#25
0
def _addEyeDialog(rbsNode):
	form = cmds.setParent(q=True)
	
	# used prefixes
	idxPrfxList = _getEyeIdxPrfxList(rbsNode)
	prfxList = [s[1] for s in idxPrfxList]
	
	# available prefixes
	availList = [s for s in _labelList if not s in prfxList]
	
	# preferred prefix
	selPrfx = None
	for prfx in _orderedLabelList:
		if prfx in availList:
			selPrfx = prfx
			break
	
	
	menu = cmds.optionMenu(label='Please choose a name.\nUsually "L" or "R"   ')
	for l in availList:
		cmds.menuItem(label=l)
	if selPrfx:
		cmds.optionMenu(menu, e=True, v=selPrfx)
	
	sep = cmds.separator(style='none')
	b = cmds.button(l='OK', c=lambda *x: cmds.layoutDialog(dismiss=cmds.optionMenu(menu, q=True, v=True)))
	cmds.formLayout(form, e=True, attachForm=[(menu, 'top', 10), (menu, 'left', 10), (menu, 'right', 2), (b, 'bottom', 2), (b, 'left', 2), (b, 'right', 2)], attachControl=[(sep, 'top', 4, menu), (sep, 'bottom', 4, b)])
示例#26
0
    def __prompt__(cls):
        form = cmds.setParent(q=True)
        cmds.formLayout(form, e=True, width=200)
        txt = cmds.text(l=u"请选择当前项目:", height=30)
        btn = cmds.button(l="Confirm",
                          height=30,
                          command=lambda *_: cmds.layoutDialog(
                              dismiss=cmds.optionMenu(mnu, q=True, v=True)))
        mnu = cmds.optionMenu(height=30)
        prjs = cls.getProject(all=True)
        for prj in prjs:
            cmds.menuItem(l=prj, parent=mnu)
        if cmds.optionVar(q="PutaoTools_Project"):
            cmds.optionMenu(mnu,
                            e=True,
                            v=cmds.optionVar(q="PutaoTools_Project"))

        edge = 10

        cmds.formLayout(form,
                        e=True,
                        attachForm=[(txt, 'top', edge), (mnu, 'top', edge),
                                    (txt, 'left', edge), (mnu, 'right', edge),
                                    (btn, 'left', edge), (btn, 'right', edge),
                                    (btn, 'bottom', edge)])
示例#27
0
    def prompt(s, info):
        def openWindow():
            p = cmds.setParent(q=True)
            main = cmds.columnLayout(adj=True, p=p)
            cmds.text(h=30,
                      l=s.i18n["characterRetarget.replaceDialog"],
                      p=main)
            cmds.scrollLayout(cr=True, bgc=[0.2, 0.2, 0.2], h=500, p=main)
            row = cmds.rowLayout(nc=3, adj=2)
            col1 = cmds.columnLayout(adj=True, p=row)
            col2 = cmds.columnLayout(adj=True, p=row)
            col3 = cmds.columnLayout(adj=True, p=row)
            for before, after in info.items():
                cmds.text(l=before, p=col1)
                cmds.text(l=" => ", p=col2)
                cmds.text(l=after, p=col3)
            cmds.rowLayout(nc=3, adj=1, p=main)
            cmds.separator()
            cmds.button(l=s.i18n["yes"].center(30),
                        c="cmds.layoutDialog(dismiss=\"yes\")")
            cmds.button(l=s.i18n["cancel"].center(30),
                        c="cmds.layoutDialog(dismiss=\"cancel\")")

        return True if cmds.layoutDialog(
            ui=openWindow,
            t=s.i18n["characterRetarget.replaceDialog"]) == "yes" else False
示例#28
0
def _mirrorWeightsDialog(rbsNode, destPrfx):
    """Mirror bulge weights dialog box."""

    form = cmds.setParent(q=True)

    # used prefixes
    idxPrfxList = _getEyeIdxPrfxList(rbsNode)
    prfxList = [s[1] for s in idxPrfxList if s[1] != destPrfx]

    menu = cmds.optionMenu(
        label=
        'Mirror bulge weights from\n(the current weights will be destroyed):')
    for l in prfxList:
        cmds.menuItem(label=l)

    cmds.optionMenu(menu, e=True, sl=1)

    sep = cmds.separator(style='none')
    b = cmds.button(l='OK',
                    c=lambda *x: cmds.layoutDialog(dismiss=cmds.optionMenu(
                        menu, q=True, v=True)))
    cmds.formLayout(form,
                    e=True,
                    attachForm=[(menu, 'top', 10), (menu, 'left', 10),
                                (menu, 'right', 2), (b, 'bottom', 2),
                                (b, 'left', 2), (b, 'right', 2)],
                    attachControl=[(sep, 'top', 4, menu),
                                   (sep, 'bottom', 4, b)])
示例#29
0
def _addEyeDialog(rbsNode):
    form = cmds.setParent(q=True)

    # used prefixes
    idxPrfxList = _getEyeIdxPrfxList(rbsNode)
    prfxList = [s[1] for s in idxPrfxList]

    # available prefixes
    availList = [s for s in _labelList if not s in prfxList]

    # preferred prefix
    selPrfx = None
    for prfx in _orderedLabelList:
        if prfx in availList:
            selPrfx = prfx
            break

    menu = cmds.optionMenu(
        label='Please choose a name.\nUsually "L" or "R"   ')
    for l in availList:
        cmds.menuItem(label=l)
    if selPrfx:
        cmds.optionMenu(menu, e=True, v=selPrfx)

    sep = cmds.separator(style='none')
    b = cmds.button(l='OK',
                    c=lambda *x: cmds.layoutDialog(dismiss=cmds.optionMenu(
                        menu, q=True, v=True)))
    cmds.formLayout(form,
                    e=True,
                    attachForm=[(menu, 'top', 10), (menu, 'left', 10),
                                (menu, 'right', 2), (b, 'bottom', 2),
                                (b, 'left', 2), (b, 'right', 2)],
                    attachControl=[(sep, 'top', 4, menu),
                                   (sep, 'bottom', 4, b)])
    def postNotes(self,mode):
        if mode==0:
            cmds.layoutDialog(dismiss='CANCEL')
        else:
            cmds.layoutDialog(dismiss='POST')

            episode=cmds.textScrollList('episodeList', q=True, si=True)[0]
            shot=cmds.textScrollList('shotList', q=True, si=True)[0]

            #get credential
            titleVar=cmds.textField('newNotesTitle',q=True,tx=True)
            messageVar=cmds.scrollField('newNotesMessage',q=True,tx=True)

            veRegCore.addNotes(eps=episode, shot=shot, title=titleVar, notes=messageVar)
            self.popNotes()
        return
示例#31
0
def restoreBindPosePrompt():
    selected = getSelected()
    if selected:
        root = selected[0]

        if cmds.objectType(root) != 'joint':
            cmds.warning(
                'Restore Joint Pose Failed: Must select a joint hierarchy.')
            return
        else:
            pose = []
            hasPose = []
            conn = cmds.listConnections('{}.message'.format(root))

            for con in conn:
                if cmds.objectType(con) == 'dagPose':
                    hasPose.append(True)
                    pose.append(con)
                else:
                    hasPose.append(False)

            if not pose or True not in hasPose:
                cmds.warning('Restore Joint Pose Failed: No bind poses found.')
                return
            else:
                if len(pose) > 1:
                    pose = cmds.layoutDialog(
                        t='Restore Joint Pose',
                        ui=lambda: restoreBindPoseUI(pose))
                else:
                    pose = pose[0]

                restoreBindPose(pose)
            return
    return
示例#32
0
def restoreBindPoseUI(poseList):
    cmds.columnLayout(adj=True)
    textVar = cmds.textScrollList(append=poseList)
    cmds.button(l='Select',
                c=lambda x: cmds.layoutDialog(dismiss=str(
                    cmds.textScrollList(textVar, q=True, si=True)[0])))
    cmds.setParent('..')
    return
示例#33
0
    def display_camera_dialog(cls):
        result = cmds.layoutDialog(ui="ZShotMaskUi.camera_dialog_layout()",
                                   title="Select Camera",
                                   parent=cls.WINDOW_NAME)

        if result not in ["cancel", "dismiss"]:
            cmds.textFieldButtonGrp(cls.camera_name, e=True, text=result)
            cls.update_mask()
示例#34
0
    def optionBoxWindow(self, *args):
        
        sceneId         = aToolsMod.getSceneId()
        idFolder        = "%s%s%s"%(self.baseFolderName, os.sep, sceneId)    
        bkpFolder       = "%s%s%s"%(idFolder, os.sep, self.baseBackupFolderName)         
        infoData        = aToolsMod.loadFileWithUser(bkpFolder, self.infoDataFileName, ext="info")
        infoDataFile    = "%s%s%s%s%s.info"%(G.USER_FOLDER, os.sep, bkpFolder, os.sep, self.infoDataFileName)
        modDate         = os.path.getmtime(infoDataFile) if os.path.isfile(infoDataFile) else None
        
        
        if not infoData or not modDate: 
            cmds.warning("There is no crash file to restore.")
            return
        
        
        def loadWindow():
            
            mayaFileName    = infoData["mayaFileName"]
            message         = "%s\n%s\n\nWarning: Loading crash files after editing your Maya file can lead to unpredictable results."%(mayaFileName, time.ctime(modDate))
            
            formLayout      = cmds.setParent(query=True)        
            icon            = cmds.image(image= uiMod.getImagePath("ACR_white_bright")) 
            titleText       = cmds.text(label="Do you want to load?", font="boldLabelFont", align="left")  
            messageText     = cmds.text(label=message, align="left")
            buttonLoad      = cmds.button(label='Load', command='cmds.layoutDialog(dismiss="load")')
            buttonLoadSel   = cmds.button(label='Load On Selection', command='cmds.layoutDialog(dismiss="load_selection")', w=110)
           
            cmds.formLayout (formLayout, edit=True, width=300, height=170,
                            attachPosition   = [
                                             (icon, 'left', 10, 0), 
                                             (icon, 'top', 10, 0),  
                                             (titleText, 'top', 10, 0), 
                                             (messageText, 'left', 10, 0), 
                                             (messageText, 'top', 0, 30),
                                             (buttonLoad, 'left', 10, 0),
                                             (buttonLoad, 'bottom', 10, 100),
                                             (buttonLoadSel, 'bottom', 10, 100)
                                             ],
                            attachForm       = [
                                             (buttonLoad, 'left', 10),
                                             (buttonLoadSel, 'right', 10)
                                             ],
                            attachControl    = [
                                             (titleText, 'left', 10, icon),
                                             (buttonLoad, 'right', 5, buttonLoadSel)
                                             ])

            
        def window(dismiss):
         
            if dismiss == "dismiss": return

            onlySelectedNodes   = True if dismiss == "load_selection" else False
            
            self.loadData(onlySelectedNodes, self.baseBackupFolderName)  
                         
        
        window(cmds.layoutDialog(title="aTools Animation Crash Recovery", ui=loadWindow)) 
示例#35
0
    def copy_To_Minor(self):
        '''
		this is engine. Where all functions get called in a manner.
		'''
        shNm = ""
        if (self.authenticatesql(
                self.host, self.user, self.pwss,
                self.dbnm) == 1):  # make connection to database
            if (self.isfileNameEmpty() == 1):  # file name not present
                #				self.ask_user_for_project_shot_other_details_once_then_save_file_in_format()
                print cmds.layoutDialog(
                    ui=self.
                    ask_user_for_project_shot_other_details_once_then_save_file_in_format
                )
            # extract shot name from file
            prjNm = cmds.file(query=True, shn=True, sn=True).split("_")[0]
            prjType = self.returnProjectType(prjNm)
            if not (prjType == "long"):
                shNm = cmds.file(query=True, shn=True, sn=True).split("_")[1]
            else:
                shNm = cmds.file(query=True, shn=True, sn=True).split("_")[2]

            self.minorFolderName = cmds.workspace(
                query=1, act=1) + "/scenes/" + shNm + "/minor/"
            if not os.path.isdir(self.minorFolderName):
                os.mkdir(self.minorFolderName)
            print 'self.minorFolderName', self.minorFolderName, '\n'
            if (self.isfileNameConventionPresent(self.returnFileName()) == 1
                ):  # file name convention not existing
                message = (
                    "\n" + (self.underscore * 40) +
                    "\n\tValid format :\n%s for a movie \nor\n%s for a commercial \nUse save to change to above matching format "
                    + "\n" + (self.underscore * 40)) % (self.fileformat_1,
                                                        self.fileformat_2)
                print message
            elif (self.is_folder_structure_proper(self.minorFolderName) == 1):
                message = "Check Folder structure. Save File in folder %s " % (
                    self.minorFolderName)
                print message
            else:
                self.saveFileName(self.minorFolderName, self.ffilename)
                self.send_path_to_table(platform.node(), self.minorFolderName)
        else:
            message = "connection not made. connect to admin "
            print message
示例#36
0
def mirrorModule():
    # Mirrors a module.
    selList = cmds.ls( selection=True, long=True )
    if len( selList ) == 1:
        # Prompt for axis.
        mirrorAxis = int( cmds.layoutDialog( ui=mirrorObjectPrompt ) )
        
        inBitObj = selList[0]
    
        # Check if selected bit is the root.
        if NodeUtility.attributeCheck( inBitObj, 'frameRoot' ):
            # This is the root bit of the module. From here we know we can get the
            # meta node by accessing the frameRoot attribute.
            metaNode = NodeUtility.getNodeAttrDestination( inBitObj, 'frameRoot' )[0]
        else:
            # The selected bit is not the root. Run through each custom attribute
            # to find one connected to the meta node.
            attrList = cmds.listAttr( inBitObj, userDefined=True )
            for attr in attrList:
                connection = NodeUtility.getNodeAttrDestination( inBitObj, attr )
                if NodeUtility.attributeCheck( connection[0], 'metaType' ):
                    metaNode = connection[0]
                    break
                
        # Now that we have the meta node, we need the XML file name and it's location.
        metaClassPlug = NodeUtility.getPlug( metaNode, 'metaClass' )
        metaClassValue = NodeUtility.getPlugValue( metaClassPlug )
        
        metaBuildFolderPlug = NodeUtility.getPlug( metaNode, 'buildFolder' )
        metaBuildFolderValue = NodeUtility.getPlugValue( metaBuildFolderPlug )
        
        # Create the target module.
        '''
        NEED TO FIX THIS!
        targetRootBit = buildFrameModule( metaBuildFolderValue, metaClassValue )
        '''
    
        # Loop through each object in the source module.
        metaRootBit = NodeUtility.getNodeAttrSource( metaNode, 'rootBit' )[0]
        
        sourceChildBits = NodeUtility.getFrameRootAllChildren( metaRootBit )
        targetChildBits = NodeUtility.getFrameRootAllChildren( targetRootBit )
        
        sourceBits = []
        targetBits = []
        
        for i,bit in enumerate( sourceChildBits ):
            sourceBits.append( bit )
        sourceBits.insert( 0, metaRootBit )
        
        for i, bit in enumerate( targetChildBits ):
            targetBits.append( bit )
        targetBits.insert( 0, targetRootBit )
        
        for bit in xrange( len(sourceBits) ):
            # Mirror the source onto the target.
            mirrorObject( inSourceObj=sourceBits[bit], inTargetObj=targetBits[bit], inMirrorAxis=mirrorAxis )
示例#37
0
def mirrorObject( inSourceObj=None, inTargetObj=None, inMirrorAxis=None ):
    # Mirrors the position and rotation of one object(source) and applies it to another (target).
    
    if inSourceObj is None or inTargetObj is None:
        # Target object should be selected first, followed by source object.
        selList = cmds.ls( selection=True, long=True )
        if len( selList ) == 2:
            inTargetObj = selList[0]
            inSourceObj = selList[1]
        
    if inMirrorAxis is None:
        inMirrorAxis = int( cmds.layoutDialog( ui=mirrorObjectPrompt ) )
        
    if inMirrorAxis is not None:
        # Get the source module's root world matrix.
        sourceWorldMatrix = TransformUtility.getMatrix( inSourceObj, 'worldMatrix' )
        
        # Get the source's translation vector.
        sourceWorldTranslation = TransformUtility.getMatrixTranslation( sourceWorldMatrix, OpenMaya.MFn.kWorld )
        
        # Get the source's rotation matrix.
        sourceRotationMatrix = OpenMaya.MTransformationMatrix( sourceWorldMatrix ).asRotateMatrix()
        
        # Mirror the translation across the selected axis.
        if inMirrorAxis is 0:
            sourceWorldTranslation.x = sourceWorldTranslation.x * -1
        elif inMirrorAxis is 1:
            sourceWorldTranslation.y = sourceWorldTranslation.y * -1        
        elif inMirrorAxis is 2:
            sourceWorldTranslation.z = sourceWorldTranslation.z * -1    
    
        # Apply the mirrored position back to the target object.
        MFnTrans = OpenMaya.MFnTransform()
        targetDagPath = NodeUtility.getDagPath( inTargetObj )
        MFnTrans.setObject( targetDagPath )
        MFnTrans.setTranslation( sourceWorldTranslation, OpenMaya.MSpace.kWorld )
        
        # Mirror the rotation.
        baseVectors = {}
            
        for row in xrange( 3 ):
            # We only need the first three rows.
            rowPtr = sourceRotationMatrix[row]
            baseVectors[ row ] = []
            for col in xrange( 3 ):
                # We only need the first three columns.
                if col is not inMirrorAxis:
                    origValue = OpenMaya.MScriptUtil.getDoubleArrayItem( rowPtr, col ) * -1
                    OpenMaya.MScriptUtil.setDoubleArray( rowPtr, col, origValue )
    
        targetInverseMatrix = TransformUtility.getMatrix( inTargetObj, 'parentInverseMatrix' )
        mirroredTarget = sourceRotationMatrix * targetInverseMatrix
        toEuler = OpenMaya.MTransformationMatrix( mirroredTarget ).eulerRotation()
        #x,y,z = map(math.degrees,(toEuler.x,toEuler.y,toEuler.z))
        #print x,y,z 
        
        MFnTrans.setRotation( toEuler )
示例#38
0
	def startRender(self, *args):
		'''Start render'''
		# Change render settings
		print 'Changing render settings!!!'
		self.setSettings()
		print 'Will output render to: ' + self.renderFolder
		# Check if render selection has been enabled
		if self.selRender == 1:
			print 'Only rendering selection'
			# Dismiss UI
			cmds.layoutDialog(dismiss="Starting render!")
			# Start Render
			cmds.hwRender(noRenderView=True, renderSelected=True)
		else:
			# Dismiss UI
			cmds.layoutDialog(dismiss="Starting render!")
			# Start Render
			cmds.hwRender(noRenderView=True)
示例#39
0
    def networkPromptUI(self, *args):
        networks = self.findAllNetworksByType(self.typ)

        cmds.columnLayout(adj=True)
        textVar = cmds.textScrollList(append=networks)
        cmds.button(l='Select',
                    c=lambda x: cmds.layoutDialog(dismiss=str(
                        cmds.textScrollList(textVar, q=True, si=True)[0])))
        cmds.setParent('..')
示例#40
0
    def execute(self, parentWindow=None):
        BaseDialog.currentDialog = self
        log.debug("executing a dialog")

        options = {'ui': self.createUi, 'title': self.title}
        if parentWindow is not None:
            options["parent"] = parentWindow
        result = cmds.layoutDialog(**options)
        BaseDialog.currentDialog = None
        log.debug("dialog ended")
        return result
示例#41
0
    def run(self):
        """Display the Factory Icon Browser window. Return the selected
        resource or None
        """

        result = cmds.layoutDialog(title=stringTable['y_resourceBrowser.kShelves'],
                                   ui=self.populateUI)

        if result == 'valid':
            return self.currentResource
        return None
示例#42
0
def startup(*args):
    #validate startup.xml
    if os.path.isfile('startup.xml') == False:
        #startup not found
        repVar=cmds.confirmDialog(icn='critical',t='error',message='There is no startup.xml found!',\
                           button=['Start Default','Close'])
        if repVar == 'Close': cmds.quit(f=True)
    else:
        #call layoutdialog
        try:
            cmds.layoutDialog(ui=uiFunction, t='ASIIST Startup')
        except:
            pass

    #start callback function
    om.MSceneMessage.addCallback(om.MSceneMessage.kBeforeSave,
                                 beforeSaveCallbackFun)
    om.MSceneMessage.addCallback(om.MSceneMessage.kAfterSave,
                                 afterSaveCallbackFun)
    return
示例#43
0
 def execute(self,parentWindow=None):
     BaseDialog.currentDialog = self
     log.debug("executing a dialog")
     
     options = {'ui':self.createUi,'title':self.title}
     if parentWindow is not None:
         options["parent"] = parentWindow
     result = cmds.layoutDialog(**options)
     BaseDialog.currentDialog = None
     log.debug("dialog ended")
     return result
     
示例#44
0
    def run(self):
        """Display the Factory Icon Browser window. Return the selected
    resource or None
    """

        result = cmds.layoutDialog(
            title=maya.stringTable['y_resourceBrowser.kShelves'],
            ui=self.populateUI)
        self.info('result = %s' % result)

        if result == 'valid':
            return self.currentResource
        return None
示例#45
0
    def findNetwork(self, typ):
        networks = self.findAllNetworksByType(typ)
        node = None

        if networks:
            if len(networks) > 1:
                node = cmds.layoutDialog(t='{} Network'.format(
                    typ.capitalize()),
                                         ui=self.networkPromptUI)
            else:
                node = networks[0]

        return node
示例#46
0
	def __main__(self):
		'''
		this is engine. Where all functions get called in a manner.
		'''

		self.folderName = cmds.workspace(query=1,act=1) + "/scenes/minor/"
		print 'self.folderName',self.folderName,'\n'
		if (self.authenticatesql(self.host, self.user, self.pwss, self.dbnm) == 1):				# make connection to database
			if	(self.isfileNameEmpty() == 1):													# file name not present 
#				self.ask_user_for_project_shot_other_details_once_then_save_file_in_format()
				print cmds.layoutDialog(ui=onmi.ask_user_for_project_shot_other_details_once_then_save_file_in_format)
			elif	(self.isfileNameConventionPresent(self.returnFileName()) == 1):				# file name convention not existing
				message = ("\n" + (self.underscore*40) + "\n\tValid format :\n%s for a movie \nor\n%s for a commercial \nUse save to change to above matching format " + "\n" + (self.underscore*40)) % (self.fileformat_1 ,self.fileformat_2 )
				print message
			elif (self.is_folder_structure_proper(self.folderName) == 1):
				message = "Check Folder structure. Save File in folder %s " % (self.folderName)
				print message
			else:
				self.bbbb(self.folderName)
				self.send_path_to_table(platform.node(),self.folderName)
		else:
			message = "connection not made. connect to admin "
			print message
    def postNotes(self,mode):
        if mode==0:
            cmds.layoutDialog(dismiss='CANCEL')
        else:
            cmds.layoutDialog(dismiss='POST')

            #get credential
            titleVar=cmds.textField('newNotesTitle',q=True,tx=True)
            authorVar=currentUserVar
            messageVar=cmds.scrollField('newNotesMessage',q=True,tx=True)

            #get asset name
            assetNameVar=cmds.textScrollList('assetTextScroll',q=True,si=True)
            if assetNameVar==None:
                cmds.confirmDialog(icn='warning', t='Error', m='No asset selected from asset list.', button=['Ok'])
                self.populateTable()
                raise StandardError, 'error : no asset selected from asset list'
            assetNameVar=assetNameVar[0]

            #get asset id
            assetIdVar=''
            for chk in veRegCore.listAssetTable():
                if chk[1]==assetNameVar:
                    assetIdVar=chk[0]
            if assetIdVar=='':
                cmds.confirmDialog(icn='warning',t='Error',m='Database anomaly! No asset named '+assetNameVar+' in database.',\
                                   button=['OK'])
                raise StandardError, 'error : database anomaly no asset found'

            try:
                veRegCore.postNewNotes(title=titleVar,author=authorVar,message=messageVar,\
                                          assetId=assetIdVar, assetName=assetNameVar)
            except Exception as e:
                cmds.confirmDialog(icn='warning', t='Error', m=str(e), button=['OK'])
                raise StandardError, str(e)
        self.listLegacyAndPicture()
        return
示例#48
0
def _mirrorWeightsDialog(rbsNode, destPrfx):
	"""Mirror bulge weights dialog box."""

	form = cmds.setParent(q=True)

	# used prefixes
	idxPrfxList = _getEyeIdxPrfxList(rbsNode)
	prfxList = [s[1] for s in idxPrfxList if s[1] != destPrfx]

	menu = cmds.optionMenu(label='Mirror bulge weights from\n(the current weights will be destroyed):')
	for l in prfxList:
		cmds.menuItem(label=l)

	cmds.optionMenu(menu, e=True, sl=1)

	sep = cmds.separator(style='none')
	b = cmds.button(l='OK', c=lambda *x: cmds.layoutDialog(dismiss=cmds.optionMenu(menu, q=True, v=True)))
	cmds.formLayout(form, e=True, attachForm=[(menu, 'top', 10), (menu, 'left', 10), (menu, 'right', 2), (b, 'bottom', 2), (b, 'left', 2), (b, 'right', 2)], attachControl=[(sep, 'top', 4, menu), (sep, 'bottom', 4, b)])
 def warningForLoading(self, message, height):
     
     def warningWindow():
     
         formLayout      = cmds.setParent(query=True)        
         icon            = cmds.image(image= uiMod.getImagePath("ACR_white_bright")) 
         titleText       = cmds.text(label="You have newer animation. Do you want to load?", font="boldLabelFont", align="left")
         messageText     = cmds.text(label=message, align="left")
         buttonLoad      = cmds.button(label='Load', command='cmds.layoutDialog(dismiss="load")')
         buttonMaybe     = cmds.button(label='Maybe Later', command='cmds.layoutDialog(dismiss="maybe")', w=100)
         
       
         cmds.formLayout (formLayout, edit=True, width=300, height=height,
                         attachPosition   = [
                                          (icon, 'left', 10, 0), 
                                          (icon, 'top', 10, 0),  
                                          (titleText, 'top', 10, 0), 
                                          (messageText, 'left', 10, 0), 
                                          (messageText, 'top', 0, 30),
                                          (buttonLoad, 'left', 10, 0),
                                          (buttonLoad, 'bottom', 10, 100),
                                          (buttonMaybe, 'bottom', 10, 100)
                                          ],
                         attachForm       = [
                                          (buttonLoad, 'left', 10),
                                          (buttonMaybe, 'right', 10)
                                          ],
                         attachControl    = [
                                          (titleText, 'left', 10, icon),
                                          (buttonLoad, 'right', 5, buttonMaybe)
                                          ])
         
         
         
     def window(dismiss):
         if dismiss == "load":                 
             self.loadData()
         else:                 
             cmds.warning("If you want to load later, go to aTools menu/Animation Crash Recovery option box")
         
         self.saveBackup()           
     
     window(cmds.layoutDialog(title="aTools Animation Crash Recovery", ui=warningWindow)) 
示例#50
0
def FileOpen(path):
    """
    Open a file
    """
    def savePrompt():
        p = cmds.setParent(q=True)
        cmds.columnLayout(adj=True, p=p)
        cmds.rowLayout(nc=2)
        cmds.columnLayout()
        eval(embedImage())
        cmds.setParent("..")
        cmds.columnLayout(adj=True)
        cmds.text(al="left", hl=True, l="""
<h3>There are unsaved changes in your scene.</h3>
<div>Would you like to save before leaving?</div>""", h=70)
        cmds.rowLayout(nc=3, h=30)
        cmds.button(l="Yes please!".center(20), c="cmds.layoutDialog(dismiss=\"yes\")")
        cmds.button(l="No Thanks".center(20), c="cmds.layoutDialog(dismiss=\"no\")")
        cmds.button(l="Cancel".center(20), c="cmds.layoutDialog(dismiss=\"cancel\")")
        cmds.setParent("..")
        cmds.setParent("..")

    if os.path.isfile(path):
        if path[-3:] in [".ma", ".mb"]:  # Make a special exception for maya files.
            if cmds.file(mf=True, q=True):  # File is modified. Need to make some changes.
                answer = cmds.layoutDialog(ui=savePrompt, t="Excuse me one moment...")
                if answer == "yes":
                    if not cmds.file(q=True, sn=True):
                        loc = SaveAs()
                        if loc:
                            cmds.file(rn=loc[0])
                        else:
                            return
                    cmds.file(save=True)
                elif answer == "no":
                    pass
                else:
                    return
            cmds.file(path, o=True, f=True)
        else:
            universalOpen(path)
示例#51
0
def addEyeCmd():
	"""Adds new eyelid inputs."""
	
	geo = _getGeoFromUI()
	rbsNode = geo and _getRbs(geo)
	
	prfx = cmds.layoutDialog(t='Add eye', ui=lambda *x: _addEyeDialog(rbsNode))
	if len(prfx) > 1:
		return
	
	# find first available lower lid index
	miList = _getEyeIdxList(rbsNode)
	idx = 0
	while idx in miList or (idx+1) in miList:
		idx += 2
	
	lowerAttr = '%s.it[%d]' % (rbsNode, idx)
	upperAttr = '%s.it[%d]' % (rbsNode, idx+1)
	lowerName = '%s_lower' % prfx
	upperName = '%s_upper' % prfx
	
	# add lower and upper indices
	cmds.getAttr('%s.im' % lowerAttr)
	cmds.getAttr('%s.im' % upperAttr)

	# set the aliases for the inputTarget attributes (lower and upper)
	if cmds.aliasAttr(lowerAttr, q=True) != lowerName:
		_setAlias(lowerAttr, lowerName)
	if cmds.aliasAttr(upperAttr, q=True) != upperName:
		_setAlias(upperAttr, upperName)
	
	# create and connect locators
	_createEyeLocators(rbsNode, idx)
	
	# update tab ui
	_updateUI()
	_selectTab(prfx)
def getTextScrollListName(textScrollListName, *args):
    cmds.layoutDialog(dismiss=cmds.textScrollList(textScrollListName, q=True, si=True)[0])
示例#53
0
	def assignNewMateColorUi(self, *args):
		"""docstring for assignNewMateColorUi"""
		col = mc.colorSliderGrp( 'customColorColorSlider', q = 1, rgb = 1 )
		alph = mc.checkBox( 'customAlpha_chb', q = True, v = True )
		mc.layoutDialog( dismiss="Cancel" )
		self.assignNewMateColor( col, alph )
示例#54
0
	def computeFileName(self):
		'''
		from user prompted selection return file name
		'''

		self.sw1 = 1
		l1c = cmds.optionMenu(self.l1,query=True,value=True)
#		l2c = cmds.optionMenu(self.l2,query=True,value=True)
		l3c = cmds.optionMenu(self.l3,query=True,value=True)

		l4c = cmds.textField(self.l4,query=True,text=True)
		if not l4c:
			print 'empty'
			self.sw1 = 0
		else:
			print 'l4c ',l4c ,'\n'
		l5c = cmds.textField(self.l5,query=True,text=True)
		l6c = cmds.textField(self.l6,query=True,text=True)
		l7c = cmds.textField(self.l7,query=True,text=True)
		if not l7c:
			print 'empty'
			self.sw1 = 0
		else:
			print 'l7c ',l7c ,'\n'

	# compute file name
	#	get prefix of project, seq, shot
	#
		if (self.sw1 == 1):
#			print 'in self.sw1 1'
			ft1 = "%s"
			ft2 = "%s"
			ft3 = "%s"
			ft4 = "%s"

			field1nm = "prjPrefix"
			field2nm = "projects"
			field3nm = "prjName"
		#	 field4nm = l1c

			fn1 = self.readSingleField(ft1, field1nm ,ft2, field2nm, ft3, field3nm, ft4, l1c )
			if fn1:
#				print 'in self.sw1 3'
				ft1 = "%s"
				ft2 = "%s"
				ft3 = "%s"
				ft4 = "%s"

				field1nm = "shPrefix"
				field2nm = "shots"
				field3nm = "shotName"
#				field4nm = l3c

				fn3 = self.readSingleField(ft1, field1nm ,ft2, field2nm, ft3, field3nm, ft4, l3c )
				print 'fn3 : ',type(fn3)
				if fn3:
#					print 'in self.sw1 4',type(fn1[0]),type(fn2[0]),'\n'
#					self.ffilename = fn1[0] + self.underscore + fn2[0] + self.underscore + fn3[0] + self.underscore + l4c + self.underscore + "v" + l5c + self.underscore + l6c + self.underscore + l7c + self.dot + self.filext
					self.ffilename = fn1[0] + self.underscore + fn3[0] + self.underscore + l4c + self.underscore + "v" + l5c + self.underscore + l6c + self.underscore + l7c + self.dot + self.filext
					print 'self.ffilename : ',self.ffilename,'\n'
		else:
			print 'error message'

#		cmds.deleteUI( self.form, window=True )
		cmds.layoutDialog( dismiss = 'close' )
def create():
    global shelf

    if cmds.layoutDialog(ui=shelfQuery) == "Create":
        cmds.shelfTabLayout('ShelfLayout', edit=True, selectTab=shelf)
        cmds.shelfButton(label='NI mate receiver', parent=shelf, enableBackground=False, annotation='Start/Stop receiving data from NI mate, double click to access preferences.', image='NImateReceiverForMaya.ico', sourceType='python', command='import NImateReceiverForMaya\nNImateReceiverForMaya.toggleReceiver()', doubleClickCommand='import NImateReceiverForMaya\nNImateReceiverForMaya.showPreferences()')
示例#56
0
	def createColorShaderUI(self):
		"""ui to create a custom color, then calls createAssignShader"""
		mc.layoutDialog( ui = self.assignCustomColorUI )
	def passRemappingData(self, *arg):
		#if (cmds.window(MainSkinUI.RemapWindowID,ex=True)):
			#cmds.deleteUI(MainSkinUI.RemapWindowID, wnd=True)
		cmds.layoutDialog(dis='Dismiss')
def setOrientWithUpVector(aimAxis, upAxis, heirarchy, customChildInt, customChild):
    # THESE ARE THE 3 NODES WE NEED TO DEFINE!!
    jointToAim = None
    aimTarget = None
    upNode = None

    #Find the selected joint and upVector nodes from the selection
    # CRA NOTE: Could add some more logic here later to check to see if the first 2 selected are joints and that the 2nd is a relative of the first.
    selected = cmds.ls(sl=True)
    if len(selected) != 2:
        cmds.confirmDialog(icon = "warning!!", title = "Orient Joint with Up Tool", message = "You must select exactly 2 objects.  Joint you want to orient and then the object to use as the upVector.")
        return
    else:
        jointToAim = selected[0]
        upNode = selected[1]

        # Find the joints that we need to apply the orient script to.
        if heirarchy == 0:
            # find only the immediate children of jointToAim
            allChildren = cmds.listRelatives(jointToAim, c=True, type="joint")
            #print "\nAll Children..."
            #print allChildren

            if customChildInt == 1:
                aimTarget = customChild
                if allChildren != None:
                    doOrientJoint(jointToAim, aimTarget, upNode, aimAxis, upAxis, allChildren)
                else:
                    cmds.joint(jointToAim, e=True, oj="none", secondaryAxisOrient="yup", ch=True, zso=True)
            elif allChildren != None:
                if len(allChildren) == 1:
                    aimTarget = allChildren[0]
                else:
                    aimTarget = cmds.layoutDialog(t="Child Joints List", ui=partial(findChild, jointToAim))
                #print "\nPRINTING JOINTS LIST---- "
                #print "jointToAim: "+jointToAim
                #print "aimTarget: "+aimTarget
                #print "upNode   : "+upNode   
                #print "----DONE PRINTING JOINTS LIST"
                doOrientJoint(jointToAim, aimTarget, upNode, aimAxis, upAxis, allChildren)
            else:
                cmds.joint(jointToAim, e=True, oj="none", secondaryAxisOrient="yup", ch=True, zso=True)


        if heirarchy == 1:
            # find all of the joints we want to use as the jointToAim
            cmds.select(jointToAim, hi=True)
            allJointsToAim = cmds.ls(sl=True, type="joint")
            #print "\nALL Joints To Aim..."
            #print allJointsToAim

            for one in allJointsToAim:
                jointToAim = one
                #print "\nCURRENT JOINT..."
                #print jointToAim
                
                # find only the immediate children of jointToAim
                allChildren = cmds.listRelatives(jointToAim, c=True, type="joint")
                #print "\nAll Children..."
                #print allChildren

                if allChildren != None:
                    if len(allChildren) == 1:
                        aimTarget = allChildren[0]
                    else:
                        aimTarget = cmds.layoutDialog(t="Child Joints List for: "+jointToAim, ui=partial(findChild, jointToAim))
                   
                    #print "\nPRINTING JOINTS LIST---- "
                    #print "jointToAim: "+jointToAim
                    #print "aimTarget: "+aimTarget
                    #print "upNode: "+upNode   
                    #print "----DONE PRINTING JOINTS LIST"
                    doOrientJoint(jointToAim, aimTarget, upNode, aimAxis, upAxis, allChildren)
                else:
                    # Set the joint orient to none so that it just takes the orientation of its parent.  This is only for the leaf joints in the heirarchy.
                    cmds.joint(jointToAim, e=True, oj="none", secondaryAxisOrient="yup", ch=True, zso=True)
示例#59
0
	def dismissCustomColorUI(self, *args):
		"""docstring for dismissCustomColorUI"""
		mc.layoutDialog( dismiss="Cancel" )