Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Breaking Changes
- SweepAndPrune.h : Removed.
- RadixSort.h : Removed.

Build
-----

- Added compatibility with USD 25.11 and 26.03.

10.7.0.0a6 (relative to 10.7.0.0a5)
==========

Expand Down
5 changes: 0 additions & 5 deletions contrib/IECoreUSD/include/IECoreUSD/ShaderAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
IECORE_PUSH_DEFAULT_VISIBILITY
#include "pxr/usd/usdShade/material.h"
#include "pxr/usd/usdShade/output.h"
#if PXR_VERSION >= 2111
#include "pxr/usd/usdLux/lightAPI.h"
#endif
IECORE_POP_DEFAULT_VISIBILITY

namespace IECoreUSD
Expand All @@ -64,15 +62,12 @@ IECOREUSD_API IECoreScene::ShaderNetworkPtr readShaderNetwork( const pxr::UsdSha
bool canReadShaderNetwork( const pxr::UsdShadeOutput &output );
IECOREUSD_API bool shaderNetworkMightBeTimeVarying( const pxr::UsdShadeOutput &output );

#if PXR_VERSION >= 2111
/// Writes a UsdLuxLight from a shader network.
IECOREUSD_API void writeLight( const IECoreScene::ShaderNetwork *shaderNetwork, pxr::UsdPrim prim );
/// Reads a ShaderNetwork from a light.
IECOREUSD_API IECoreScene::ShaderNetworkPtr readLight( const pxr::UsdLuxLightAPI &light, pxr::UsdTimeCode timeCode = pxr::UsdTimeCode::Default() );
IECOREUSD_API bool lightMightBeTimeVarying( const pxr::UsdLuxLightAPI &light );

#endif

} // namespace ShaderAlgo

} // namespace IECoreUSD
Expand Down
4 changes: 0 additions & 4 deletions contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,7 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo
}

Canceller::check( canceller );
#if PXR_VERSION < 2011
::skelCache()->Populate( skelRoot );
#else
::skelCache()->Populate( skelRoot, pxr::UsdTraverseInstanceProxies() );
#endif

Canceller::check( canceller );
pxr::UsdSkelSkinningQuery skinningQuery = ::skelCache()->GetSkinningQuery( pointBased.GetPrim() );
Expand Down
8 changes: 8 additions & 0 deletions contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ ARCH_PRAGMA_MACRO_TOO_FEW_ARGUMENTS
#include "pxr/usd/sdf/layer.h"
#include "pxr/usd/usd/clipsAPI.h"
#include "pxr/usd/usd/prim.h"
#if PXR_VERSION >= 2511
#include "pxr/usd/sdf/usdaFileFormat.h"
#else
#include "pxr/usd/usd/usdaFileFormat.h"
#endif
#include "pxr/usd/usdGeom/tokens.h"

ARCH_PRAGMA_POP
Expand Down Expand Up @@ -92,7 +96,11 @@ TF_REGISTRY_FUNCTION(TfType)

UsdSceneCacheFileFormat::UsdSceneCacheFileFormat()
: SdfFileFormat( UsdSceneCacheFileFormatTokens->Id, UsdSceneCacheFileFormatTokens->Version, UsdSceneCacheFileFormatTokens->Target, UsdSceneCacheFileFormatTokens->Id),
#if PXR_VERSION >= 2511
m_usda(SdfFileFormat::FindById(SdfUsdaFileFormatTokens->Id))
#else
m_usda(SdfFileFormat::FindById(UsdUsdaFileFormatTokens->Id))
#endif
{
}

Expand Down
19 changes: 1 addition & 18 deletions contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@
#include "IECore/MessageHandler.h"
#include "IECore/SimpleTypedData.h"

#if PXR_VERSION >= 2111
#include "pxr/usd/usdLux/cylinderLight.h"
#include "pxr/usd/usdLux/nonboundableLightBase.h"
#include "pxr/usd/usdLux/sphereLight.h"

#include "pxr/usd/usd/schemaRegistry.h"
#endif

#include "pxr/usd/usdGeom/primvarsAPI.h"
#include "pxr/usd/usdShade/utils.h"
Expand All @@ -58,10 +56,6 @@

#include <regex>

#if PXR_VERSION < 2102
#define IsContainer IsNodeGraph
#endif

