Skip to content

Commit 7cdaa46

Browse files
committed
Merge branch 'RB-10.7'
2 parents 1901544 + f5daaee commit 7cdaa46

15 files changed

Lines changed: 239 additions & 181 deletions

File tree

‎Changes‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@ Breaking Changes
1717
- MeshAlgo : Changed the output of `reverseWinding()`.
1818
- KDTree : Removed deprecated function signatures.
1919

20-
10.7.x.x (relative to 10.7.4.0)
20+
10.7.x.x (relative to 10.7.4.1)
21+
========
22+
23+
24+
25+
10.7.4.1 (relative to 10.7.4.0)
2126
========
2227

2328
Fixes
2429
-----
2530

2631
- PointInstancer : Fixed accessors to accept Varying primitive variables where Vertex is expected, since the two interpolations are equivalent.
2732

33+
API
34+
---
35+
36+
- IECoreUSD::StageAlgo : Added new namespace with a `sceneInterface()` function, providing a SceneInterface for reading an existing `UsdStage`.
37+
2838
10.7.4.0 (relative to 10.7.3.1)
2939
========
3040

‎contrib/IECoreAlembic/test/IECoreAlembic/AlembicSceneTest.py‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,6 @@ def testPointsVaryingInterpolation( self ) :
18991899
IECoreScene.PrimitiveVariable.Interpolation.Vertex,
19001900
)
19011901

1902-
@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
19031902
def testCancel ( self ) :
19041903

19051904
strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 100000, 1 ) ), imath.V2i( 100000, 1 ) )
@@ -1916,25 +1915,10 @@ def testCancel ( self ) :
19161915
readRoot = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )
19171916

19181917
canceller = IECore.Canceller()
1919-
cancelled = [False]
1920-
1921-
def backgroundRun():
1922-
try:
1923-
readRoot.child( "sphere" ).readObject( 0.0, canceller )
1924-
except IECore.Cancelled:
1925-
cancelled[0] = True
1926-
1927-
thread = threading.Thread(target=backgroundRun, args=())
1928-
1929-
startTime = time.time()
1930-
thread.start()
1931-
1932-
time.sleep( 0.01 )
19331918
canceller.cancel()
1934-
thread.join()
19351919

1936-
self.assertLess( time.time() - startTime, 0.1 if IECore.isDebug() else 0.06 )
1937-
self.assertTrue( cancelled[0] )
1920+
with self.assertRaises( IECore.Cancelled ):
1921+
readRoot.child( "sphere" ).readObject( 0.0, canceller )
19381922

19391923
def testIndexedCurveUVs( self ) :
19401924

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2026, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
#ifndef IECOREUSD_STAGEALGO_H
36+
#define IECOREUSD_STAGEALGO_H
37+
38+
#include "IECoreUSD/Export.h"
39+
40+
#include "IECoreScene/SceneInterface.h"
41+
42+
IECORE_PUSH_DEFAULT_VISIBILITY
43+
#include "pxr/usd/usd/stage.h"
44+
IECORE_POP_DEFAULT_VISIBILITY
45+
46+
namespace IECoreUSD
47+
{
48+
49+
namespace StageAlgo
50+
{
51+
52+
IECOREUSD_API IECoreScene::SceneInterfacePtr sceneInterface( const pxr::UsdStageRefPtr &stage );
53+
54+
} // namespace StageAlgo
55+
56+
} // namespace IECoreUSD
57+
58+
#endif // IECOREUSD_STAGEALGO_H

‎contrib/IECoreUSD/python/IECoreUSD/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
__import__( "pxr.Vt" )
4141
__import__( "pxr.Sdf" )
4242

43+
__import__( "IECoreScene" )
44+
4345
from ._IECoreUSD import *
4446

