From bf5ea4284edeb59a9b203d809db138dfb3bfcb68 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Tue, 29 Apr 2025 17:00:12 +0100 Subject: [PATCH 1/2] USD PrimitiveAlgo : Fix compilation with USD 25.05 The functions involving double matrices with float vectors have been removed, so we must cast explicitly. --- contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp index c142d882b7..8d223d7b39 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp @@ -426,7 +426,7 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo pxr::GfMatrix4d inverseBind = skinningQuery.GetGeomBindTransform( time ).GetInverse(); for( auto &p : points ) { - p = inverseBind.Transform( p ); + p = pxr::GfVec3f( inverseBind.Transform( pxr::GfVec3d( p ) ) ); } Canceller::check( canceller ); From bf3cb233b86712a38df982942231623b4b5c0d01 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Tue, 29 Apr 2025 17:02:07 +0100 Subject: [PATCH 2/2] IECoreUSDModule : Make compatible with USD 25.05 In which the USD Python bindings are now performed using a copy of `boost::python`, housed in the `pxr_boost::python` namespace. We bind a few functions of our own that deal with `pxr` types, so we now need to teach our `boost::python` how to pass them to `pxr_boost::python`. --- .../src/IECoreUSD/bindings/IEUSDModule.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/contrib/IECoreUSD/src/IECoreUSD/bindings/IEUSDModule.cpp b/contrib/IECoreUSD/src/IECoreUSD/bindings/IEUSDModule.cpp index 168ed4a5d4..8336d3e6ea 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/bindings/IEUSDModule.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/bindings/IEUSDModule.cpp @@ -39,6 +39,10 @@ #include "IECore/IndexedIO.h" +#if PXR_VERSION >= 2505 +#include "pxr/external/boost/python.hpp" +#endif + #include "boost/python.hpp" using namespace boost::python; @@ -86,10 +90,47 @@ static list fromInternalPath( list l ) return vectorToList( path ); } +#if PXR_VERSION >= 2505 + +// Registers `boost::python` converters for types +// wrapped using `pxr_boost::python`. +template +struct PxrBoostConverter +{ + + static void registerConverters() + { + boost::python::to_python_converter(); + /// \todo Add conversion from Python when we have + /// a use for it. See PyBindConverter for an example. + } + + private : + + struct ToPxrBoost + { + static PyObject *convert( const T &t ) + { + pxr::pxr_boost::python::object o( t ); + Py_INCREF( o.ptr() ); + return o.ptr(); + } + }; + +}; + +#endif // PXR_VERSION >= 2505 + } // namespace BOOST_PYTHON_MODULE( _IECoreUSD ) { +#if PXR_VERSION >= 2505 + PxrBoostConverter::registerConverters(); + PxrBoostConverter::registerConverters(); + PxrBoostConverter::registerConverters(); +#endif + { object dataAlgoModule( handle<>( borrowed( PyImport_AddModule( "IECoreUSD.DataAlgo" ) ) ) ); scope().attr( "DataAlgo" ) = dataAlgoModule;