namespace
{

Expand All @@ -82,20 +76,17 @@ std::pair<pxr::TfToken, std::string> shaderIdAndType( const pxr::UsdShadeConnect
shader.GetShaderId( &id );
type = "surface";
}
#if PXR_VERSION >= 2111
else if( auto light = pxr::UsdLuxLightAPI( connectable ) )
{
light.GetShaderIdAttr().Get( &id );
type = "light";
}
#endif

return std::make_pair( id, type );
}

bool writeNonStandardLightParameter( const std::string &name, const IECore::Data *value, pxr::UsdShadeConnectableAPI usdShader )
{
#if PXR_VERSION >= 2111

if( auto sphereLight = pxr::UsdLuxSphereLight( usdShader.GetPrim() ) )
{
Expand Down Expand Up @@ -125,15 +116,13 @@ bool writeNonStandardLightParameter( const std::string &name, const IECore::Data
}
}

#endif
return false;
}

void readNonStandardLightParameters( const pxr::UsdPrim &prim, IECore::CompoundDataMap &parameters )
{
// Just to keep us on our toes, not all light parameters are stored as UsdShade inputs,
// so we have special-case code for loading those here.
#if PXR_VERSION >= 2111
if( auto sphereLight = pxr::UsdLuxSphereLight( prim ) )
{
bool treatAsPoint = false;
Expand Down Expand Up @@ -165,12 +154,10 @@ void readNonStandardLightParameters( const pxr::UsdPrim &prim, IECore::CompoundD
}
}
}
#endif
}

bool nonStandardLightParametersMightBeTimeVarying( const pxr::UsdPrim &prim )
{
#if PXR_VERSION >= 2111
if( auto sphereLight = pxr::UsdLuxSphereLight( prim ) )
{
if( sphereLight.GetTreatAsPointAttr().ValueMightBeTimeVarying() )
Expand Down Expand Up @@ -203,7 +190,7 @@ bool nonStandardLightParametersMightBeTimeVarying( const pxr::UsdPrim &prim )
}
}
}
#endif

return false;
}

Expand Down Expand Up @@ -636,8 +623,6 @@ bool IECoreUSD::ShaderAlgo::shaderNetworkMightBeTimeVarying( const pxr::UsdShade
return shaderNetworkMightBeTimeVaryingWalk( usdSource, visited );
}

#if PXR_VERSION >= 2111

// This is very similar to `writeShaderNetwork` but with these key differences :
//
// - The output shader is written as a UsdLight-derived prim rather than a UsdShadeShader.
Expand Down Expand Up @@ -708,5 +693,3 @@ bool IECoreUSD::ShaderAlgo::lightMightBeTimeVarying( const pxr::UsdLuxLightAPI &
std::unordered_set<pxr::UsdPrim, pxr::TfHash> visited;
return shaderNetworkMightBeTimeVaryingWalk( pxr::UsdShadeConnectableAPI( light ), visited );
}

#endif
30 changes: 0 additions & 30 deletions contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ IECORE_PUSH_DEFAULT_VISIBILITY
#include "pxr/usd/usdGeom/scope.h"
#include "pxr/usd/usdGeom/tokens.h"
#include "pxr/usd/usdGeom/xform.h"
#if PXR_VERSION >= 2111
#include "pxr/usd/usdLux/lightAPI.h"
#endif
#include "pxr/usd/usdShade/material.h"
#include "pxr/usd/usdShade/materialBindingAPI.h"
#include "pxr/usd/usdShade/connectableAPI.h"
Expand Down Expand Up @@ -96,10 +94,6 @@ using namespace IECore;
using namespace IECoreScene;
using namespace IECoreUSD;

#if PXR_VERSION < 2011
#define GetPrimInPrototype GetPrimInMaster
#endif

namespace
{

Expand Down Expand Up @@ -262,26 +256,15 @@ void writeSetInternal( const pxr::UsdPrim &prim, const pxr::TfToken &name, const
targets.push_back( USDScene::toUSD( *it, /* relative = */ true ) );
}

#if PXR_VERSION < 2009

pxr::UsdCollectionAPI collection = pxr::UsdCollectionAPI::ApplyCollection( prim, validNamespacedName( name ), pxr::UsdTokens->explicitOnly );

#else

pxr::UsdCollectionAPI collection = pxr::UsdCollectionAPI::Apply( prim, validNamespacedName( name ) );
collection.CreateExpansionRuleAttr( pxr::VtValue( pxr::UsdTokens->explicitOnly ) );

#endif

collection.CreateIncludesRel().SetTargets( targets );
}

