コード例 #1
0
    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
コード例 #2
0
 def fromPath(cls, path, parent=None, libraryWindow=None, **kwargs):
     """
     Return a new SetMenu instance from the given path.
     
     :type path: str
     :type parent: QtWidgets.QMenu or None
     :type libraryWindow: studiolibrary.LibraryWindow or None
     :type kwargs: dict
     :rtype: QtWidgets.QAction
     """
     item = setsitem.SetsItem(path, libraryWindow=libraryWindow)
     return cls(item, parent, enableSelectContent=False, **kwargs)
コード例 #3
0
    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
コード例 #4
0
ファイル: setsmenu.py プロジェクト: Rotomator/OPI_Tools
    def selectionSets(self):
        """
        :rtype: list[setsitem.SetsItem]
        """
        path = self.item().path()

        paths = studiolibrary.findPaths(
            path,
            match=lambda path: path.endswith(".set"),
            direction=studiolibrary.Direction.Up,
            depth=10,
        )

        items = []
        paths = list(paths)
        libraryWidget = self.item().libraryWidget()

        for path in paths:
            item = setsitem.SetsItem(path)
            item.setLibraryWidget(libraryWidget)
            items.append(item)

        return items