Skip to content

Commit 85f9bca

Browse files
committed
Merge branch 'RB-10.5' into main
2 parents 6eec66f + c106737 commit 85f9bca

File tree

23 files changed

+579
-152
lines changed

23 files changed

+579
-152
lines changed

Changes

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,76 @@
1-
10.5.x.x (relative to 10.5.1.0)
1+
10.5.x.x (relative to 10.5.4.1)
22
========
33

4-
Breaking Changes
5-
----------------
6-
- IECoreMaya : Maya meshes converted from Cortex data no longer have normals set explicitly and instead relies on Maya to calculate them.
4+
5+
6+
10.5.4.1 (relative to 10.5.4.0)
7+
========
78

89
Fixes
9-
---
10+
-----
11+
12+
- OpenImageIOAlgo : Properly handle empty metadata values.
13+
14+
10.5.4.0 (relative to 10.5.3.0)
15+
========
16+
17+
Improvements
18+
------------
19+
20+
- ShaderNetwork : Added support for InternedStringData attributes in string parameter substitutions.
21+
- MurmurHash : Added specialisation for `std::hash`, among other things allowing the use of MurmurHash as a key in `unordered_map`.
22+
- CompoundObject : Defaulted template argument to `Object` in `member()` methods.
23+
24+
10.5.3.0 (relative to 10.5.2.1)
25+
========
26+
27+
Improvements
28+
------------
29+
30+
- OpenImageIOAlgo : Added support for `InternedStringVectorData` to `DataView`.
31+
32+
Build
33+
-----
34+
35+
- Windows : Fixed include order.
36+
37+
10.5.2.1 (relative to 10.5.2.0)
38+
========
39+
40+
Build
41+
-----
42+
43+
- SConstruct : Make sure VDB includes can be found
44+
- USDScene : Fix build for older USD versions
45+
46+
10.5.2.0 (relative to 10.5.1.0)
47+
========
48+
49+
Improvements
50+
------------
51+
52+
- USD PrimitiveAlgo : Added `readPrimitiveVariable()` utility method for reading from regular `UsdAttributes`.
53+
- USDScene : Added support for reading from in-memory stages by passing a filename of the form `stageCache:{id}.usd` where `{id}` specifies a stage which has been inserted in the `UsdUtilsStageCache`.
54+
55+
Fixes
56+
-----
57+
58+
- USDScene :
59+
- Fixed handling of invalid values on the following attributes :
60+
- PointBased : `positions`, `normals`, `velocities`, `accelerations`.
61+
- Curves : `widths`.
62+
- PointInstancer : `ids`, `protoIndices`, `orientations`, `scales`, `velocities`, `accelerations`, `angularVelocities`.
63+
- Points : `ids`, `widths`.
64+
Invalid values are now ignored with a warning, instead of loading as invalid primitive variables.
65+
- Fixed treatment of unconnected material outputs during reading. If they were "authored" but not connected to a source, they were incorrectly being treated as valid attributes, and loading as empty ShaderNetworks which caused problems elsewhere.
66+
1067
- ToMayaMeshConverter : No longer locks normals set on the Mesh from the scc.
1168

69+
Breaking Changes
70+
----------------
71+
72+
- IECoreMaya : Maya meshes converted from Cortex data no longer have normals set explicitly and instead relies on Maya to calculate them.
73+
1274
10.5.1.0 (relative to 10.5.0.0)
1375
========
1476

@@ -70,6 +132,14 @@ Breaking Changes
70132
- Changed function signature.
71133
- Bug fixes mean subtle changes to the resulting points.
72134

135+
10.4.10.3 (relative to 10.4.10.2)
136+
=========
137+
138+
Fixes
139+
-----
140+
141+
- USDScene : Fixed treatment of unconnected material outputs during reading. If they were "authored" but not connected to a source, they were incorrectly being treated as valid attributes, and loading as empty ShaderNetworks which caused problems elsewhere.
142+
73143
10.4.10.2 (relative to 10.4.10.1)
74144
=========
75145

SConstruct

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ SConsignFile()
5656

