Skip to content

Commit 2ae560c

Browse files
committed
Merge branch 'RB-10.6'
2 parents d445260 + 9649b00 commit 2ae560c

22 files changed

+522
-132
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ jobs:
3333
linux-gcc11,
3434
linux-debug-gcc11,
3535
windows,
36-
windows-debug
36+
windows-debug,
37+
macos-arm64
3738
]
3839

3940
include:
@@ -76,6 +77,15 @@ jobs:
7677
publish: false
7778
jobs: 4
7879

80+
- name: macos-arm64
81+
os: macos-14
82+
buildType: RELEASE
83+
options: .github/workflows/main/options.posix
84+
dependenciesURL: https://github.com/GafferHQ/dependencies/releases/download/10.0.0/gafferDependencies-10.0.0-macos-arm64.tar.gz
85+
tests: testCore testCorePython testScene testImage testAlembic testUSD testVDB
86+
publish: true
87+
jobs: 3
88+
7989
runs-on: ${{ matrix.os }}
8090

8191
container: ${{ matrix.containerImage }}

.github/workflows/main/options.posix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,5 @@ ENV_VARS_TO_IMPORT = "PATH CI"
6363

6464
if platform.system() == "Darwin" :
6565
os.environ["DYLD_FRAMEWORK_PATH"] = libs
66-
ENV_VARS_TO_IMPORT += " DYLD_FRAMEWORK_PATH"
66+
os.environ["PYTHONHOME"] = libs + "/Python.framework/Versions/" + pythonABIVersion
67+
ENV_VARS_TO_IMPORT += " DYLD_FRAMEWORK_PATH PYTHONHOME"

Changes

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,46 @@
33

44

55

6-
10.6.x.x (relative to 10.6.0.1)
6+
10.6.x.x (relative to 10.6.1.0)
77
========
88

9+
Improvements
10+
------------
11+
12+
- ShaderNetwork : Optimised applySubstitutions() for cases where not all shaders need them.
13+
- CurvesPrimitiveEvaluator : Added accessors for getting interpolation coefficients and data indices from Result.
14+
15+
Fixes
16+
-----
17+
18+
- ShaderNetwork::hashSubstitutions : Fixed shader string substitutions that are escaped with backslashes (ie. `myText\<substitutionHandledByArnold\>`).
19+
20+
10.6.1.0 (relative to 10.6.0.2)
21+
========
22+
23+
Improvements
24+
------------
25+
26+
- ShaderNetworkAlgo : Added support for RenderMan's spline convention in `expandSplines()` and `collapseSplines()`.
27+
28+
Fixes
29+
-----
30+
31+
- ConfigLoader : Fixed UnicodeDecodeErrors in non-UTF8 locales.
32+
- USDScene : Fixed identifiers for exported RenderMan shaders, by omitting the `ri:` type prefix.
33+
34+
10.6.0.2 (relative to 10.6.0.1)
35+
========
936

37+
Fixes
38+
-----
39+
40+
- DisplayDriverServer : Fixed to support IPv4-only environments.
41+
42+
API
43+
---
44+
45+
- TypeIds : Claimed range for AtomsGaffer.
1046

1147
10.6.0.1 (relative to 10.6.0.0)
1248
========
@@ -53,10 +89,23 @@ Breaking Changes
5389
- Removed support for `IECORE_RTLD_GLOBAL` environment variable.
5490
- SmoothSkinningData : Removed, along with all associated Ops and Parameters.
5591

56-
10.5.x.x (relative to 10.5.15.3)
92+
10.5.x.x (relative to 10.5.15.4)
93+
=======
94+
95+
96+
97+
10.5.15.4 (relative to 10.5.15.3)
5798
========
5899

100+
Improvements
101+
-----
102+
103+
- IECoreUSD: Added support for root level tags (reading/writing) to our IECoreUSD::SceneCacheData plugin.
104+
105+
Fixes
106+
-----
59107

