Beispiel #1
0
 def _removeAOVNode(self, aovNode):
     '''
     Note this does not remove aliases. You must call removeAliases() manually
     '''
     inputs = aovNode.inputs(type=['aiAOVDriver', 'aiAOVFilter'])
     utils.safeDelete(aovNode)
     for input in inputs:
         # callback may have deleted it
         if input.exists() and not input.message.outputs():
             print "deleting", input
Beispiel #2
0
 def _removeAOVNode(self, aovNode):
     '''
     Note this does not remove aliases. You must call removeAliases() manually
     '''
     inputs = aovNode.inputs(type=['aiAOVDriver', 'aiAOVFilter'])
     utils.safeDelete(aovNode)
     for input in inputs:
         # callback may have deleted it
         if input.exists() and not input.message.outputs():
             print "deleting", input
Beispiel #3
0
    def delete(self):
        if self.driverNode.message.outputs() > 1:
            self.outputAttr.driver.disconnect()
        else:
            utils.safeDelete(self.driverNode)

        if self.filterNode.message.outputs() > 1:
            self.outputAttr.filter.disconnect()
        else:
            utils.safeDelete(self.filterNode)
        self.outputAttr.remove()
        pm.deleteUI(self.row)
Beispiel #4
0
    def delete(self):
        if self.driverNode.message.outputs() > 1:
            self.outputAttr.driver.disconnect()
        else:
            utils.safeDelete(self.driverNode)

        if self.filterNode.message.outputs() > 1:
            self.outputAttr.filter.disconnect()
        else:
            utils.safeDelete(self.filterNode)
        self.outputAttr.remove()
        pm.deleteUI(self.row)
Beispiel #5
0
    def outputChangedCallback(self, aovOutputAttr, newValue, outputType,
                              defaultNode):
        """
        change callback for both filter and driver menus
        
        outputType: either 'aiAOVDriver' or 'aiAOVFilter'
        """
        conn = aovOutputAttr.inputs()
        if newValue.startswith('<'):
            isDefault = True
            pm.connectAttr(defaultNode + '.message', aovOutputAttr, force=True)
            outputNode = pm.PyNode(defaultNode)
            pm.select(outputNode)
            if conn and not conn[0].outputs():
                utils.safeDelete(conn[0])
        else:
            isDefault = False
            if conn and conn[0].outputs():
                # other AOVs are dependent on existing filter/driver. create and connect a new one
                outputNode = pm.createNode(outputType)
                pm.connectAttr(outputNode.message, aovOutputAttr, force=True)
            else:
                outputNode = conn[0]
            newValue = newValue.strip('<>')
            outputNode.aiTranslator.set(newValue)

        if outputType == 'aiAOVFilter':
            self.filterNode = outputNode
            hooks.setupFilter(outputNode, self.aovItem.aovName())
            menu = self.filterMenu
        else:
            self.driverNode = outputNode
            hooks.setupDriver(outputNode, self.aovItem.aovName())
            menu = self.driverMenu

        transAttr = outputNode.attr('aiTranslator')
        if not isDefault:
            # change the selected menu item when the translator attribute changes for our driver/filter
            pm.scriptJob(attributeChange=[
                transAttr, lambda: self.translatorChanged(transAttr, menu)
            ],
                         replacePrevious=True,
                         parent=menu)
        else:
            # delete pre-existing scriptJob
            pm.scriptJob(attributeChange=[transAttr, lambda: self.dummy()],
                         replacePrevious=True,
                         parent=menu)

        self.aovItem.outputsChanged = True
Beispiel #6
0
    def outputChangedCallback(self, aovOutputAttr, newValue, outputType, defaultNode):
        """
        change callback for both filter and driver menus
        
        outputType: either 'aiAOVDriver' or 'aiAOVFilter'
        """
        conn = aovOutputAttr.inputs()
        if newValue.startswith('<'):
            isDefault=True
            pm.connectAttr(defaultNode + '.message', aovOutputAttr, force=True)
            outputNode = pm.PyNode(defaultNode)
            pm.select(outputNode)
            if conn and not conn[0].outputs():
                utils.safeDelete(conn[0])
        else:
            isDefault=False
            if conn and conn[0].outputs():
                # other AOVs are dependent on existing filter/driver. create and connect a new one
                outputNode = pm.createNode(outputType)
                pm.connectAttr(outputNode.message, aovOutputAttr, force=True)
            else:
                outputNode = conn[0]
            newValue = newValue.strip('<>')
            outputNode.aiTranslator.set(newValue)

        if outputType == 'aiAOVFilter':
            self.filterNode = outputNode
            hooks.setupFilter(outputNode, self.aovItem.aovName())
            menu = self.filterMenu
        else:
            self.driverNode = outputNode
            hooks.setupDriver(outputNode, self.aovItem.aovName())
            menu = self.driverMenu

        transAttr = outputNode.attr('aiTranslator')
        if not isDefault:
            # change the selected menu item when the translator attribute changes for our driver/filter
            pm.scriptJob(attributeChange=[transAttr, lambda: self.translatorChanged(transAttr, menu)],
                         replacePrevious=True,
                         parent=menu)
        else:
            # delete pre-existing scriptJob
            pm.scriptJob(attributeChange=[transAttr, lambda: self.dummy()],
                         replacePrevious=True,
                         parent=menu)

        self.aovItem.outputsChanged = True