5757
ieCoreMilestoneVersion = 10 # for announcing major milestones - may contain all of the below
5858
ieCoreMajorVersion = 5 # backwards-incompatible changes
59-
ieCoreMinorVersion = 1 # new backwards-compatible features
60-
ieCorePatchVersion = 0 # bug fixes
59+
ieCoreMinorVersion = 4 # new backwards-compatible features
60+
ieCorePatchVersion = 1 # bug fixes
6161
ieCoreVersionSuffix = "" # used for alpha/beta releases. Example: "a1", "b2", etc.
6262

6363
###########################################################################################
@@ -1227,6 +1227,20 @@ else:
12271227
],
12281228
)
12291229

1230+
# Reorder build commands so that `/external:I` includes come after `/I` includes.
1231+
# Otherwise we'll pick up the Gaffer includes from the build directory, and not
1232+
# the ones in the source tree.
1233+
1234+
for command, cxxFlags in [
1235+
( "CXXCOM", "$CXXFLAGS" ),
1236+
( "SHCXXCOM", "$SHCXXFLAGS" )
1237+
] :
1238+
if env[command].index( cxxFlags ) < env[command].index( "$_CCCOMCOM" ) :
1239+
# `$_CCCOMCOM` contains the preprocessor flags, including `/I`. Swap
1240+
# it with `cxxFlags`, which contains `/external:I`.
1241+
env[command] = env[command].replace( cxxFlags, "<>" ).replace( "$_CCCOMCOM", cxxFlags ).replace( "<>", "$_CCCOMCOM" )
1242+
1243+
12301244

12311245
# autoconf-like checks for stuff.
12321246
# this part of scons doesn't seem so well thought out.
@@ -2967,6 +2981,7 @@ else :
29672981
"usdLux",
29682982
"usdSkel",
29692983
"usdShade",
2984+
"usdUtils",
29702985
"sdf",
29712986
"tf",
29722987
"pcp",
@@ -3042,11 +3057,11 @@ if doConfigure :
30423057
)
30433058

30443059
if haveVDB :
3060+
usdEnv.Prepend( **vdbEnvPrepends )
30453061
usdEnv.Append(
30463062
LIBS = [
30473063
os.path.basename( vdbEnv.subst( "$INSTALL_LIB_NAME" ) ),
30483064
"${USD_LIB_PREFIX}usdVol",
3049-
vdbEnv.subst( "openvdb" + env["VDB_LIB_SUFFIX"] )
30503065
],
30513066
CPPDEFINES = [ "IECOREUSD_WITH_OPENVDB" ]
30523067
)