108+
- IECoreUSD: Fixed crash when using invalid file path with IECoreUSD::SceneCacheFileFormat.
60109

61110
10.5.15.3 (relative to 10.5.15.2)
62111
=========

contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void SceneCacheData::addReference( ConstSceneInterfacePtr scene, SpecData& spec,
217217
addValueClip( spec, times, actives, linkFileName, linkRootPath.GetText() );
218218
}
219219

220-
void SceneCacheData::addInternalRoot( TfTokenVector children )
220+
void SceneCacheData::addInternalRoot( TfTokenVector children, IECoreScene::ConstSceneInterfacePtr scene )
221221
{
222222
// add transform for internal root.
223223
SdfPath internalRootPath = SdfPath::AbsoluteRootPath().AppendChild( SceneCacheDataAlgo::internalRootNameToken() );
@@ -237,6 +237,26 @@ void SceneCacheData::addInternalRoot( TfTokenVector children )
237237
// steal root children
238238
internalRootSpec.fields.push_back( FieldValuePair( SdfChildrenKeys->PrimChildren, children ) );
239239

240+
// add collection
241+
FieldValuePair propertyChildren;
242+
propertyChildren.first = SdfChildrenKeys->PropertyChildren;
243+
TfTokenVector properties;
244+
245+
// we don't want to keep children tags in this case.
246+
m_collections.clear();
247+
248+
SceneInterface::NameList tags;
249+
scene->readTags( tags );
250+
for ( auto& tag : tags )
251+
{
252+
m_collections[tag].push_back( internalRootPath );
253+
}
254+
255+
addCollections( internalRootSpec, properties, internalRootPath );
256+
257+
propertyChildren.second = properties;
258+
internalRootSpec.fields.push_back( propertyChildren );
259+
240260
m_data[internalRootPath] = internalRootSpec;
241261
}
242262

@@ -344,7 +364,7 @@ void SceneCacheData::loadSceneIntoCache( ConstSceneInterfacePtr scene )
344364
// end timecode
345365
spec.fields.push_back( FieldValuePair( SdfFieldKeys->EndTimeCode, lastFrame ) );
346366

347-
addInternalRoot( children );
367+
addInternalRoot( children, scene );
348368

349369
// add internal root as single child
350370
children.clear();

contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class SceneCacheData : public SdfAbstractData
179179
void addCollections( SpecData& spec, TfTokenVector& properties, const SdfPath& primPath );
180180
void addReference( IECoreScene::ConstSceneInterfacePtr scene, SpecData& spec, TfTokenVector& children );
181181
void addValueClip( SpecData& spec, const VtVec2dArray times, const VtVec2dArray actives, const std::string& assetPath, const std::string& primPath);
182-
void addInternalRoot( TfTokenVector children );
182+
void addInternalRoot( TfTokenVector children, IECoreScene::ConstSceneInterfacePtr scene );
183183

184184
VtValue getTimeSampleMap( const SdfPath& path, const TfToken& field, const VtValue& value ) const;
185185

contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ bool UsdSceneCacheFileFormat::WriteToFile( const SdfLayer& layer, const std::str
175175
SceneInterfacePtr outScene;
176176

177177
outScene = SdfFileFormatSharedSceneWriters::get( filePath );
178+
if ( !outScene )
179+
{
180+
IECore::msg( IECore::Msg::Error, "UsdSceneCacheFileFormat::WriteToFile", boost::format( "Invalid file path \"%s\" for layer \"%s\"." ) % filePath % layer.GetIdentifier() );
181+
return false;
182+
}
178183

179184
SceneInterface::NameList childNames;
180185
usdScene->childNames( childNames );
@@ -370,6 +375,18 @@ void UsdSceneCacheFileFormat::writeLocation(
370375
}
371376
}
372377
}
378+
// internal root is mapped to the SceneInterface root '/'
379+
else
380+
{
381+
SceneInterface::NameList tags;
382+
inChild->readTags( tags );
383+
// round trip internal tag name
384+
for ( auto& tag : tags )
385+
{
386+
tag = SceneCacheDataAlgo::fromInternalName( tag );
387+
}
388+
outChild->writeTags( tags );
389+
}
373390

