Example #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 )
    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)
Example #3
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)
Example #4
0
    ignoreCameraAttributes + ['focus_distance']
}
'''
Now let's create a new class for each "type", let it inherit from a meaningful schema, and let's add its parameters based on the existing dictionary
'''
for key, paramList in typeParams.iteritems():
    if key == 'override':
        continue

    entryNames = entryByType[key]  # list of entry names for this type
    if entryNames == None or len(entryNames) == 0:
        print 'This script is not working...no entries found for type {}'.format(
            key)

    entryName = entryNames[0]  # using the first entry found here
    nentry = ai.AiNodeEntryLookUp(entryName)
    if nentry == None:
        print 'Hey I could not find any AtNodeEntry called {}'.format(
            entryName)
        continue

    # these "base" arnold classes are typed but can't be instantiated
    createArnoldClass(key, 'Typed', paramList, nentry, None, False, False)

    # For the API schemas of arnold common types, we want to remove the attributes from the USD builtin
    if key in nativeUsdList:
        createArnoldClass(key, 'APISchemaBase', paramList, nentry,
                          nativeUsdList[key], True)

for entry in entryList:
    entryName = entry[0]