From 16a16d9b3e3bdb828558d663475d286f01f6afdb Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 20 Apr 2024 13:47:46 +1000 Subject: [PATCH] IECoreUSD : Alembic referenced in a USD stage places the indices of an indexed primitive variable into an attribute --- .../IECoreUSD/test/IECoreUSD/USDSceneTest.py | 24 ++++++++++++++++++ .../test/IECoreUSD/data/alembicIndices.abc | Bin 0 -> 3222 bytes .../test/IECoreUSD/data/alembicIndices.usda | 8 ++++++ 3 files changed, 32 insertions(+) create mode 100644 contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc create mode 100644 contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda diff --git a/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py b/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py index 5bd4576222..7893c311b9 100644 --- a/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py +++ b/contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py @@ -4001,5 +4001,29 @@ def testRoundTripArnoldLight( self ) : self.assertIn( "__lights", root.setNames() ) self.assertEqual( root.readSet( "__lights" ), IECore.PathMatcher( [ "/light" ] ) ) + def testAlembicIndices( self ) : + + root = IECoreScene.SceneInterface.create( os.path.dirname( __file__ ) + "/data/alembicIndices.usda", IECore.IndexedIO.OpenMode.Read ) + + cube = root.child( "cube" ) + self.assertEqual( cube.attributeNames(), [] ) + self.assertFalse( cube.hasAttribute( "primvars:custom:indices" ) ) + + primitive = cube.readObject( 1.0 ) + self.assertEqual( + set( primitive.keys() ), + { "P", "N", "uv", "custom" } + ) + comparison = IECoreScene.PrimitiveVariable( + IECoreScene.PrimitiveVariable.Interpolation.FaceVarying, + IECore.Color3fVectorData( + [ imath.Color3f( 1, 0, 0 ), imath.Color3f( 0, 1, 0 ), imath.Color3f( 0, 0, 1 ), + imath.Color3f( 1, 1, 0 ), imath.Color3f( 0, 1, 1 ), imath.Color3f( 1, 1, 1 ) ] + ), + IECore.IntVectorData( [ 1, 1, 1, 1, 4, 4, 4, 4, 0, 0, 0, 0, 5, 5, 5, 5, 2, 2, 2, 2, 3, 3, 3, 3 ] ) + ) + self.assertEqual( primitive["custom"], comparison ) + self.assertEqual( primitive["custom"].indices(), comparison.indices() ) + if __name__ == "__main__": unittest.main() diff --git a/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.abc new file mode 100644 index 0000000000000000000000000000000000000000..dac2ca9e078bdba5a8cbe0dbbf59277689ed1365 GIT binary patch literal 3222 zcmb_dYitx%6ut|zba_cJpp8}sd88nY`=HS7vh)Q770L=l`2pR|?oQjm*`3YI?9v*Q zNg4zpNJ--l(S%q+B>YfHMbjv>sZk^fY6KxFh(<{HA&-~{7z^Gr_uTEWP{rs;?w)&I z_niBkduEq4O6#PX#8Eef*ffH%TlU_Wgp{McV)~(T7c2YL?4Ngihdg!l5vD%dGXyU~ zeVQlmoMUIMd?cLjomqW++tl*Y?^HUdK661GnG3_xEQjtg*Dxw)uHjV9Twnvj{FW^c zVy(i>=vV9XsuOi*3J*^c*3Z3n1~p;L=x|3Fd@}vGJjnTdzgZsJbLrZltGn-Uom|}8 zIi8-{ld&KdmtmhRgN^IBopZ3k0-5tNo_Bw=du8-#PmAi=e697vqYJ5zjWgf@_yER$ zBglY%E?pz(0v&$~;0HRefgbjtgBZ|(AH)I`F-Deb=y>zt`(Mld;<0Z(85p?sWo9ok z_ZIs9*uMA03AMX7pIr2m`vToeeVK!VUPH0}-;Wn;?W#U;=**Fs z&bp2B&Ry8*b8$qmQx=wFalHjl(^lHQls|x*j?(eO;m8qFl4>k3q%YNxCo1u%5|IrS zK}a8Thtgi;-!Yy(Ixp+!bV|0d?BL9lGlYLiSqzVXQX%rCjHgouvySE|Pq9I>>|mOb z>+7@hOia&X+7Aac9bbS4b(FXW2kAiy(rp;^W1;;RKwvUx0elDuagp3e(lE6cuW2%K zAr}FKbPDV3MZO1l8}eE#E`jm@_Flze1^X02o;0-s-VYXZ z{jgw(@^04@nEP7@2A)wp$q^fAQT+N}^XtQ`XS8YslSu*Ud8^LiE93I@EO|S=N^UP= zX|1`869(%jG18={QNYz<$iN^NNGMf=N4O+u0qs!-)vScyC% z>xQDm11Jh^u|)I=Md75PnnFcF7X**sad~D79=Fd^>MJgt;kTm`2~~+mCWKaLx+ymc zZkJdr&JjJfeSu`k&(cPkay(Gml(bKBmk91+pUdm>&asblVKp2lLN1pL?rHz2{iaPj z*Q36E<;vY2&K&CY=jaT4G0*KCOIYrD#8%}DiqYzmZh@M6iT`M%v32Ea%~F*nY(}=D5*=s ze~QKg%ff4G6;mBdkWqur{$|~mm1Y&pXei~KKZJg$gL#~fO*wu6>4(`Si++HBtVeK` ODjB!FLY~LIrq*AYJykgX literal 0 HcmV?d00001 diff --git a/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda new file mode 100644 index 0000000000..b71d112909 --- /dev/null +++ b/contrib/IECoreUSD/test/IECoreUSD/data/alembicIndices.usda @@ -0,0 +1,8 @@ +#usda 1.0 + +def Mesh "cube" ( + references = @./alembicIndices.abc@ +) +{ +} +