예제 #1
0
def explodeCollapsedNode(collapsedNode):
    parentNode = collapsedNode.parent()
    extractedNodes = collapsedNode.nodes()
    if parentNode:
        connections = []
        for attribute in collapsedNode.attributes():
            input = attribute.input()
            outputs = attribute.outputs()
            if input and outputs:
                connections.append([input, outputs])

            if input:
                attribute.disconnectInput()

            for output in outputs:
                output.disconnectInput()

        for node in collapsedNode.nodes():
            collapsedNode.removeNode(node)
            parentNode.addNode(node)

        for connection in connections:
            source = connection[0]
            dests = connection[1]

            for dest in dests:
                NetworkManager.connect(source, dest)
    else:
        raise coralApp.logError("collapsedNode has no parent to explode onto.")

    return extractedNodes
예제 #2
0
def explodeCollapsedNode(collapsedNode):
    parentNode = collapsedNode.parent()
    extractedNodes = collapsedNode.nodes()
    if parentNode:
        connections = []
        for attribute in collapsedNode.attributes():
            input = attribute.input()
            outputs = attribute.outputs()
            if input and outputs:
                connections.append([input, outputs])
        
            if input:
                attribute.disconnectInput()
        
            for output in outputs:
                output.disconnectInput()
    
    
        for node in collapsedNode.nodes():
            collapsedNode.removeNode(node)
            parentNode.addNode(node)
    
        for connection in connections:
            source = connection[0]
            dests = connection[1]
            
            for dest in dests:
                NetworkManager.connect(source, dest)
    else:
        raise coralApp.logError("collapsedNode has no parent to explode onto.")
    
    return extractedNodes
예제 #3
0
    def doIt(self):
        success = False
        error = None

        sourceAttributeName = self.argAsString("sourceAttribute")
        destinationAttributeName = self.argAsString("destinationAttribute")

        sourceAttribute = coralApp.findAttribute(sourceAttributeName)
        destinationAttribute = coralApp.findAttribute(destinationAttributeName)

        if sourceAttribute and destinationAttribute:
            if destinationAttribute.input() is not None:
                destinationAttribute.disconnectInput()

            error = ErrorObject()
            success = NetworkManager.connect(sourceAttribute,
                                             destinationAttribute, error)

        if not success:
            errorMessage = "error during connection between " + sourceAttributeName + " and " + destinationAttributeName + "\n"
            if error:
                if error.message():
                    errorMessage += "extended info: " + error.message()

            coralApp.logDebug(errorMessage)
예제 #4
0
def collapseNodes(nodes, collapsedNode=None):
    parentNode = _checkNodesShareSameParent(nodes)

    if collapsedNode is None:
        collapsedNode = coralApp.createNode(
            CollapserData.collapsedNodeClassName,
            CollapserData.collapsedNodeClassName, parentNode)

    inPassAttrs = {}
    outPassAttrs = {}

    for node in nodes:
        disconnectedAttributes = _disconnectConnectedInputs(node, nodes)

        inputAttributes = disconnectedAttributes[0]
        inputAttributesWithOutputConnections = disconnectedAttributes[1]

        outputAttributes = _disconnectConnectedOutputs(node, nodes)

        parentNode.removeNode(node)
        collapsedNode.addNode(node)

        for attr in inputAttributes:
            sourceAttr = attr[0]
            destAttr = attr[1]

            passAttrName = sourceAttr.parent().name() + "_" + sourceAttr.name()
            if inPassAttrs.has_key(passAttrName) == False:
                passAttr = coralApp.createAttribute("PassThroughAttribute",
                                                    "input",
                                                    collapsedNode,
                                                    input=True)
                NetworkManager.connect(sourceAttr, passAttr)
                inPassAttrs[passAttrName] = passAttr
            else:
                passAttr = inPassAttrs[passAttrName]

            NetworkManager.connect(passAttr, destAttr)

        for attr in outputAttributes:
            sourceAttr = attr[0]
            destAttr = attr[1]

            passAttrName = sourceAttr.parent().name() + "_" + sourceAttr.name()
            if outPassAttrs.has_key(passAttrName) == False:
                passAttr = coralApp.createAttribute("PassThroughAttribute",
                                                    "output",
                                                    collapsedNode,
                                                    output=True)
                NetworkManager.connect(sourceAttr, passAttr)
                outPassAttrs[passAttrName] = passAttr
            else:
                passAttr = outPassAttrs[passAttrName]

            NetworkManager.connect(passAttr, destAttr)

    return collapsedNode
예제 #5
0
def collapseNodes(nodes, collapsedNode = None):
    parentNode = _checkNodesShareSameParent(nodes)
    
    if collapsedNode is None:
        collapsedNode = coralApp.createNode(CollapserData.collapsedNodeClassName, CollapserData.collapsedNodeClassName, parentNode)
    
    inPassAttrs = {}
    outPassAttrs = {}
    
    for node in nodes:
        disconnectedAttributes = _disconnectConnectedInputs(node, nodes)
        
        inputAttributes = disconnectedAttributes[0]
        inputAttributesWithOutputConnections = disconnectedAttributes[1]
        
        outputAttributes = _disconnectConnectedOutputs(node, nodes)
        
        parentNode.removeNode(node)
        collapsedNode.addNode(node)
        
        for attr in inputAttributes:
            sourceAttr = attr[0]
            destAttr = attr[1]
            
            passAttrName = sourceAttr.parent().name() + "_" + sourceAttr.name()
            if inPassAttrs.has_key(passAttrName) == False:
                passAttr = coralApp.createAttribute("PassThroughAttribute", "input", collapsedNode, input = True)
                NetworkManager.connect(sourceAttr, passAttr)
                inPassAttrs[passAttrName] = passAttr
            else:
                passAttr = inPassAttrs[passAttrName]
            
            NetworkManager.connect(passAttr, destAttr)
        
        for attr in outputAttributes:
            sourceAttr = attr[0]
            destAttr = attr[1]
            
            passAttrName = sourceAttr.parent().name() + "_" + sourceAttr.name()
            if  outPassAttrs.has_key(passAttrName) == False:
                passAttr = coralApp.createAttribute("PassThroughAttribute", "output", collapsedNode, output = True)
                NetworkManager.connect(sourceAttr, passAttr)
                outPassAttrs[passAttrName] = passAttr
            else:
                passAttr = outPassAttrs[passAttrName]
                
            NetworkManager.connect(passAttr, destAttr)
    
    return collapsedNode
예제 #6
0
 def doIt(self):
     success = False
     error = None
     
     sourceAttributeName = self.argAsString("sourceAttribute")
     destinationAttributeName = self.argAsString("destinationAttribute")
     
     sourceAttribute = coralApp.findAttribute(sourceAttributeName)
     destinationAttribute = coralApp.findAttribute(destinationAttributeName)
     
     if sourceAttribute and destinationAttribute:
         if destinationAttribute.input() is not None:
             destinationAttribute.disconnectInput()
         
         error = ErrorObject()
         success = NetworkManager.connect(sourceAttribute, destinationAttribute, error)
         
     if not success:
         errorMessage = "error during connection between " + sourceAttributeName + " and " + destinationAttributeName + "\n"
         if error:
             if error.message():
                 errorMessage += "extended info: " + error.message()
             
         coralApp.logDebug(errorMessage)