contrib/IECoreUSD/include/IECoreUSD/PrimitiveAlgo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ IECOREUSD_API pxr::TfToken toUSD( IECoreScene::PrimitiveVariable::Interpolation
7575
IECOREUSD_API void readPrimitiveVariables( const pxr::UsdGeomPrimvarsAPI &primvarsAPI, pxr::UsdTimeCode timeCode, IECoreScene::Primitive *primitive, const IECore::Canceller *canceller = nullptr );
7676
/// As above, but also reads "P", "N" etc from `pointBased`.
7777
IECOREUSD_API void readPrimitiveVariables( const pxr::UsdGeomPointBased &pointBased, pxr::UsdTimeCode timeCode, IECoreScene::Primitive *primitive, const IECore::Canceller *canceller = nullptr );
78+
/// Reads the value for `attribute`, adding it as a primitive variable with the specified `name` and `interpolation`.
79+
IECOREUSD_API void readPrimitiveVariable( const pxr::UsdAttribute &attribute, pxr::UsdTimeCode timeCode, IECoreScene::Primitive *primitive, const std::string &name, IECoreScene::PrimitiveVariable::Interpolation interpolation = IECoreScene::PrimitiveVariable::Vertex );
7880
/// Returns true if any of the primitive variables might be animated.
7981
IECOREUSD_API bool primitiveVariablesMightBeTimeVarying( const pxr::UsdGeomPrimvarsAPI &primvarsAPI );
8082
/// Returns true if any of the primitive variables might be animated, including the

contrib/IECoreUSD/include/IECoreUSD/ShaderAlgo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ namespace ShaderAlgo
5757
IECOREUSD_API pxr::UsdShadeOutput writeShaderNetwork( const IECoreScene::ShaderNetwork *shaderNetwork, pxr::UsdPrim shaderContainer );
5858

5959
/// Reads a ShaderNetwork from a material output, typically obtained from `UsdShadeMaterial::GetOutput()`.
60+
/// Returns `nullptr` if `canReadShaderNetwork() == false`, usually because the output has no connected source.
6061
IECOREUSD_API IECoreScene::ShaderNetworkPtr readShaderNetwork( const pxr::UsdShadeOutput &output );
62+
/// Returns true if `readShaderNetwork()` will return `nullptr`, usually because the output has no
63+
/// connected source.
64+
bool canReadShaderNetwork( const pxr::UsdShadeOutput &output );
6165

6266
#if PXR_VERSION >= 2111
6367
/// Writes a UsdLuxLight from a shader network.

contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,9 @@ IECore::ObjectPtr readCurves( pxr::UsdGeomBasisCurves &curves, pxr::UsdTimeCode
109109
PrimitiveAlgo::readPrimitiveVariables( curves, time, newCurves.get(), canceller );
110110

111111
Canceller::check( canceller );
112-
PrimitiveVariable::Interpolation widthInterpolation = PrimitiveAlgo::fromUSD( curves.GetWidthsInterpolation() );
113-
DataPtr widthData = DataAlgo::fromUSD( curves.GetWidthsAttr(), time, /* arrayAccepted = */ widthInterpolation != PrimitiveVariable::Constant );
114-
if( widthData )
115-
{
116-
newCurves->variables["width"] = PrimitiveVariable( widthInterpolation, widthData );
117-
}
112+
PrimitiveAlgo::readPrimitiveVariable(
113+
curves.GetWidthsAttr(), time, newCurves.get(), "width", PrimitiveAlgo::fromUSD( curves.GetWidthsInterpolation() )
114+
);
118115

119116
return newCurves;
120117
}

contrib/IECoreUSD/src/IECoreUSD/PointInstancerAlgo.cpp

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -65,47 +65,26 @@ IECore::ObjectPtr readPointInstancer( pxr::UsdGeomPointInstancer &pointInstancer
6565

6666
// Per point attributes
6767

68-
if( auto protoIndicesData = DataAlgo::fromUSD( pointInstancer.GetProtoIndicesAttr(), time ) )
69-
{
70-
Canceller::check( canceller );
71-
newPoints->variables["prototypeIndex"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, protoIndicesData );
72-
}
68+
Canceller::check( canceller );
69+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetProtoIndicesAttr(), time, newPoints.get(), "prototypeIndex" );
7370

74-
if( auto idsData = DataAlgo::fromUSD( pointInstancer.GetIdsAttr(), time ) )
75-
{
76-
Canceller::check( canceller );
77-
newPoints->variables["instanceId"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, idsData );
78-
}
71+
Canceller::check( canceller );
72+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetIdsAttr(), time, newPoints.get(), "instanceId" );
7973

80-
if( auto orientationData = DataAlgo::fromUSD( pointInstancer.GetOrientationsAttr(), time ) )
81-
{
82-
Canceller::check( canceller );
83-
newPoints->variables["orientation"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, orientationData );
84-
}
74+
Canceller::check( canceller );
75+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetOrientationsAttr(), time, newPoints.get(), "orientation" );
8576

86-
if( auto scaleData = DataAlgo::fromUSD( pointInstancer.GetScalesAttr(), time ) )
87-
{
88-
Canceller::check( canceller );
89-
newPoints->variables["scale"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, scaleData );
90-
}
77+
Canceller::check( canceller );
78+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetScalesAttr(), time, newPoints.get(), "scale" );
9179

92-
if( auto velocityData = DataAlgo::fromUSD( pointInstancer.GetVelocitiesAttr(), time ) )
93-
{
94-
Canceller::check( canceller );
95-
newPoints->variables["velocity"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, velocityData );
96-
}
80+
Canceller::check( canceller );
81+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetVelocitiesAttr(), time, newPoints.get(), "velocity" );
9782

98-
if( auto accelerationData = DataAlgo::fromUSD( pointInstancer.GetAccelerationsAttr(), time ) )
99-
{
100-
Canceller::check( canceller );
101-
newPoints->variables["acceleration"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, accelerationData );
102-
}
83+
Canceller::check( canceller );
84+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetAccelerationsAttr(), time, newPoints.get(), "acceleration" );
10385

