예제 #1
0
    def update(self, lister, path, isAdded):
        """ 
        updates the persistant favorite store 

        lister  - name of the treeLister which has added/removed the favorite
        path    - item path to be updated
        isAdded - True means add to store, False means remove
        """
        if self._dontUpdate:
            return
        item = (path, _pathToStoredKey[path])
        favs = self.get()
        if isAdded:
            if item not in favs:
                favs.append(item)
        elif item in favs:
            favs.remove(item)

        self._syncToDisk()

        # make sure we aren't re-entered
        self._dontUpdate = True

        # notify others
        for client in self._clients:
            if lister != client:
                try:
                    if isAdded:
                        cmds.treeLister(client, e=True, addFavorite=path)
                    else:
                        cmds.treeLister(client, e=True, removeFavorite=path)
                except RuntimeError, ex:
                    cmds.warning(str(ex))
                    pass
예제 #2
0
 def attachClient(self, lister):
     """
     Add a treeLister instance as a client of this favorites store.
     Any changes from the lister will propagate to other clients.
     """
     if lister not in self._clients:
         self._clients.append(lister)
         try:
             cmds.treeLister(lister,
                             e=True,
                             favoritesCallback=partial(self.update, lister))
         except RuntimeError, ex:
             cmds.warning(str(ex))
예제 #3
0
def Char_ModelLibWin():
    winWH = [500,420]
    winName = 'ModelLibraryWin'
    if cmds.window(winName,q = True,ex = True):
        cmds.deleteUI(winName)
    cmds.window(winName,wh = winWH,t = 'ModelLibrary',mb = True)
    cmds.menu(l = '文件')
    cmds.menuItem(l = '整理文件信息',c = 'fb.mod.charLibrary.propList()')
    cmds.menuItem(l = '添加角色',c = 'fb.mod.charLibrary.Char_AddPropWin()')
    cmds.menuItem('addSelmen',l = '叠加选择',cb = False)
    cmds.menu(l = '刷新')
    cmds.menuItem(l = '刷新窗口',c = 'fb.mod.charLibrary.Char_ModelLibWin()')
    cmds.formLayout('Char_MLformLayout',nd=100)
    coLayoutTop = cmds.columnLayout(adj = True,cat = ['both',0],rs = 10)
    cmds.text(l = '角色库')
    cmds.separator()
    cmds.setParent('..')
    treeList = cmds.treeLister('Char_TreeList')
    #cmds.popupMenu()
    #cmds.menuItem('Char_OpenScenesFolder',l = '打开场景文件夹')
    #cmds.menuItem('Char_OpenImageFolder',l = '打开图片文件夹')
    scLy = cmds.frameLayout('PicFrameLay',l = '图片',bs = 'etchedOut')
    cmds.scrollLayout('picScrolLY',cr = True,hst = 1000,vst = 1000,mcw = 1000,rc = 'fb.mod.charLibrary.Char_Rcmd()')
    cmds.gridLayout('Char_GridLY',cwh =(100,100))
    cmds.setParent('..')
    cmds.showWindow(winName)
    cmds.formLayout('Char_MLformLayout',e = True,
    af = [(coLayoutTop,'top',5),(coLayoutTop,'left',5),(coLayoutTop,'right',5),(treeList,'left',5),(treeList,'bottom',5),(scLy,'right',5),(scLy,'bottom',0)],
    ac = [(treeList,'top',0,coLayoutTop),(scLy,'top',0,coLayoutTop),(scLy,'left',0,treeList)],
    ap = [(treeList,'right',5,40)])
    if cmds.window('addPropWin',q = True,ex = True):
        cmds.deleteUI('addPropWin')
    Char_TreeList()
예제 #4
0
def attachStore(lister, fpath):
    """
    Connects the TLFavoriteStore instance for the specified file path
    to the specified tree lister.  Populates the treeLister with the
    stored favorites.
    
    lister   - the treeLister 
    fpath    - full path to the favorites file
    """
    if _storesByFilename.has_key(fpath):
        fs = _storesByFilename[fpath]
    else:
        fs = _storesByFilename[fpath] = TLFavoriteStore(fpath)

    favPaths = [tpl[0] for tpl in fs.get()]
    fs._dontUpdate = True
    cmds.treeLister(lister, e=True, addFavorite=favPaths)
    fs.attachClient(lister)
    fs._dontUpdate = False
    return fs