374391
// recursion
375392
SceneInterface::NameList grandChildNames;

contrib/IECoreUSD/src/IECoreUSD/SdfFileFormatSharedSceneWriters.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "SdfFileFormatSharedSceneWriters.h"
3636

3737
#include "IECore/LRUCache.h"
38+
#include "IECore/MessageHandler.h"
3839

3940
using namespace IECore;
4041
using namespace IECoreScene;
@@ -61,7 +62,15 @@ class Cache : public SceneLRUCache
6162

6263
static SceneInterfacePtr fileCacheGetter( const std::string &fileName, size_t &cost )
6364
{
64-
SceneInterfacePtr result = SceneInterface::create( fileName, IECore::IndexedIO::Write );
65+
SceneInterfacePtr result = nullptr;
66+
try
67+
{
68+
result = SceneInterface::create( fileName, IECore::IndexedIO::Write );
69+
}
70+
catch ( ... )
71+
{
72+
IECore::msg( IECore::Msg::Error, "SdfFileFormatSharedSceneWriters::SceneLRUCache", boost::format( "Unable to open file path \"%s\" for writing IndexedIo data." ) % fileName );
73+
}
6574
cost = 1;
6675
return result;
6776
}

contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,33 @@ pxr::UsdShadeConnectableAPI createShaderPrim( const IECoreScene::Shader *shader,
309309
{
310310
throw IECore::Exception( "Could not create shader at " + path.GetAsString() );
311311
}
312+
312313
const std::string type = shader->getType();
314+
313315
std::string typePrefix;
314-
size_t typeColonPos = type.find( ":" );
315-
if( typeColonPos != std::string::npos )
316+
if( boost::starts_with( shader->getName(), "Pxr" ) || boost::starts_with( shader->getName(), "Lama" ) )
316317
{
317-
typePrefix = type.substr( 0, typeColonPos ) + ":";
318-
if( typePrefix == "ai:" )
318+
// Leave the type prefix empty. This should be the default, but we are currently only doing this
319+
// for a small number of shaders that we can be completely confident require it, in order to
320+
// preserve backwards compatibility.
321+
}
322+
else
323+
{
324+
size_t typeColonPos = type.find( ":" );
325+
if( typeColonPos != std::string::npos )
319326
{
320-
typePrefix = "arnold:";
327+
// According to our current understanding, this is almost completely wrong. Renderer's like
328+
// PRMan won't accept shaders with type prefixes, and Arnold apparently requires all shaders
329+
// to be prefixed with "arnold:", including OSL. This code prefixes OSL shaders with "osl:",
330+
// which fails in all renderers we're aware of - we're keeping this behaviour for now for
331+
// backwards compatibility reasons.
332+
typePrefix = type.substr( 0, typeColonPos ) + ":";
333+
334+
// This is the one case that actually works
335+
if( typePrefix == "ai:" )
336+
{
337+
typePrefix = "arnold:";
338+
}
321339
}
322340
}
323341
usdShader.SetShaderId( pxr::TfToken( typePrefix + shader->getName() ) );

contrib/IECoreUSD/test/IECoreUSD/SceneCacheFileFormatTest.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def testTagsLoadedAsCollections( self ):
320320
# includes
321321
fileName = os.path.join( self.temporaryDirectory(), "testUSDTags.scc" )
322322
m = IECoreScene.SceneCache( fileName, IECore.IndexedIO.OpenMode.Write )
323+
m.writeTags( ["geoId:chessy"] )
323324
t = m.createChild( "t" )
324325
s = t.createChild( "s" )
325326
t.writeTags( ["t1", "all", "asset-(12)"] )
@@ -330,6 +331,16 @@ def testTagsLoadedAsCollections( self ):
330331
stage = pxr.Usd.Stage.Open( fileName )
331332
root = stage.GetPseudoRoot()
332333

334+
tagInternalRootPrim = root.GetPrimAtPath( f"/{IECoreUSD.SceneCacheDataAlgo.internalRootName()}" )
335+
self.assertEqual(
336+
tagInternalRootPrim.GetRelationship(
337+
"collection:{}:includes".format(
338+
IECoreUSD.SceneCacheDataAlgo.toInternalName( "geoId:chessy" )
339+
)
340+
).GetTargets(),
341+
[ pxr.Sdf.Path( f"/{IECoreUSD.SceneCacheDataAlgo.internalRootName()}" ) ]
342+
)
343+
333344
tagPrim = root.GetPrimAtPath( "/{}/t".format( IECoreUSD.SceneCacheDataAlgo.internalRootName() ) )
334345
self.assertTrue( tagPrim )
335346

@@ -346,6 +357,10 @@ def testTagsLoadedAsCollections( self ):
346357
stage.Export( exportPath )
347358

348359
scene = IECoreScene.SharedSceneInterfaces.get( exportPath )
360+
# check root tags
361+
self.assertTrue( "geoId:chessy" in scene.readTags() )
362+
363+
# check children tags
349364
for tag, paths in tags.items():
350365
for path in paths:
351366
child = scene.scene( IECoreScene.SceneInterface.stringToPath( path ) )
@@ -939,6 +954,17 @@ def testSceneWrite( self ):
939954
stage.Export( exportPath )
940955
self.assertTrue( os.path.exists( exportPath ) )
941956

957+
# invalid path
958+
invalidExportPath = os.path.join( self.temporaryDirectory(), "invalid", "invalid.scc" )
959+
with IECore.CapturingMessageHandler() as mh :
960+
stage.Export( invalidExportPath )
961+
962+
self.assertEqual( len( mh.messages ), 2 )
963+
self.assertEqual( mh.messages[0].level, IECore.Msg.Level.Error )
964+
self.assertEqual( mh.messages[0].context, "SdfFileFormatSharedSceneWriters::SceneLRUCache" )
965+
self.assertEqual( mh.messages[1].level, IECore.Msg.Level.Error )
966+
self.assertEqual( mh.messages[1].context, "UsdSceneCacheFileFormat::WriteToFile" )
967+
942968
# root
943969
layer = pxr.Sdf.Layer.FindOrOpen( linkFileName )
944970

contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3055,6 +3055,13 @@ def testShaders( self ) :
30553055
) )
30563056
manualComponentNetwork.setOutput( IECoreScene.ShaderNetwork.Parameter( "dest", "" ) )
30573057

