

def testDependencyNode(self):
    s = Gaffer.ScriptNode()
    s['r'] = Gaffer.Reference()
    self.assertTrue(isinstance(s['r'], Gaffer.DependencyNode))
    self.assertTrue(s['r'].isInstanceOf(Gaffer.DependencyNode.staticTypeId()))
    self.assertTrue(isinstance(s['r'], Gaffer.SubGraph))
    self.assertTrue(s['r'].isInstanceOf(Gaffer.SubGraph.staticTypeId()))
    s['b'] = Gaffer.Box()
    s['b']['n'] = GafferTest.AddNode()
    s['b'].promotePlug(s['b']['n']['sum'])
    s['b'].exportForReference('/tmp/test.grf')
    s['r'].load('/tmp/test.grf')
    self.assertEqual(s['r'].correspondingInput(s['r']['sum']), None)
    self.assertEqual(s['r'].enabledPlug(), None)
    s['b'].promotePlug(s['b']['n']['op1'])
    s['b']['n']['op2'].setValue(10)
    s['b'].exportForReference('/tmp/test.grf')
    s['r'].load('/tmp/test.grf')
    self.assertEqual(s['r'].correspondingInput(s['r']['sum']), None)
    self.assertEqual(s['r'].enabledPlug(), None)
    s['b']['enabled'] = Gaffer.BoolPlug(flags=(Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic))
    s['b'].exportForReference('/tmp/test.grf')
    s['r'].load('/tmp/test.grf')
    self.assertEqual(s['r'].correspondingInput(s['r']['sum']), None)
    self.assertTrue(s['r'].enabledPlug().isSame(s['r']['enabled']))
    s['b']['n']['enabled'].setInput(s['b']['enabled'])
    s['b'].exportForReference('/tmp/test.grf')
    s['r'].load('/tmp/test.grf')
    self.assertTrue(s['r'].enabledPlug().isSame(s['r']['enabled']))
    self.assertTrue(s['r'].correspondingInput(s['r']['sum']).isSame(s['r']['op1']))
    s['a'] = GafferTest.AddNode()
    s['r']['op1'].setInput(s['a']['sum'])
    s['c'] = GafferTest.AddNode()
    s['c']['op1'].setInput(s['r']['sum'])
    s.deleteNodes(filter=Gaffer.StandardSet([s['r']]))
    self.assertTrue(s['c']['op1'].getInput().isSame(s['a']['sum']))

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/ReferenceTest.py ReferenceTest.testDependencyNode/original