using PrimPredicate = bool (pxr::UsdPrim::*)() const;
boost::container::flat_map<pxr::TfToken, PrimPredicate> g_schemaTypeSetPredicates = {
{ pxr::TfToken( "__cameras" ), &pxr::UsdPrim::IsA<pxr::UsdGeomCamera> },
#if PXR_VERSION >= 2111
{ pxr::TfToken( "__lights" ), &pxr::UsdPrim::HasAPI<pxr::UsdLuxLightAPI> },
#endif
{ pxr::TfToken( "usd:pointInstancers" ), &pxr::UsdPrim::IsA<pxr::UsdGeomPointInstancer> }
};

Expand Down Expand Up @@ -1117,12 +1100,10 @@ bool USDScene::hasAttribute( const SceneInterface::Name &name ) const
pxr::TfToken kind;
return model.GetKind( &kind );
}
#if PXR_VERSION >= 2111
else if( name == g_lightAttributeName )
{
return m_location->prim.HasAPI<pxr::UsdLuxLightAPI>();
}
#endif
else if( name == g_doubleSidedAttributeName )
{
return pxr::UsdGeomGprim( m_location->prim ).GetDoubleSidedAttr().HasAuthoredValue();
Expand Down Expand Up @@ -1170,12 +1151,10 @@ void USDScene::attributeNames( SceneInterface::NameList &attrs ) const
attrs.push_back( g_kindAttributeName );
}

#if PXR_VERSION >= 2111
if( m_location->prim.HasAPI<pxr::UsdLuxLightAPI>() )
{
attrs.push_back( g_lightAttributeName );
}
#endif

if( pxr::UsdGeomGprim( m_location->prim ).GetDoubleSidedAttr().HasAuthoredValue() )
{
Expand Down Expand Up @@ -1265,12 +1244,10 @@ ConstObjectPtr USDScene::readAttribute( const SceneInterface::Name &name, double
pxr::TfToken value; attr.Get( &value );
return new StringData( value.GetString() );
}
#if PXR_VERSION >= 2111
else if( name == g_lightAttributeName )
{
return ShaderAlgo::readLight( pxr::UsdLuxLightAPI( m_location->prim ), m_root->timeCode( time ) );
}
#endif
else if( name == g_kindAttributeName )
{
pxr::TfToken kind;
Expand Down Expand Up @@ -1367,7 +1344,6 @@ void USDScene::writeAttribute( const SceneInterface::Name &name, const Object *a
}
else if( const IECoreScene::ShaderNetwork *shaderNetwork = runTimeCast<const ShaderNetwork>( attribute ) )
{
#if PXR_VERSION >= 2111
if( name == g_lightAttributeName )
{
ShaderAlgo::writeLight( shaderNetwork, m_location->prim );
Expand All @@ -1377,10 +1353,6 @@ void USDScene::writeAttribute( const SceneInterface::Name &name, const Object *a
const auto &[output, purpose] = materialOutputAndPurpose( name.string() );
m_materials[purpose][output] = shaderNetwork;
}
#else
const auto &[output, purpose] = materialOutputAndPurpose( name.string() );
m_materials[purpose][output] = shaderNetwork;
#endif
}
else if( name.string() == "gaffer:globals" )
{
Expand Down Expand Up @@ -1750,13 +1722,11 @@ void USDScene::attributesHash( double time, IECore::MurmurHash &h ) const
// Kind can not be animated so no need to update `mightBeTimeVarying`.
}

#if PXR_VERSION >= 2111
if( m_location->prim.HasAPI<pxr::UsdLuxLightAPI>() )
{
mightBeTimeVarying = mightBeTimeVarying || ShaderAlgo::lightMightBeTimeVarying( pxr::UsdLuxLightAPI( m_location->prim ) );
haveAttributes = true;
}
#endif

auto doubleSidedAttr = pxr::UsdGeomGprim( m_location->prim ).GetDoubleSidedAttr();
if( doubleSidedAttr && doubleSidedAttr.HasAuthoredValue() )
Expand Down