4547
__import__( "IECore" ).loadConfig( "CORTEX_STARTUP_PATHS", subdirectory = "IECoreUSD" )
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (c) 2026, Image Engine Design Inc. All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are
7+
// met:
8+
//
9+
// * Redistributions of source code must retain the above copyright
10+
// notice, this list of conditions and the following disclaimer.
11+
//
12+
// * Redistributions in binary form must reproduce the above copyright
13+
// notice, this list of conditions and the following disclaimer in the
14+
// documentation and/or other materials provided with the distribution.
15+
//
16+
// * Neither the name of Image Engine Design nor the names of any
17+
// other contributors to this software may be used to endorse or
18+
// promote products derived from this software without specific prior
19+
// written permission.
20+
//
21+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
//
33+
//////////////////////////////////////////////////////////////////////////
34+
35+
#include "IECoreUSD/StageAlgo.h"
36+
37+
#include "USDScene.h"
38+
39+
using namespace IECoreUSD;
40+
41+
IECoreScene::SceneInterfacePtr IECoreUSD::StageAlgo::sceneInterface( const pxr::UsdStageRefPtr &stage )
42+
{
43+
return new USDScene( stage, IECore::IndexedIO::Read );
44+
}

‎contrib/IECoreUSD/src/IECoreUSD/bindings/IEUSDModule.cpp‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include "IECoreUSD/DataAlgo.h"
3636
#include "IECoreUSD/SceneCacheDataAlgo.h"
37+
#include "IECoreUSD/StageAlgo.h"
3738

3839
#include "IECoreScene/SceneInterface.h"
3940

@@ -101,8 +102,11 @@ struct PxrBoostConverter
101102
static void registerConverters()
102103
{
103104
boost::python::to_python_converter<T, ToPxrBoost>();
104-
/// \todo Add conversion from Python when we have
105-
/// a use for it. See PyBindConverter for an example.
105+
boost::python::converter::registry::push_back(
106+
&FromPxrBoost::convertible,
107+
&FromPxrBoost::construct,
108+
boost::python::type_id<T>()
109+
);
106110
}
107111

108112
private :
@@ -117,6 +121,25 @@ struct PxrBoostConverter
117121
}
118122
};
119123

124+
struct FromPxrBoost
125+
{
126+
127+
static void *convertible( PyObject *object )
128+
{
129+
return pxr::pxr_boost::python::extract<T>( object ).check() ? object : nullptr;
130+
}
131+
132+
static void construct( PyObject *object, boost::python::converter::rvalue_from_python_stage1_data *data )
133+
{
134+
void *storage = ( ( boost::python::converter::rvalue_from_python_storage<T> * ) data )->storage.bytes;
135+
T *t = new( storage ) T;
136+
data->convertible = storage;
137+
138+
*t = pxr::pxr_boost::python::extract<T>( object )();
139+
}
140+
141+
};
142+
120143
};
121144

122145
#endif // PXR_VERSION >= 2505
@@ -129,6 +152,7 @@ BOOST_PYTHON_MODULE( _IECoreUSD )
129152
PxrBoostConverter<pxr::TfToken>::registerConverters();
130153
PxrBoostConverter<pxr::VtValue>::registerConverters();
131154
PxrBoostConverter<pxr::SdfValueTypeName>::registerConverters();
155+
PxrBoostConverter<pxr::UsdStageRefPtr>::registerConverters();
132156
#endif
133157

134158
{
@@ -152,4 +176,12 @@ BOOST_PYTHON_MODULE( _IECoreUSD )
152176
def( "toInternalPath", toInternalPath );
153177
def( "fromInternalPath", fromInternalPath );
154178
}
179+
180+
{
181+
object stageAlgoModule( handle<>( borrowed( PyImport_AddModule( "IECoreUSD.StageAlgo" ) ) ) );
182+
scope().attr( "StageAlgo" ) = stageAlgoModule;
183+
scope stageAlgoModuleScope( stageAlgoModule );
184+
185+
def( "sceneInterface", &StageAlgo::sceneInterface );
186+
}
155187
}

‎contrib/IECoreUSD/test/IECoreUSD/All.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from USDSceneTest import USDSceneTest
4242
from SceneCacheFileFormatTest import SceneCacheFileFormatTest
4343
from DataAlgoTest import DataAlgoTest
44+
from StageAlgoTest import StageAlgoTest
4445