3058+
3059+
rmanSurface = IECoreScene.Shader( "PxrFoo", "osl:surface", surface.parameters )
3060+
rmanNetwork = IECoreScene.ShaderNetwork()
3061+
rmanNetwork.addShader( "out", rmanSurface )
3062+
rmanNetwork.setOutput( IECoreScene.ShaderNetwork.Parameter( "out", "" ) )
3063+
3064+
30583065
writerRoot = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Write )
30593066
shaderLocation = writerRoot.createChild( "shaderLocation" )
30603067
shaderLocation.writeAttribute( "ai:surface", oneShaderNetwork, 0 )
@@ -3063,6 +3070,7 @@ def testShaders( self ) :
30633070
shaderLocation.writeAttribute( "complex:surface", complexNetwork, 0 )
30643071
shaderLocation.writeAttribute( "componentConnection:surface", componentConnectionNetwork, 0 )
30653072
shaderLocation.writeAttribute( "manualComponent:surface", manualComponentNetwork, 0 )
3073+
shaderLocation.writeAttribute( "ri:surface", rmanNetwork, 0 )
30663074

30673075
shaderLocation.writeAttribute( "volume", oneShaderNetwork, 0 ) # USD supports shaders without a prefix
30683076

@@ -3121,11 +3129,26 @@ def testShaders( self ) :
31213129
self.assertEqual( textureUsd.GetInput( "filename" ).Get(), "sometexture.tx" )
31223130