104-
if( auto angularVelocityData = DataAlgo::fromUSD( pointInstancer.GetAngularVelocitiesAttr(), time ) )
105-
{
106-
Canceller::check( canceller );
107-
newPoints->variables["angularVelocity"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, angularVelocityData );
108-
}
86+
Canceller::check( canceller );
87+
PrimitiveAlgo::readPrimitiveVariable( pointInstancer.GetAngularVelocitiesAttr(), time, newPoints.get(), "angularVelocity" );
10988

11089
// Prototype paths
11190

contrib/IECoreUSD/src/IECoreUSD/PointsAlgo.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,12 @@ IECore::ObjectPtr readPoints( pxr::UsdGeomPoints &points, pxr::UsdTimeCode time,
6161
PrimitiveAlgo::readPrimitiveVariables( points, time, newPoints.get(), canceller );
6262

6363
Canceller::check( canceller );
64-
if( auto i = boost::static_pointer_cast<Int64VectorData>( DataAlgo::fromUSD( points.GetIdsAttr(), time ) ) )
65-
{
66-
newPoints->variables["id"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, i );
67-
}
64+
PrimitiveAlgo::readPrimitiveVariable( points.GetIdsAttr(), time, newPoints.get(), "id" );
6865

69-
PrimitiveVariable::Interpolation widthInterpolation = PrimitiveAlgo::fromUSD( points.GetWidthsInterpolation() );
7066
Canceller::check( canceller );
71-
DataPtr widthData = DataAlgo::fromUSD( points.GetWidthsAttr(), time, /* arrayAccepted = */ widthInterpolation != PrimitiveVariable::Constant );
72-
if( widthData )
73-
{
74-
newPoints->variables["width"] = PrimitiveVariable( widthInterpolation, widthData );
75-
}
67+
PrimitiveAlgo::readPrimitiveVariable(
68+
points.GetWidthsAttr(), time, newPoints.get(), "width", PrimitiveAlgo::fromUSD( points.GetWidthsInterpolation() )
69+
);
7670

7771
return newPoints;
7872
}

contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,17 @@ pxr::TfToken IECoreUSD::PrimitiveAlgo::toUSD( IECoreScene::PrimitiveVariable::In
209209
namespace
210210
{
211211

212+
void addPrimitiveVariableIfValid( IECoreScene::Primitive *primitive, const std::string &name, const IECoreScene::PrimitiveVariable &primitiveVariable, const UsdAttribute &source )
213+
{
214+
if( !primitive->isPrimitiveVariableValid( primitiveVariable ) )
215+
{
216+
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Ignoring invalid primitive variable \"%1%\"" ) % source.GetPath().GetAsString() );
217+
return;
218+
}
219+
220+
primitive->variables[name] = primitiveVariable;
221+
}
222+
212223
void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode time, const std::string &name, IECoreScene::Primitive *primitive, bool constantAcceptsArray )
213224
{
214225
IECoreScene::PrimitiveVariable::Interpolation interpolation = IECoreUSD::PrimitiveAlgo::fromUSD( primVar.GetInterpolation() );
@@ -242,14 +253,9 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode
242253
indices = DataAlgo::fromUSD( srcIndices );
243254
}
244255

245-
const IECoreScene::PrimitiveVariable primitiveVariable( interpolation, data, indices );
246-
if( !primitive->isPrimitiveVariableValid( primitiveVariable ) )
247-
{
248-
IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Skipping invalid UsdGeomPrimvar \"%1%\"" ) % primVar.GetAttr().GetPath().GetAsString() );
249-
return;
250-
}
251-
252-
primitive->variables[name] = primitiveVariable;
256+
addPrimitiveVariableIfValid(
257+
primitive, name, IECoreScene::PrimitiveVariable( interpolation, data, indices ), primVar
258+
);
253259
}
254260

255261
pxr::UsdSkelCache *skelCache()
@@ -387,7 +393,10 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo
387393

388394
Canceller::check( canceller );
389395
p->setInterpretation( GeometricData::Point );
390-
primitive->variables["P"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, p );
396+
addPrimitiveVariableIfValid(
397+
primitive, "P", IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, p ),
398+
pointBased.GetPointsAttr()
399+
);
391400