4546
unittest.TestProgram(
4647
testRunner = unittest.TextTestRunner(
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
##########################################################################
2+
#
3+
# Copyright (c) 2026, Image Engine Design Inc. All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
#
12+
# * Redistributions in binary form must reproduce the above copyright
13+
# notice, this list of conditions and the following disclaimer in the
14+
# documentation and/or other materials provided with the distribution.
15+
#
16+
# * Neither the name of Image Engine Design nor the names of any
17+
# other contributors to this software may be used to endorse or
18+
# promote products derived from this software without specific prior
19+
# written permission.
20+
#
21+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
#
33+
##########################################################################
34+
35+
import unittest
36+
37+
import pxr.Usd
38+
import pxr.UsdGeom
39+
40+
import IECoreScene
41+
import IECoreUSD
42+
43+
class StageAlgoTest( unittest.TestCase ) :
44+
45+
def testSceneInterface( self ) :
46+
47+
stage = pxr.Usd.Stage.CreateInMemory()
48+
pxr.UsdGeom.Sphere.Define( stage, "/sphere" )
49+
50+
root = IECoreUSD.StageAlgo.sceneInterface( stage )
51+
del stage
52+
53+
self.assertIsInstance( root, IECoreScene.SceneInterface )
54+
self.assertEqual( root.childNames(), [ "sphere" ] )
55+
self.assertIsInstance( root.child( "sphere" ).readObject( 0 ), IECoreScene.SpherePrimitive )
56+
57+
if __name__ == "__main__":
58+
unittest.main()

‎contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py‎

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2673,7 +2673,6 @@ def testInstancedSkinning( self ) :
26732673

26742674
self.assertEqual( len( unskinnedHashes ), 1 )
26752675

2676-
@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
26772676
def testCancel ( self ) :
26782677

26792678
strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 100000, 1 ) ), imath.V2i( 100000, 1 ) )
@@ -2690,25 +2689,10 @@ def testCancel ( self ) :
26902689
readRoot = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )
26912690

26922691
canceller = IECore.Canceller()
2693-
cancelled = [False]
2694-
2695-
def backgroundRun():
2696-
try:
2697-
readRoot.child( "sphere" ).readObject( 0.0, canceller )
2698-
except IECore.Cancelled:
2699-
cancelled[0] = True
2700-
2701-
thread = threading.Thread(target=backgroundRun, args=())
2702-
2703-
startTime = time.time()
2704-
thread.start()
2705-
2706-
time.sleep( 0.01 )
27072692
canceller.cancel()
2708-
thread.join()
27092693

2710-
self.assertLess( time.time() - startTime, 0.03 )
2711-
self.assertTrue( cancelled[0] )
2694+
with self.assertRaises( IECore.Cancelled ):
2695+
readRoot.child( "sphere" ).readObject( 0.0, canceller )
27122696

27132697
def testCustomAttributes( self ) :
27142698

‎test/IECoreScene/MeshAlgoDistributePointsTest.py‎

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -419,37 +419,18 @@ def testZeroAreaPolygons( self ):
419419
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 1 )
420420
self.assertEqual( len( p["P"].data ), 0 )
421421

422-
@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
423422
def testCancel( self ) :
424423
# Initializing the points distribution is slow and not cancellable
425424
# Pre-initialize it so it doesn't mess with our timing
426425
IECore.PointDistribution.defaultInstance()
427426

428427
canceller = IECore.Canceller()
429-
cancelled = [False]
428+
canceller.cancel()
430429

431430
m = IECore.Reader.create( os.path.join( "test", "IECore", "data", "cobFiles", "pCubeShape1.cob" ) ).read()
432431

433-
def backgroundRun():
434-
try:
435-
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 10000000, offset = imath.V2f( 0.0001, 0.0001 ), canceller = canceller )
436-
except IECore.Cancelled:
437-
cancelled[0] = True
438-
439-
thread = threading.Thread(target=backgroundRun, args=())
440-
441-
startTime = time.time()
442-
thread.start()
443-
444-
time.sleep( 0.1 )
445-
canceller.cancel()
446-
thread.join()
447-
448-
# This test should actually produce a time extremely close to the sleep duration ( within
449-
# 0.003 seconds whether the sleep duration is 0.01 seconds or 100 seconds ), but checking
450-
# that it terminates with 0.1 seconds is a minimal performance bar
451-
self.assertLess( time.time() - startTime, 0.2 )
452-
self.assertTrue( cancelled[0] )
432+
with self.assertRaises( IECore.Cancelled ):
433+
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 10000000, offset = imath.V2f( 0.0001, 0.0001 ), canceller = canceller )
453434

454435
@unittest.skipIf( True, "Not running slow perf tests by default" )
455436
def testPerformance( self ) :

0 commit comments

Comments
 (0)