@@ -66,8 +66,8 @@ def testCanSegmentUsingIntegerPrimvar( self ) :
6666 p12 = imath .V3f ( 1 , 2 , 0 )
6767 p22 = imath .V3f ( 2 , 2 , 0 )
6868
69- self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p20 , p01 , p11 , p21 ], IECore .GeometricData .Interpretation .Point ) )
70- self .assertEqual ( segments [1 ]["P" ].data , IECore .V3fVectorData ( [p01 , p11 , p21 , p02 , p12 , p22 ], IECore .GeometricData .Interpretation .Point ) )
69+ self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p11 , p01 , p20 , p21 ], IECore .GeometricData .Interpretation .Point ) )
70+ self .assertEqual ( segments [1 ]["P" ].data , IECore .V3fVectorData ( [p01 , p11 , p12 , p02 , p21 , p22 ], IECore .GeometricData .Interpretation .Point ) )
7171
7272 def testCanSegmentUsingStringPrimvar ( self ) :
7373 mesh = IECoreScene .MeshPrimitive .createPlane ( imath .Box2f ( imath .V2f ( 0 ), imath .V2f ( 2 ) ), imath .V2i ( 2 ) )
@@ -95,8 +95,8 @@ def testCanSegmentUsingStringPrimvar( self ) :
9595 p12 = imath .V3f ( 1 , 2 , 0 )
9696 p22 = imath .V3f ( 2 , 2 , 0 )
9797
98- self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p01 , p11 , p21 , p12 , p22 ], IECore .GeometricData .Interpretation .Point ) )
99- self .assertEqual ( segments [1 ]["P" ].data , IECore .V3fVectorData ( [p10 , p20 , p01 , p11 , p21 , p02 , p12 ], IECore .GeometricData .Interpretation .Point ) )
98+ self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p11 , p01 , p21 , p22 , p12 ], IECore .GeometricData .Interpretation .Point ) )
99+ self .assertEqual ( segments [1 ]["P" ].data , IECore .V3fVectorData ( [p10 , p20 , p21 , p11 , p01 , p12 , p02 ], IECore .GeometricData .Interpretation .Point ) )
100100
101101 def testSegmentsFullyIfNoSegmentValuesGiven ( self ) :
102102 mesh = IECoreScene .MeshPrimitive .createPlane ( imath .Box2f ( imath .V2f ( 0 ), imath .V2f ( 2 ) ), imath .V2i ( 2 ) )
@@ -130,8 +130,8 @@ def testSegmentsFullyIfNoSegmentValuesGiven( self ) :
130130 s0 = segments [1 ]
131131 s1 = segments [0 ]
132132
133- self .assertEqual ( s0 ["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p01 , p11 , p21 , p12 , p22 ], IECore .GeometricData .Interpretation .Point ) )
134- self .assertEqual ( s1 ["P" ].data , IECore .V3fVectorData ( [p10 , p20 , p01 , p11 , p21 , p02 , p12 ], IECore .GeometricData .Interpretation .Point ) )
133+ self .assertEqual ( s0 ["P" ].data , IECore .V3fVectorData ( [p00 , p10 , p11 , p01 , p21 , p22 , p12 ], IECore .GeometricData .Interpretation .Point ) )
134+ self .assertEqual ( s1 ["P" ].data , IECore .V3fVectorData ( [p10 , p20 , p21 , p11 , p01 , p12 , p02 ], IECore .GeometricData .Interpretation .Point ) )
135135
136136
137137 def testRaisesExceptionIfSegmentKeysNotSameTypeAsPrimvar ( self ) :
@@ -146,7 +146,11 @@ def t() :
146146
147147 self .assertRaises ( RuntimeError , t )
148148
149- def testEmptyPrimitiveIfNotMatching ( self ) :
149+ def testNullPrimitiveIfNotMatching ( self ) :
150+
151+ # Now that we've reimplemented on top of MeshSplitter, this has now changed from the old version
152+ # of segment. We now return a null pointer for primitive variable values that don't exist, instead
153+ # of a mesh with zero faces
150154 mesh = IECoreScene .MeshPrimitive .createPlane ( imath .Box2f ( imath .V2f ( 0 ), imath .V2f ( 2 ) ), imath .V2i ( 2 ) )
151155
152156 mesh ["s" ] = IECoreScene .PrimitiveVariable ( IECoreScene .PrimitiveVariable .Interpolation .Uniform , IECore .StringVectorData ( ["a" , "b" , "a" , "b" ] ) )
@@ -156,8 +160,8 @@ def testEmptyPrimitiveIfNotMatching( self ) :
156160
157161 self .assertEqual ( len ( segments ), 2 )
158162
159- self .assertEqual ( segments [0 ][ "P" ]. data , IECore . V3fVectorData ( [], IECore . GeometricData . Interpretation . Point ) )
160- self .assertEqual ( segments [1 ][ "P" ]. data , IECore . V3fVectorData ( [], IECore . GeometricData . Interpretation . Point ) )
163+ self .assertTrue ( segments [0 ] is None )
164+ self .assertTrue ( segments [1 ] is None )
161165
162166 def testSegmentSubset ( self ) :
163167 mesh = IECoreScene .MeshPrimitive .createPlane ( imath .Box2f ( imath .V2f ( 0 ), imath .V2f ( 2 ) ), imath .V2i ( 2 ) )
@@ -180,7 +184,7 @@ def testSegmentSubset( self ) :
180184 p22 = imath .V3f ( 2 , 2 , 0 )
181185
182186 self .assertEqual ( len ( segments ), 1 )
183- self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p11 , p21 , p12 , p22 ], IECore .GeometricData .Interpretation .Point ) )
187+ self .assertEqual ( segments [0 ]["P" ].data , IECore .V3fVectorData ( [p11 , p21 , p22 , p12 ], IECore .GeometricData .Interpretation .Point ) )
184188 self .assertEqual ( segments [0 ]["s" ].data , IECore .StringVectorData ( ["b" ] ) )
185189
186190
0 commit comments