( self )
| 46 | self.assertEqual( o["primVarsToModify"].getValue(), IECore.StringVectorData( [ "P", "N" ] ) ) |
| 47 | |
| 48 | def testTranformation( self ) : |
| 49 | |
| 50 | m = IECoreScene.MeshPrimitive.createBox( imath.Box3f( imath.V3f( -1 ), imath.V3f( 1 ) ) ) |
| 51 | IECoreScene.MeshNormalsOp()( input = m, copyInput = False ) |
| 52 | m["vel"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, IECore.V3fVectorData( [ imath.V3f( 0.5 ) ] * 8, IECore.GeometricData.Interpretation.Vector ) ) |
| 53 | m["notVel"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, IECore.V3fVectorData( [ imath.V3f( 0.5 ) ] * 8 ) ) |
| 54 | |
| 55 | mt = IECoreScene.TransformOp()( input=m, primVarsToModify = IECore.StringVectorData( ["N", "P", "vel", "notVel"] ), matrix = IECore.M44fData( imath.M44f().translate( imath.V3f( 1 ) ) ) ) |
| 56 | |
| 57 | self.assertEqual( mt.bound(), imath.Box3f( imath.V3f( 0 ), imath.V3f( 2 ) ) ) |
| 58 | self.assertEqual( mt["P"].data, IECore.V3fVectorData( [ x + imath.V3f( 1 ) for x in m["P"].data ], IECore.GeometricData.Interpretation.Point ) ) |
| 59 | self.assertEqual( mt["N"].data, m["N"].data ) |
| 60 | self.assertEqual( mt["vel"].data, m["vel"].data ) |
| 61 | self.assertEqual( mt["notVel"].data, m["notVel"].data ) |
| 62 | |
| 63 | ms = IECoreScene.TransformOp()( input=m, primVarsToModify = IECore.StringVectorData( ["N", "P", "vel", "notVel"] ), matrix = IECore.M44fData( imath.M44f().scale( imath.V3f( 1, 2, 3 ) ) ) ) |
| 64 | |
| 65 | self.assertEqual( ms.bound(), imath.Box3f( imath.V3f( -1, -2, -3 ), imath.V3f( 1, 2, 3 ) ) ) |
| 66 | self.assertEqual( ms["P"].data, IECore.V3fVectorData( [ x * imath.V3f( 1, 2, 3 ) for x in m["P"].data ], IECore.GeometricData.Interpretation.Point ) ) |
| 67 | self.assertNotEqual( ms["N"].data, m["N"].data ) |
| 68 | self.assertNotEqual( ms["N"].data, IECore.V3fVectorData( [ x * imath.V3f( 1, 2, 3 ) for x in m["N"].data ], IECore.GeometricData.Interpretation.Normal ) ) |
| 69 | self.assertEqual( ms["vel"].data, IECore.V3fVectorData( [ x * imath.V3f( 1, 2, 3 ) for x in m["vel"].data ], IECore.GeometricData.Interpretation.Vector ) ) |
| 70 | self.assertEqual( ms["notVel"].data, m["notVel"].data ) |
| 71 | |
| 72 | self.assertEqual( ms["P"].data.getInterpretation(), IECore.GeometricData.Interpretation.Point ) |
| 73 | self.assertEqual( ms["N"].data.getInterpretation(), IECore.GeometricData.Interpretation.Normal ) |
| 74 | self.assertEqual( ms["vel"].data.getInterpretation(), IECore.GeometricData.Interpretation.Vector ) |
| 75 | self.assertEqual( ms["notVel"].data.getInterpretation(), IECore.GeometricData.Interpretation.None_ ) |
| 76 | |
| 77 | def testPrimVarParameter( self ) : |
| 78 |
nothing calls this directly
no test coverage detected