Пример #1
0
    def test(self):

        plane = GafferScene.Plane()

        options = GafferScene.CustomOptions()
        options["in"].setInput(plane["out"])

        deleteOptions = GafferScene.DeleteOptions()
        deleteOptions["in"].setInput(options["out"])

        # test that by default the scene is passed through

        self.assertScenesEqual(plane["out"], deleteOptions["out"])
        self.assertSceneHashesEqual(plane["out"], deleteOptions["out"])

        # test that we can delete options

        options["options"].addMember("test1", 1)
        options["options"].addMember("test2", 2)
        options["options"].addMember("test3", 3)

        g = deleteOptions["out"]["globals"].getValue()

        self.assertEqual(g["option:test1"], IECore.IntData(1))
        self.assertEqual(g["option:test2"], IECore.IntData(2))
        self.assertEqual(g["option:test3"], IECore.IntData(3))

        deleteOptions["names"].setValue("test1 test2")

        g = deleteOptions["out"]["globals"].getValue()

        self.assertEqual(g["option:test3"], IECore.IntData(3))
        self.assertFalse("option:test1" in g)
        self.assertFalse("option:test2" in g)

        deleteOptions["names"].setValue("test*")

        g = deleteOptions["out"]["globals"].getValue()

        self.assertFalse("option:test1" in g)
        self.assertFalse("option:test2" in g)
        self.assertFalse("option:test3" in g)

        # test dirty propagation

        cs = GafferTest.CapturingSlot(deleteOptions.plugDirtiedSignal())

        deleteOptions["names"].setValue("")
        self.assertTrue(deleteOptions["out"]["globals"] in set(e[0]
                                                               for e in cs))

        del cs[:]

        deleteOptions["invertNames"].setValue(True)
        self.assertTrue(deleteOptions["out"]["globals"] in set(e[0]
                                                               for e in cs))
Пример #2
0
    def test(self):

        plane = GafferScene.Plane()

        options = GafferScene.CustomOptions()
        options["in"].setInput(plane["out"])

        deleteOptions = GafferScene.DeleteOptions()
        deleteOptions["in"].setInput(options["out"])

        copyOptions = GafferScene.CopyOptions()
        copyOptions["in"].setInput(deleteOptions["out"])
        copyOptions["source"].setInput(options["out"])

        # set up some options that we can delete and copy
        options["options"].addMember("test1", 1)
        options["options"].addMember("test2", 2)
        options["options"].addMember("test3", 3)

        # verify result
        g = deleteOptions["out"]["globals"].getValue()
        self.assertEqual(g["option:test1"], IECore.IntData(1))
        self.assertEqual(g["option:test2"], IECore.IntData(2))
        self.assertEqual(g["option:test3"], IECore.IntData(3))

        # delete options
        deleteOptions["names"].setValue("test*")

        # verify result
        g = deleteOptions["out"]["globals"].getValue()
        self.assertFalse("option:test1" in g)
        self.assertFalse("option:test2" in g)
        self.assertFalse("option:test3" in g)

        # copy options
        copyOptions["names"].setValue("test*")

        # verify result
        g = copyOptions["out"]["globals"].getValue()
        self.assertEqual(g["option:test1"], IECore.IntData(1))
        self.assertEqual(g["option:test2"], IECore.IntData(2))
        self.assertEqual(g["option:test3"], IECore.IntData(3))

        # test dirty propagation
        cs = GafferTest.CapturingSlot(copyOptions.plugDirtiedSignal())

        copyOptions["names"].setValue("")
        self.assertTrue(copyOptions["out"]["globals"] in set(e[0] for e in cs))