def testMode( self ) : with IECoreArnold.UniverseBlock() : p = IECore.PointsPrimitive( IECore.V3fVectorData( [ IECore.V3f( i ) for i in range( 0, 10 ) ] ) ) c = IECoreArnold.ToArnoldPointsConverter( p ) n = c.convert() self.assertEqual( arnold.AiNodeGetStr( n, "mode" ), "disk" ) p["type"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, "particle" ) n = c.convert() self.assertEqual( arnold.AiNodeGetStr( n, "mode" ), "disk" ) p["type"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, "disk" ) n = c.convert() self.assertEqual( arnold.AiNodeGetStr( n, "mode" ), "disk" ) p["type"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, "sphere" ) n = c.convert() self.assertEqual( arnold.AiNodeGetStr( n, "mode" ), "sphere" ) p["type"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, "patch" ) n = c.convert() self.assertEqual( arnold.AiNodeGetStr( n, "mode" ), "quad" )
def testConverterResultType( self ) : with IECoreArnold.UniverseBlock() : p = IECore.PointsPrimitive( IECore.V3fVectorData( [ IECore.V3f( i ) for i in range( 0, 10 ) ] ) ) c = IECoreArnold.ToArnoldPointsConverter( p ) n = c.convert() self.failUnless( type( n ) is type( arnold.AiNode( "points" ) ) )
def testConstantPrimitiveVariable( self ) : p = IECore.PointsPrimitive( IECore.V3fVectorData( 10 ) ) p["myPrimVar"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, IECore.IntData( 10 ) ) with IECoreArnold.UniverseBlock() : n = IECoreArnold.ToArnoldPointsConverter( p ).convert() self.assertEqual( arnold.AiNodeGetInt( n, "user:myPrimVar" ), 10 )
def testBooleanPrimitiveVariable( self ) : p = IECore.PointsPrimitive( IECore.V3fVectorData( 10 ) ) p["truePrimVar"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, IECore.BoolData( True ) ) p["falsePrimVar"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Constant, IECore.BoolData( False ) ) with IECoreArnold.UniverseBlock() : n = IECoreArnold.ToArnoldPointsConverter( p ).convert() self.assertEqual( arnold.AiNodeGetBool( n, "user:truePrimVar" ), True ) self.assertEqual( arnold.AiNodeGetBool( n, "user:falsePrimVar" ), False )
def testUniformPrimitiveVariable( self ) : p = IECore.PointsPrimitive( IECore.V3fVectorData( 10 ) ) p["myPrimVar"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Uniform, IECore.IntVectorData( range( 0, 10 ) ) ) with IECoreArnold.UniverseBlock() : n = IECoreArnold.ToArnoldPointsConverter( p ).convert() a = arnold.AiNodeGetArray( n, "user:myPrimVar" ) self.assertEqual( a.contents.nelements, 10 ) for i in range( 0, 10 ) : self.assertEqual( arnold.AiArrayGetInt( a, i ), i )