예제 #5
0
 def __new__(cls, *args, **kwargs):
     kwargs['wid'] = cmds.treeLister()
     self = super(cls, cls).__new__(cls)
     self.initWith(**kwargs)
     return self
예제 #6
0
def Char_TreeList(typ = 1):
    cmds.treeLister('Char_TreeList',e = True,add = [('类型/%s'%t[0],'','fb.mod.charLibrary.Char_PicList(%s)'%t[1:]) for t in Char_PropList()[0]])
    cmds.treeLister('Char_TreeList',e = True,add = [('项目/%s'%p[0],'','fb.mod.charLibrary.Char_PicList(%s)'%p[1:]) for p in Char_PropList()[1]])
예제 #7
0
파일: ui.py 프로젝트: satishgoda/adaofsw
 def initializeTools(self):
     for toolName in self.mgr.tools:
         tool = self.mgr.tools[toolName]['instance']
         cmds.treeLister(self.tl, edit=True, addItem = (tool.name, '', partial(self.invokeTool, tool)))
예제 #8
0
def createRenderNodeSelectNodeCategoriesCallback(flag, treeLister):
    if flag == "allWithAppleseedUp":
        mc.treeLister(treeLister, edit=True, selectPath="appleseed")
예제 #9
0
    def show(self):
        self.close()
        win = mc.window(self._windowName, wh=self._windowSize, t=u'材质质感库')
        fll = mc.formLayout()
        tl = mc.treeLister()
        mc.formLayout(fll,
                      e=True,
                      af=((tl, 'top', 0), (tl, 'left', 0), (tl, 'bottom', 0),
                          (tl, 'right', 0)))
        mc.showWindow(self._windowName)

        #自然物质
        mc.treeLister(tl,
                      e=True,
                      add=(u'自然物质/岩石/', r'', lambda *arg: self.text(0)),
                      numberOfPopupMenus=True,
                      expandToDepth=500)
        mc.popupMenu("ss", b=3)
        mc.menuItem(l=u"打开maya原文件", c=lambda *arg: self.text(1), parent="ss")

        mc.treeLister(tl,
                      e=True,
                      add=(u'自然物质/山体/', r'', lambda *arg: self.text(1)))
        mc.popupMenu("ss", b=3)
        mc.menuItem(l=u"打开maya原文件", c=lambda *arg: self.text(2), parent="ss")
        mc.treeLister(tl,
                      e=True,
                      add=(u'自然物质/石块/', r'', lambda *arg: self.text(2)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'自然物质/土/', r'', lambda *arg: self.text(3)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'自然物质/沙/', r'', lambda *arg: self.text(4)))

        #人造材
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/砖/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/水泥墙面/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/水泥地面/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/大理石/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/石条(石材)/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/朔料/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/金属/', r'%s\gold.jpg' % OCT_ImagePath,
                           lambda *arg: self.gold()))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/铬/', r'%s\chrome.jpg' % OCT_ImagePath,
                           lambda *arg: self.chrome()))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/玻璃/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/陶器/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/陶瓷/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/蜡/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/木材/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/布料/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/书(纸)/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/车漆/', r'%s\carPaint.jpg' % OCT_ImagePath,
                           lambda *arg: self.carPaint()))
        mc.treeLister(tl,
                      e=True,
                      add=(u'人造材料/白炽灯/', r'', lambda *arg: self.text(4)))

        #植物
        mc.treeLister(tl,
                      e=True,
                      add=(u'植物/树叶/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'植物/树干/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'植物/花瓣/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'植物/灌木枝干/', r'', lambda *arg: self.text(4)))

        #液体
        mc.treeLister(tl,
                      e=True,
                      add=(u'液体/水/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'液体/牛奶/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'液体/咖啡/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'液体/油/', r'', lambda *arg: self.text(4)))

        #动物
        mc.treeLister(tl,
                      e=True,
                      add=(u'动物/人类皮肤/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'动物/恐龙皮肤/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'动物/眼球/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'动物/牙齿/', r'', lambda *arg: self.text(4)))
        mc.treeLister(tl,
                      e=True,
                      add=(u'动物/指甲/', r'', lambda *arg: self.text(4)))
예제 #10
0
파일: ui.py 프로젝트: satishgoda/adaofsw
 def __init__(self, toolmgr):
     self.mgr = toolmgr
     self.window = cmds.window()
     self.pl = cmds.paneLayout( configuration='horizontal2')
     self.tl = cmds.treeLister()
     self.toolPropsWindow = ToolPropertiesWindow(self.pl)
예제 #11
0
def aiCreateRenderNodeSelectNodeCategoriesCallback(nodeTypesFlag, renderNodeTreeLister) :
    if (nodeTypesFlag == "allWithArnoldUp") :
        cmds.treeLister(renderNodeTreeLister, edit=True, selectPath="arnold")
예제 #12
0
def createRenderNodeSelectNodeCategoriesCallback (flag, treeLister):
    if flag == "allWithNiepceUp":
        mc.treeLister (treeLister, edit = True, selectPath = "niepce")
예제 #13
0
def YY_TreeList(typ = 1):
    cmds.treeLister('YY_TreeList',e = True,add = [('类型/%s'%t[0],'','fb.mod.propLibrary.YY_PicList(%s)'%t[1:]) for t in YY_PropList()[0]])#'YY_PicList(\'%s/propLibrary/%s/images\')'%(YY_Desk(),os.path.dirname(p)))
    cmds.treeLister('YY_TreeList',e = True,add = [('项目/%s'%p[0],'','fb.mod.propLibrary.YY_PicList(%s)'%p[1:]) for p in YY_PropList()[1]])
예제 #14
0
 def __new__(cls, *args, **kwargs):
     kwargs['wid'] = cmds.treeLister()
     self = super(cls, cls).__new__(cls)
     self.initWith(**kwargs)
     return self
예제 #15
0
def w00_fun_popCommand(funStr=None):
    itemStr = cmds.treeLister('w00_01', q=True, resultsPathUnderCursor=True)
    if itemStr == '':
        print 'popMenu error, Try again'
    else:
        funName = str(cmds.treeLister('w00_01', q=True, itemScript=itemStr)[1])
        if 'mel.eval' in funName:
            print funName
            #print 'usage:', melListData[funName]['usage']

            usageStr = melListData[funName]['usage'].strip()
            htmlUrl = melListData[funName].get('html', '')
            if htmlUrl:
                if htmlUrl == True:
                    shortName = funName.rsplit('.', 1)[-1]
                    htmlUrl = '%s/hq_maya/%s' % (HTTP_ROOT, shortName)
                    #if cmds.menuItem( 'w00_onlineHelpSwitch', q=True, checkBox=True ):
                    #    os.startfile( htmlUrl )
                htmlUrl = '\n//' + htmlUrl

            melCmd = re.match(r'\S*mel.eval\((.+)\)\S*', funName).groups()[0]
            printStr = '\n//%s%s\n%s\n' % (melCmd, htmlUrl, usageStr)
            cmds.cmdScrollFieldExecuter('w00_04_melWin',
                                        e=True,
                                        appendText=printStr.decode('utf-8'))
            cmds.tabLayout('w00_02_tabLayout', e=True, sti=2)

        else:
            funName = funName.strip()
            pattern = re.match(r'^w00_fun_popCommand\((.+)\)$', funName)
            if pattern:
                funName = pattern.groups()[0].rsplit('(')[0].strip()
                funName = funName[1:]
            else:
                funName = funName.rsplit('(')[0].strip()

            #print funName
            #print funName
            #exec('docStr = eval(%s.__doc__)'%funName)
            if str(eval('type( %s )' % (funName))) == "<type 'function'>":
                exec('docStr = %s.__doc__' % (funName))
            elif eval('hasattr(%s, "_menuStr")' % (funName)):
                exec('docStr = %s._menuStr' % (funName))

            docStr = eval(docStr)

            usageStr = docStr.get('usage', '').strip().replace('$fun', funName)
            htmlUrl = docStr.get('html', '')
            if htmlUrl:
                if htmlUrl == True:
                    shortName = funName.rsplit('.', 1)[-1]
                    htmlUrl = '%s/hq_maya/%s' % (HTTP_ROOT, shortName)
                    #if cmds.menuItem( 'w00_onlineHelpSwitch', q=True, checkBox=True ):
                    #    os.startfile( htmlUrl )
                htmlUrl = '\n#' + htmlUrl
            helpStr = qm.HTMLToText(docStr.get('help', '')).getText().strip()
            helpStr = '"""\n' + helpStr + '\n"""' if helpStr else ''

            usageStr = '\n#%s%s\n%s\n%s' % (funName, htmlUrl, usageStr,
                                            helpStr)
            cmds.cmdScrollFieldExecuter('w00_03_pythonWin',
                                        e=True,
                                        appendText=usageStr.decode('utf-8'))
            cmds.tabLayout('w00_02_tabLayout', e=True, sti=1)