31233131

3132+
3133+
3134+
riShaderSource = mat.GetOutput( "ri:surface" ).GetConnectedSource()
3135+
self.assertEqual( riShaderSource[1], "DEFAULT_OUTPUT" )
3136+
riShaderUsd = pxr.UsdShade.Shader( riShaderSource[0].GetPrim() )
3137+
self.assertEqual( riShaderUsd.GetShaderId(), "PxrFoo" )
3138+
self.assertEqual( riShaderUsd.GetInput( "c" ).Get(), "42" )
3139+
self.assertEqual( riShaderUsd.GetInput( "a" ).Get(), 42.0 )
3140+
self.assertEqual( riShaderUsd.GetInput( "g" ).Get(), 5 )
3141+
self.assertEqual( riShaderUsd.GetInput( "g_Knots" ).Get(), pxr.Vt.FloatArray( [0, 0, 10, 20, 20] ) )
3142+
self.assertEqual( riShaderUsd.GetInput( "g_Colors" ).Get(), pxr.Vt.Vec3fArray(
3143+
[pxr.Gf.Vec3f( 1 ), pxr.Gf.Vec3f( 1 ), pxr.Gf.Vec3f( 2 ), pxr.Gf.Vec3f( 0 ), pxr.Gf.Vec3f( 0 )]
3144+
) )
3145+
self.assertEqual( riShaderUsd.GetInput( "g_Interpolation" ).Get(), 'linear' )
3146+
31243147
# Read via SceneInterface, and check that we've round-tripped successfully.
31253148

31263149
root = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )
31273150

3128-
self.assertEqual( set( root.child( "shaderLocation" ).attributeNames() ), set( ['ai:disp_map', 'ai:surface', 'complex:surface', 'volume', 'componentConnection:surface', 'manualComponent:surface' ] ) )
3151+
self.assertEqual( set( root.child( "shaderLocation" ).attributeNames() ), set( ['ai:disp_map', 'ai:surface', 'complex:surface', 'volume', 'componentConnection:surface', 'manualComponent:surface', "ri:surface" ] ) )
31293152

31303153
self.assertEqual( root.child( "shaderLocation" ).readAttribute( "ai:surface", 0 ).outputShader().parameters, oneShaderNetwork.outputShader().parameters )
31313154
self.assertEqual( root.child( "shaderLocation" ).readAttribute( "ai:surface", 0 ).outputShader(), oneShaderNetwork.outputShader() )
@@ -3150,6 +3173,13 @@ def testShaders( self ) :
31503173
self.assertEqual( root.child( "shaderLocation" ).readAttribute( "componentConnection:surface", 0 ), componentConnectionNetwork )
31513174
self.assertEqual( root.child( "shaderLocation" ).readAttribute( "manualComponent:surface", 0 ), manualComponentNetwork )
31523175

3176+
rmanSurfaceWithoutTypePrefix = IECoreScene.Shader( "PxrFoo", "surface", surface.parameters )
3177+
rmanNetworkWithoutTypePrefix = IECoreScene.ShaderNetwork()
3178+
rmanNetworkWithoutTypePrefix.addShader( "out", rmanSurfaceWithoutTypePrefix )
3179+
rmanNetworkWithoutTypePrefix.setOutput( IECoreScene.ShaderNetwork.Parameter( "out", "" ) )
3180+
3181+
self.assertEqual( root.child( "shaderLocation" ).readAttribute( "ri:surface", 0 ), rmanNetworkWithoutTypePrefix )
3182+
31533183
def testManyShaders( self ) :
31543184

31553185
# Write shaders

0 commit comments

Comments
 (0)