Exemple #1
0
    def populate(self) :
        for cache in self.ABCViewerNode.values():
            if cache.cache != "":
                firstLevel = cmds.ABCHierarchy(cache.ABCcache)

                root = treeitem.abcTreeItem(cache, [], "Transform", self)
                #root.setCheckState(0, QtCore.Qt.Unchecked)
                root.checkShaders(self.getLayer())
                root.checkProperties(self.getLayer())
                root.setHasChildren(True)
                cache.itemsTree.append(root)

                if cache.ABCcurPath != None :
                    if cache.ABCcurPath != "/" :
                        paths = cache.ABCcurPath.split("/")
                        if len(paths) > 0 :
                            self.createBranch(root, paths[1:], True)

                self.hierarchyWidget.addTopLevelItem(root)
                self.createBranch(root,firstLevel)
                root.setExpanded(1)

            ### CHECK WILDCARD ASSIGNATIONS
            tags = cache.assignations.getAllTags()
            wildsAdded = []
            tagsAdded = []
            for wild in cache.assignations.getAllWidcards():
                name = wild["name"]
                fromTag = False
                if tags:
                    if name in tags:
                        if not name in tagsAdded :
                            tagsAdded.append(name)
                            self.createTag(root, name, wild["fromfile"])
                            fromTag = True

                if not fromTag:
                    if not name in wildsAdded :
                        wildsAdded.append(name)
                        self.createWildCard(root, name, wild["fromfile"])
                        

            if tags:
                for tag in tags:
                    if not tag in tagsAdded:
                            tagsAdded.append(tag)
                            self.createTag(root, tag, False)
Exemple #2
0
    def populate(self):
        for cache in self.ABCViewerNode.values():
            if cache.cache != "":
                firstLevel = cache.getHierarchy()

                root = treeitem.abcTreeItem(cache, [], "Transform", self)
                #root.setCheckState(0, QtCore.Qt.Unchecked)
                root.checkShaders(self.getLayer())
                root.checkProperties(self.getLayer())
                root.setHasChildren(True)
                cache.itemsTree.append(root)

                if cache.ABCcurPath != None:
                    if cache.ABCcurPath != "/":
                        paths = cache.ABCcurPath.split("/")
                        if len(paths) > 0:
                            self.createBranch(root, paths[1:], True)

                self.hierarchyWidget.addTopLevelItem(root)
                self.createBranch(root, firstLevel)
                root.setExpanded(1)

            ### CHECK WILDCARD ASSIGNATIONS
            tags = cache.assignations.getAllTags()
            wildsAdded = []
            tagsAdded = []
            for wild in cache.assignations.getAllWidcards():
                name = wild["name"]
                fromTag = False
                if tags:
                    if name in tags:
                        if not name in tagsAdded:
                            tagsAdded.append(name)
                            self.createTag(root, name, wild["fromfile"])
                            fromTag = True

                if not fromTag:
                    if not name in wildsAdded:
                        wildsAdded.append(name)
                        self.createWildCard(root, name, wild["fromfile"])

            if tags:
                for tag in tags:
                    if not tag in tagsAdded:
                        tagsAdded.append(tag)
                        self.createTag(root, tag, False)
Exemple #3
0
    def createBranch(self, parentItem, abcchild, hierarchy=False, p="/"):
        ''' 
        createBranch
        This function will create a branch inside the cache hierarchy
        '''
        createdItems = []
        for item in abcchild:
            itemType = item["type"]
            itemName = item["name"]

            itemExists = False
            for i in xrange(0, parentItem.childCount()):
                text = parentItem.child(i).getDisplayPath()
                if str(text) == str(itemName):
                    itemExists = True

            if itemExists == False:
                newItem = treeitem.abcTreeItem(parentItem.cache,
                                               parentItem.path + [itemName],
                                               itemType, self)
                parentItem.cache.itemsTree.append(newItem)

                newItem.checkShaders(self.getLayer())
                newItem.checkProperties(self.getLayer())

                # check if the item has chidren, but go no further...
                childsItems = newItem.cache.getHierarchy(newItem.getPath())
                if childsItems:
                    newItem.setChildIndicatorPolicy(
                        QtGui.QTreeWidgetItem.ShowIndicator)
                    newItem.setHasChildren(True)
                else:
                    newItem.setHasChildren(False)

                parentItem.addChild(newItem)

                if hierarchy == True:
                    parentItem = newItem

                self.hierarchyWidget.resizeColumnToContents(0)
                createdItems.append(newItem)

        return createdItems
Exemple #4
0
    def createBranch(self, parentItem, abcchild, hierarchy = False, p = "/") :
        ''' 
        createBranch
        This function will create a branch inside the cache hierarchy
        '''
        createdItems = []
        for item in abcchild :
            itemType = item.partition(":")[0]
            itemName = item.partition(":")[-1]

            itemExists = False
            for i in xrange(0, parentItem.childCount()) :
                text = parentItem.child(i).getDisplayPath()
                if str(text) == str(itemName) :
                    itemExists = True

            if itemExists == False :
                newItem = treeitem.abcTreeItem(parentItem.cache, parentItem.path + [itemName], itemType, self)
                parentItem.cache.itemsTree.append(newItem)

                newItem.checkShaders(self.getLayer())
                newItem.checkProperties(self.getLayer())
               
                # check if the item has chidren, but go no further...
                childsItems = cmds.ABCHierarchy(newItem.cache.ABCcache, newItem.getPath().replace("/", "|"))
                if childsItems:
                    newItem.setChildIndicatorPolicy(QtGui.QTreeWidgetItem.ShowIndicator)
                    newItem.setHasChildren(True)
                else:
                    newItem.setHasChildren(False)

                parentItem.addChild(newItem)

                if hierarchy == True :
                    parentItem = newItem

                self.hierarchyWidget.resizeColumnToContents(0)
                createdItems.append(newItem)

        return createdItems