392401
// we'll consider normals optional and return true regardless of whether normals were skinned successfully
393402
pxr::VtVec3fArray normals;
@@ -397,7 +406,10 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo
397406
if( auto n = boost::static_pointer_cast<V3fVectorData>( DataAlgo::fromUSD( normals ) ) )
398407
{
399408
n->setInterpretation( GeometricData::Normal );
400-
primitive->variables["N"] = IECoreScene::PrimitiveVariable( PrimitiveAlgo::fromUSD( pointBased.GetNormalsInterpolation() ), n );
409+
addPrimitiveVariableIfValid(
410+
primitive, "N", IECoreScene::PrimitiveVariable( PrimitiveAlgo::fromUSD( pointBased.GetNormalsInterpolation() ), n ),
411+
pointBased.GetNormalsAttr()
412+
);
401413
}
402414
}
403415

@@ -449,7 +461,7 @@ void IECoreUSD::PrimitiveAlgo::readPrimitiveVariables( const pxr::UsdGeomPrimvar
449461
name = "Cs";
450462
constantAcceptsArray = false;
451463
}
452-
readPrimitiveVariable( primVar, time, name, primitive, constantAcceptsArray );
464+
::readPrimitiveVariable( primVar, time, name, primitive, constantAcceptsArray );
453465
}
454466

455467
// USD uses "st" for the primary texture coordinates and we use "uv",
@@ -496,32 +508,29 @@ void IECoreUSD::PrimitiveAlgo::readPrimitiveVariables( const pxr::UsdGeomPointBa
496508
if( !skelRoot || !::readPrimitiveVariables( skelRoot, pointBased, time, primitive, canceller ) )
497509
{
498510
Canceller::check( canceller );
499-
if( auto p = boost::static_pointer_cast<V3fVectorData>( DataAlgo::fromUSD( pointBased.GetPointsAttr(), time ) ) )
500-
{
501-
primitive->variables["P"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, p );
502-
}
511+
readPrimitiveVariable( pointBased.GetPointsAttr(), time, primitive, "P" );
503512

504513
Canceller::check( canceller );
505514
if( !primitive->variables.count( "N" ) )
506515
{
507516
// Only load `PointBased::GetNormalsAttr()` if we didn't already load `primvars:normals`.
508517
// From the USD API docs : "If normals and primvars:normals are both specified, the latter has precedence."
509-
if( auto n = boost::static_pointer_cast<V3fVectorData>( DataAlgo::fromUSD( pointBased.GetNormalsAttr(), time ) ) )
510-
{
511-
primitive->variables["N"] = IECoreScene::PrimitiveVariable( PrimitiveAlgo::fromUSD( pointBased.GetNormalsInterpolation() ), n );
512-
}
518+
readPrimitiveVariable( pointBased.GetNormalsAttr(), time, primitive, "N", PrimitiveAlgo::fromUSD( pointBased.GetNormalsInterpolation() ) );
513519
}
514520
}
515521

516522
Canceller::check( canceller );
517-
if( auto v = boost::static_pointer_cast<V3fVectorData>( DataAlgo::fromUSD( pointBased.GetVelocitiesAttr(), time ) ) )
518-
{
519-
primitive->variables["velocity"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, v );
520-
}
523+
readPrimitiveVariable( pointBased.GetVelocitiesAttr(), time, primitive, "velocity" );
524+
525+
Canceller::check( canceller );
526+
readPrimitiveVariable( pointBased.GetAccelerationsAttr(), time, primitive, "acceleration" );
527+
}
521528

522-
if( auto a = boost::static_pointer_cast<V3fVectorData>( DataAlgo::fromUSD( pointBased.GetAccelerationsAttr(), time ) ) )
529+
void IECoreUSD::PrimitiveAlgo::readPrimitiveVariable( const pxr::UsdAttribute &attribute, pxr::UsdTimeCode timeCode, IECoreScene::Primitive *primitive, const std::string &name, IECoreScene::PrimitiveVariable::Interpolation interpolation )
530+
{
531+
if( auto d = DataAlgo::fromUSD( attribute, timeCode, /* arrayAccepted = */ interpolation != PrimitiveVariable::Constant ) )
523532
{
524-
primitive->variables["acceleration"] = IECoreScene::PrimitiveVariable( IECoreScene::PrimitiveVariable::Vertex, a );
533+
addPrimitiveVariableIfValid( primitive, name, IECoreScene::PrimitiveVariable( interpolation, d ), attribute );
525534
}
526535
}
527536

0 commit comments

Comments
 (0)