def selectionSets(self): """ :rtype: list[setsitem.SetsItem] """ items = [] paths = [] #add the geppetto selection sets items += [ setsgeppetto.SetsGeppetto('Body', 'ctl body'), setsgeppetto.SetsGeppetto('Face', 'ctl face'), setsgeppetto.SetsGeppetto('All', 'ctl'), ] #first get all the one from the global library if it exists: myuser = self.item().FolderUserItem() if myuser and myuser.user() != 'global': #get the library name and compute the global path mylib = self.item().FolderLibraryItem() if mylib: libids = mylib.libraryId().split('/') globalpath = os.path.join( self.item().library().globalUserFolderPath(), os.path.sep.join(libids)) + '.lib' #add a dummy folder to the path for the 'walkup' to start by the lib globalpath = os.path.join(globalpath, 'dummy') setIterator = studiolibrary.walkup( globalpath, match=lambda path: path.endswith(".set"), depth=10, ) paths += list(setIterator) #now add the set from the current folder setIterator = studiolibrary.walkup( self.item().path(), match=lambda path: path.endswith(".set"), depth=10, ) paths += list(setIterator) #convert to items libraryWindow = self.item().libraryWindow() for path in paths: item = setsitem.SetsItem(path) item.setLibraryWindow(libraryWindow) items.append(item) return items
def mirrorTablePaths(self): """ Return all mirror table paths for this item. :rtype: list[str] """ paths = list(studiolibrary.walkup( self.path(), match=lambda path: path.endswith(".mirror"), depth=10, ) ) return paths
def mirrorTablePaths(self): """ Return all mirror table paths for this item. :rtype: list[str] """ #get the list of mirror in the main folder paths = list( studiolibrary.walkup( self.path(), match=lambda path: path.endswith(".mirror"), depth=10, )) #check if we have also mirrors in the global folder myuser = self.FolderUserItem() if myuser and myuser.user() != 'global': #get the library name and compute the global path mylib = self.FolderLibraryItem() if mylib: libids = mylib.libraryId().split('/') globalpath = os.path.join( self.library().globalUserFolderPath(), os.path.sep.join(libids)) + '.lib' #add a dummy folder to the path for the 'walkup' to start by the lib globalpath = os.path.join(globalpath, 'dummy') setIterator = studiolibrary.walkup( globalpath, match=lambda path: path.endswith(".mirror"), depth=10, ) paths += list(setIterator) return paths
def selectionSets(self): """ :rtype: list[setsitem.SetsItem] """ path = self.item().path() paths = studiolibrary.walkup( path, match=lambda path: path.endswith(".set"), depth=10, ) items = [] paths = list(paths) libraryWindow = self.item().libraryWindow() for path in paths: item = setsitem.SetsItem(path) item.setLibraryWindow(libraryWindow) items.append(item) return items
def mirrorTable(self): """ Get the mirror table object for this item. :rtype: mutils.MirrorTable or None """ mirrorTable = None mirrorTablePaths = list( studiolibrary.walkup( self.path(), match=lambda path: path.endswith(".mirror"), depth=10, )) if mirrorTablePaths: mirrorTablePath = mirrorTablePaths[0] path = os.path.join(mirrorTablePath, "mirrortable.json") if path: mirrorTable = mutils.MirrorTable.fromPath(path) return mirrorTable