def testSpecializingPass():
    coralApp.init()
    
    collapsed0 = coralApp.createNode("CollapsedNode", "collapsed0", coralApp.rootNode())
    in0 = coralApp.createAttribute("PassThroughAttribute", "in0", collapsed0, input = True)
    out0 = coralApp.createAttribute("PassThroughAttribute", "out0", collapsed0, output = True)
    
    collapsed = coralApp.createNode("CollapsedNode", "collapsed", collapsed0)
    in1 = coralApp.createAttribute("PassThroughAttribute", "in", collapsed, input = True)
    out1 = coralApp.createAttribute("PassThroughAttribute", "out", collapsed, output = True)
    add = coralApp.createNode("Add", "addNode", collapsed)
    
    _coral.NetworkManager.connect(in1, add.inputAttributeAt(0))
    _coral.NetworkManager.connect(add.outputAttributeAt(0), out1)
    
    _coral.NetworkManager.connect(in0, in1)
    _coral.NetworkManager.connect(out1, out0)

    float1 = coralApp.createNode("Float", "float1", coralApp.rootNode())
    floats = coralApp.createNode("Vec3", "floats", coralApp.rootNode())
    
    _coral.NetworkManager.connect(out0, floats.inputAttributeAt(0))
    _coral.NetworkManager.connect(float1.outputAttributeAt(0), in0)
    
    assert add.inputAttributeAt(0).specialization() == ["Float"]
    assert add.outputAttributeAt(0).specialization() == ["Float"]
    
    assert in0.specialization() == ["Float"]
    assert in1.specialization() == ["Float"]
    
    assert out1.specialization() == ["Float"] 
    
    coralApp.finalize()
Example #2
0
def testCollapsingBug1():
    coralApp.init()

    collapsed = coralApp.createNode("CollapsedNode", "collapsed",
                                    coralApp.rootNode())
    in1 = coralApp.createAttribute("PassThroughAttribute",
                                   "in",
                                   collapsed,
                                   input=True)
    add = coralApp.createNode("Add", "addNode", collapsed)

    _coral.NetworkManager.connect(in1, add.inputAttributeAt(0))

    float1 = coralApp.createNode("Float", "float1", coralApp.rootNode())

    _coral.NetworkManager.connect(float1.outputAttributeAt(0), in1)

    newCollapsed = coralApp.collapseNodes([collapsed])
    print "testing collapsing operation won't add erroneous output attributes"
    assert newCollapsed.outputAttributes() == []

    print "testing collapsing operation won't disconnect erroneous attributes"
    assert in1.isConnectedTo(add.inputAttributeAt(0))

    coralApp.finalize()
Example #3
0
def testSpecializingPass():
    coralApp.init()

    collapsed0 = coralApp.createNode("CollapsedNode", "collapsed0",
                                     coralApp.rootNode())
    in0 = coralApp.createAttribute("PassThroughAttribute",
                                   "in0",
                                   collapsed0,
                                   input=True)
    out0 = coralApp.createAttribute("PassThroughAttribute",
                                    "out0",
                                    collapsed0,
                                    output=True)

    collapsed = coralApp.createNode("CollapsedNode", "collapsed", collapsed0)
    in1 = coralApp.createAttribute("PassThroughAttribute",
                                   "in",
                                   collapsed,
                                   input=True)
    out1 = coralApp.createAttribute("PassThroughAttribute",
                                    "out",
                                    collapsed,
                                    output=True)
    add = coralApp.createNode("Add", "addNode", collapsed)

    _coral.NetworkManager.connect(in1, add.inputAttributeAt(0))
    _coral.NetworkManager.connect(add.outputAttributeAt(0), out1)

    _coral.NetworkManager.connect(in0, in1)
    _coral.NetworkManager.connect(out1, out0)

    float1 = coralApp.createNode("Float", "float1", coralApp.rootNode())
    floats = coralApp.createNode("Vec3", "floats", coralApp.rootNode())

    _coral.NetworkManager.connect(out0, floats.inputAttributeAt(0))
    _coral.NetworkManager.connect(float1.outputAttributeAt(0), in0)

    assert add.inputAttributeAt(0).specialization() == ["Float"]
    assert add.outputAttributeAt(0).specialization() == ["Float"]

    assert in0.specialization() == ["Float"]
    assert in1.specialization() == ["Float"]

    assert out1.specialization() == ["Float"]

    coralApp.finalize()
def testCollapsingBug1():
    coralApp.init()
    
    collapsed = coralApp.createNode("CollapsedNode", "collapsed", coralApp.rootNode())
    in1 = coralApp.createAttribute("PassThroughAttribute", "in", collapsed, input = True)
    add = coralApp.createNode("Add", "addNode", collapsed)
    
    _coral.NetworkManager.connect(in1, add.inputAttributeAt(0))

    float1 = coralApp.createNode("Float", "float1", coralApp.rootNode())
        
    _coral.NetworkManager.connect(float1.outputAttributeAt(0), in1)
    
    newCollapsed = coralApp.collapseNodes([collapsed])
    print "testing collapsing operation won't add erroneous output attributes"
    assert newCollapsed.outputAttributes() == []
    
    print "testing collapsing operation won't disconnect erroneous attributes"
    assert in1.isConnectedTo(add.inputAttributeAt(0))
    
    coralApp.finalize()