Ejemplo n.º 1
0
 def addAOVLayout(self, aovReorder=None):
     '''Add an aov control for each aov registered for this node type'''
     aovAttrs = aovs.getNodeGlobalAOVData(nodeType=self.nodeType())
     if aovReorder:  #do some reordering based on the passed string list
         i = 0
         aovMap = {}
         for aov in aovReorder:
             aovMap[aov] = i
             i += 1
         aovAttrs = sorted(aovAttrs, key=lambda aov: aovMap[aov[0]])
     if aovAttrs:
         self.beginLayout("AOV Names", collapse=True)
         #            self.beginNoOptimize()
         #            self.addControl('enableAOVs', label='Enable AOVs')
         #            self.addControl('overrideAOVs', label='Override AOV Names')
         #            self.endNoOptimize()
         dynamic = self.nodeType() not in set(
             pm.pluginInfo("mtoa", q=True, dependNode=True))
         for name, attr, type in aovAttrs:
             if dynamic:
                 attr = 'ai_' + attr
             if self.convertToMayaStyle:
                 attr = toMayaStyle(attr)
             self.addAOVControl(attr)
         self.endLayout()
Ejemplo n.º 2
0
def getAOVsInNetwork(rootNode):
    '''
    returns a map from PyNode to aovs
    
    the aov list contains all registered aovs for that node type, regardless of whether
    they are currently enabled in the globals 
    '''
    results = {}
    for node in pm.listHistory(rootNode, pruneDagObjects=True):
        # TODO: Create a general method to assign AOVs of hidden nodes
        # lambert shader has only translator registered so this is a Lambert Maya node and does not have an AOV tab
        if pm.nodeType(node) == "lambert":
            results[node] = [u'direct_diffuse', u'indirect_diffuse']
        else:
            # TODO: cache this result
            results[node] = [node.attr(at).get() for (aov, at, type) in aovs.getNodeGlobalAOVData(node.type())]
    return results
Ejemplo n.º 3
0
def getAOVsInNetwork(rootNode):
    '''
    returns a map from PyNode to aovs
    
    the aov list contains all registered aovs for that node type, regardless of whether
    they are currently enabled in the globals 
    '''
    results = {}
    for node in pm.listHistory(rootNode, pruneDagObjects=True):
        # TODO: Create a general method to assign AOVs of hidden nodes
        # lambert shader has only translator registered so this is a Lambert Maya node and does not have an AOV tab
        if pm.nodeType(node) == "lambert":
            results[node] = [u'direct_diffuse', u'indirect_diffuse']
        else:
            # TODO: cache this result
            results[node] = [
                node.attr(at).get()
                for (aov, at, type) in aovs.getNodeGlobalAOVData(node.type())
            ]
    return results
Ejemplo n.º 4
0
    def addAOVLayout(self, aovReorder = None):
        '''Add an aov control for each aov registered for this node type'''
        aovAttrs = aovs.getNodeGlobalAOVData(nodeType=self.nodeType())
        if aovReorder: #do some reordering based on the passed string list
            i = 0
            aovMap = {}
            for aov in aovReorder:
                aovMap[aov] = i
                i += 1
            aovAttrs = sorted(aovAttrs, key = lambda aov: aovMap[aov[0]])
        if aovAttrs:
            self.beginLayout("AOV Names", collapse=True)
#            self.beginNoOptimize()
#            self.addControl('enableAOVs', label='Enable AOVs')
#            self.addControl('overrideAOVs', label='Override AOV Names')
#            self.endNoOptimize()
            dynamic = self.nodeType() not in set(pm.pluginInfo("mtoa", q=True, dependNode=True))
            for name, attr, type in aovAttrs:
                if dynamic:
                    attr = 'ai_' + attr
                if self.convertToMayaStyle:
                    attr = toMayaStyle(attr)
                self.addAOVControl(attr)
            self.endLayout()