Exemple #1
0
	def testMetadataLoading( self ) :

		os.environ["ARNOLD_PLUGIN_PATH"] = os.path.join( os.path.dirname( __file__ ), "metadata" )
		with IECoreArnold.UniverseBlock( writable = True ) :
			pass

		with IECoreArnold.UniverseBlock( writable = False ) :

			e = arnold.AiNodeEntryLookUp( "options" )

			s = arnold.AtStringReturn()
			i = ctypes.c_int()


			arnold.AiMetaDataGetStr( e, "", "cortex.testString", s )
			self.assertEqual( arnold.AtStringToStr( s ), "test" )

			arnold.AiMetaDataGetInt( e, "", "cortex.testInt", i )
			self.assertEqual( i.value, 25 )

			arnold.AiMetaDataGetStr( e, "AA_samples", "cortex.testString", s )
			self.assertEqual( arnold.AtStringToStr( s ), "test2" )

			arnold.AiMetaDataGetInt( e, "AA_samples", "cortex.testInt", i )
			self.assertEqual( i.value, 12 )
Exemple #2
0
def __aiMetadataGetStr(nodeEntry, paramName, name):

    value = arnold.AtStringReturn()
    if arnold.AiMetaDataGetStr(nodeEntry, paramName, name, value):
        return arnold.AtStringToStr(value)

    return None
    def testMetadataLoading(self):

        metadataPath = os.path.join(os.path.dirname(__file__), "metadata")
        if metadataPath not in os.environ["ARNOLD_PLUGIN_PATH"].split(":"):

            # Relaunch test in subprocess with our metadata on the plugin path.

            env = os.environ.copy()
            env["ARNOLD_PLUGIN_PATH"] = env[
                "ARNOLD_PLUGIN_PATH"] + ":" + metadataPath

            try:
                subprocess.check_output([
                    "gaffer", "test",
                    "IECoreArnoldTest.UniverseBlockTest.testMetadataLoading"
                ],
                                        env=env,
                                        stderr=subprocess.STDOUT)
            except subprocess.CalledProcessError as e:
                self.fail(e.output)

        else:

            # Our metadata is on the plugin path. Check that it has been loaded.

            with IECoreArnold.UniverseBlock(writable=False):

                e = arnold.AiNodeEntryLookUp("options")

                s = arnold.AtStringReturn()
                i = ctypes.c_int()

                arnold.AiMetaDataGetStr(e, "", "cortex.testString", s)
                self.assertEqual(arnold.AtStringToStr(s), "test")

                arnold.AiMetaDataGetInt(e, "", "cortex.testInt", i)
                self.assertEqual(i.value, 25)

                arnold.AiMetaDataGetStr(e, "AA_samples", "cortex.testString",
                                        s)
                self.assertEqual(arnold.AtStringToStr(s), "test2")

                arnold.AiMetaDataGetInt(e, "AA_samples", "cortex.testInt", i)
                self.assertEqual(i.value, 12)
Exemple #4
0
    def testMetadataLoading(self):

        with IECoreArnold.UniverseBlock(writable=False):

            e = arnold.AiNodeEntryLookUp("options")

            s = arnold.AtStringReturn()
            i = ctypes.c_int()

            arnold.AiMetaDataGetStr(e, "", "cortex.testString", s)
            self.assertEqual(arnold.AtStringToStr(s), "test")

            arnold.AiMetaDataGetInt(e, "", "cortex.testInt", i)
            self.assertEqual(i.value, 25)

            arnold.AiMetaDataGetStr(e, "AA_samples", "cortex.testString", s)
            self.assertEqual(arnold.AtStringToStr(s), "test2")

            arnold.AiMetaDataGetInt(e, "AA_samples", "cortex.testInt", i)
            self.assertEqual(i.value, 12)