Skip to content

Commit 0a75d21

Browse files
committed
USDScene : Fix timecodes used by writeBound()
1 parent 5257c71 commit 0a75d21

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Changes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
Fixes
55
-----
66

7-
- USDScene : Fixed timecodes used when writing animated attributes.
7+
- USDScene :
8+
- Fixed timecodes used when writing animated attributes.
9+
- Fixed timecodes used when writing animated bounds.
810

911
10.5.12.0 (relative to 10.5.11.0)
1012
========

contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ void USDScene::writeBound( const Imath::Box3d &bound, double time )
10081008
extent.push_back( DataAlgo::toUSD( Imath::V3f( bound.max ) ) );
10091009

10101010
pxr::UsdAttribute extentAttr = boundable.CreateExtentAttr();
1011-
extentAttr.Set( pxr::VtValue( extent ) );
1011+
extentAttr.Set( pxr::VtValue( extent ), m_root->timeCode( time ) );
10121012
}
10131013

10141014
void USDScene::writeTransform( const Data *transform, double time )

contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,6 +2826,24 @@ def testWriteAnimatedAttribute( self ) :
28262826
for t in ( 0.0, 0.5, 1.0 ) :
28272827
self.assertEqual( child.readAttribute( "user:test", t ), IECore.FloatData( t ) )
28282828

2829+
def testWriteAnimatedBound( self ) :
2830+
2831+
fileName = os.path.join( self.temporaryDirectory(), "test.usda" )
2832+
root = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Write )
2833+
child = root.createChild( "child" )
2834+
2835+
for t in ( 1.0, 1.5, 2.0 ) :
2836+
child.writeObject( IECoreScene.SpherePrimitive( t ), t )
2837+
child.writeBound( imath.Box3d( imath.V3d( -t ), imath.V3d( t ) ), t )
2838+
2839+
del child, root
2840+
2841+
root = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )
2842+
child = root.child( "child" )
2843+
2844+
for t in ( 1.0, 1.5, 2.0 ) :
2845+
self.assertEqual( child.readBound( t ), imath.Box3d( imath.V3d( -t ), imath.V3d( t ) ) )
2846+
28292847
def testShaders( self ) :
28302848

28312849
# Write shaders

0 commit comments

Comments
 (0)