コード例 #1
0
    def testProcedural(self):

        r = IECoreArnold.Renderer("/tmp/test.ass")

        with IECore.WorldBlock(r):

            r.procedural(
                r.ExternalProcedural(
                    "someVolumeThing.so",
                    IECore.Box3f(IECore.V3f(-1, -2, -3), IECore.V3f(4, 5, 6)),
                    {
                        "ai:nodeType": "volume",
                        "testFloat": 0.5
                    }))

            volume = self.__allNodes(type=arnold.AI_NODE_SHAPE)[-1]
            self.assertEqual(
                arnold.AiNodeEntryGetName(arnold.AiNodeGetNodeEntry(volume)),
                "volume")

            self.assertEqual(arnold.AiNodeGetPnt(volume, "min"),
                             arnold.AtPoint(-1, -2, -3))
            self.assertEqual(arnold.AiNodeGetPnt(volume, "max"),
                             arnold.AtPoint(4, 5, 6))
            self.assertEqual(arnold.AiNodeGetStr(volume, "dso"),
                             "someVolumeThing.so")
            self.assertEqual(arnold.AiNodeGetFlt(volume, "testFloat"), 0.5)
コード例 #2
0
	def testMotion( self ) :

		c1 = IECore.CurvesPrimitive( IECore.IntVectorData( [ 4 ] ) )
		c2 = IECore.CurvesPrimitive( IECore.IntVectorData( [ 4 ] ) )

		c1["P"] = IECore.PrimitiveVariable(
			IECore.PrimitiveVariable.Interpolation.Vertex,
			IECore.V3fVectorData( [ IECore.V3f( 1 ) ] * 4 ),
		)

		c2["P"] = IECore.PrimitiveVariable(
			IECore.PrimitiveVariable.Interpolation.Vertex,
			IECore.V3fVectorData( [ IECore.V3f( 2 ) ] * 4 ),
		)

		with IECoreArnold.UniverseBlock() :

			n = IECoreArnold.NodeAlgo.convert( [ c1, c2 ], [ -0.25, 0.25 ] )

			a = arnold.AiNodeGetArray( n, "points" )
			self.assertEqual( a.contents.nelements, 4 )
			self.assertEqual( a.contents.nkeys, 2 )

			for i in range( 0, 4 ) :
				self.assertEqual( arnold.AiArrayGetPnt( a, i ), arnold.AtPoint( 1 ) )
			for i in range( 4, 8 ) :
				self.assertEqual( arnold.AiArrayGetPnt( a, i ), arnold.AtPoint( 2 ) )

			a = arnold.AiNodeGetArray( n, "deform_time_samples" )
			self.assertEqual( a.contents.nelements, 2 )
			self.assertEqual( a.contents.nkeys, 1 )
			self.assertEqual( arnold.AiArrayGetFlt( a, 0 ), -0.25 )
			self.assertEqual( arnold.AiArrayGetFlt( a, 1 ), 0.25 )
コード例 #3
0
    def testMotion(self):

        p1 = IECore.PointsPrimitive(IECore.V3fVectorData([IECore.V3f(10)] *
                                                         10))
        p1["width"] = IECore.PrimitiveVariable(
            IECore.PrimitiveVariable.Interpolation.Vertex,
            IECore.FloatVectorData([1] * 10),
        )

        p2 = IECore.PointsPrimitive(IECore.V3fVectorData([IECore.V3f(20)] *
                                                         10))
        p2["width"] = IECore.PrimitiveVariable(
            IECore.PrimitiveVariable.Interpolation.Vertex,
            IECore.FloatVectorData([2] * 10),
        )

        with IECoreArnold.UniverseBlock(writable=True):

            n = IECoreArnold.NodeAlgo.convert([p1, p2], [-0.25, 0.25])

            a = arnold.AiNodeGetArray(n, "points")
            self.assertEqual(a.contents.nelements, 10)
            self.assertEqual(a.contents.nkeys, 2)

            r = arnold.AiNodeGetArray(n, "radius")
            self.assertEqual(a.contents.nelements, 10)
            self.assertEqual(a.contents.nkeys, 2)

            for i in range(0, 10):
                self.assertEqual(arnold.AiArrayGetPnt(a, i),
                                 arnold.AtPoint(10))
                self.assertEqual(arnold.AiArrayGetFlt(r, i), 0.5)
            for i in range(11, 20):
                self.assertEqual(arnold.AiArrayGetPnt(a, i),
                                 arnold.AtPoint(20))
                self.assertEqual(arnold.AiArrayGetFlt(r, i), 1)

            a = arnold.AiNodeGetArray(n, "deform_time_samples")
            self.assertEqual(a.contents.nelements, 2)
            self.assertEqual(a.contents.nkeys, 1)
            self.assertEqual(arnold.AiArrayGetFlt(a, 0), -0.25)
            self.assertEqual(arnold.AiArrayGetFlt(a, 1), 0.25)