diff --git a/Changes b/Changes index 8ef2451314..7c0e934110 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,10 @@ 10.7.x.x (relative to 10.7.1.3) ======== +Improvements +------------ +- DataAlgo : Moved all functionality into an `IECore::DataAlgo` namespace. 10.7.1.3 (relative to 10.7.1.2) ======== diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/CurvesReader.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/CurvesReader.cpp index 935a5e74e0..920f27e650 100644 --- a/contrib/IECoreAlembic/src/IECoreAlembic/CurvesReader.cpp +++ b/contrib/IECoreAlembic/src/IECoreAlembic/CurvesReader.cpp @@ -153,7 +153,7 @@ class CurvesReader : public PrimitiveReader auto it = result->variables.find( "uv" ); if( it != result->variables.end() ) { - setGeometricInterpretation( it->second.data.get(), GeometricData::UV ); + DataAlgo::setGeometricInterpretation( it->second.data.get(), GeometricData::UV ); } } diff --git a/contrib/IECoreUSD/src/IECoreUSD/DataAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/DataAlgo.cpp index 0703d7b799..7690639f68 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/DataAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/DataAlgo.cpp @@ -134,7 +134,7 @@ template IECore::DataPtr dataFromValue( const pxr::VtValue &value, GeometricData::Interpretation interpretation, bool arrayAccepted ) { using CortexDataType = typename USDTypeTraits::CortexDataType; - typename CortexDataType::Ptr d = new CortexDataType( DataAlgo::fromUSD( value.Get() ) ); + typename CortexDataType::Ptr d = new CortexDataType( IECoreUSD::DataAlgo::fromUSD( value.Get() ) ); setInterpretation( d.get(), interpretation ); return d; } @@ -153,7 +153,7 @@ IECore::DataPtr dataFromArray( const pxr::VtValue &value, GeometricData::Interpr return dataFromValue( VtValue( a[0] ), interpretation, arrayAccepted ); } - auto d = DataAlgo::fromUSD( a ); + auto d = IECoreUSD::DataAlgo::fromUSD( a ); setInterpretation( d.get(), interpretation ); return d; } @@ -318,7 +318,7 @@ IECore::DataPtr colorDataFromArray( const pxr::VtValue &value, bool arrayAccepte IECore::msg( IECore::Msg::Warning, "IECoreUSD::DataAlgo::fromUSD", "Array not accepted but array length is not 1" ); return nullptr; } - return new TypedData( DataAlgo::fromUSD( array[0] ) ); + return new TypedData( IECoreUSD::DataAlgo::fromUSD( array[0] ) ); } return new TypedData>( @@ -425,7 +425,7 @@ struct VtValueFromData array.reserve( data->readable().size() ); for( const auto &e : data->readable() ) { - array.push_back( DataAlgo::toUSD( e ) ); + array.push_back( IECoreUSD::DataAlgo::toUSD( e ) ); } return VtValue( array ); } @@ -445,9 +445,9 @@ struct VtValueFromData { using USDType = typename CortexTypeTraits::USDType; using ArrayType = VtArray; - return VtValue( ArrayType( 1, DataAlgo::toUSD( data->readable() ) ) ); + return VtValue( ArrayType( 1, IECoreUSD::DataAlgo::toUSD( data->readable() ) ) ); } - return VtValue( DataAlgo::toUSD( data->readable() ) ); + return VtValue( IECoreUSD::DataAlgo::toUSD( data->readable() ) ); } VtValue operator()( const IECore::CompoundData *data, bool arrayRequired ) @@ -460,7 +460,7 @@ struct VtValueFromData VtDictionary result; for( const auto &[name, value] : data->readable() ) { - VtValue v = DataAlgo::toUSD( value.get() ); + VtValue v = IECoreUSD::DataAlgo::toUSD( value.get() ); if( !v.IsEmpty() ) { result[name] = v; @@ -489,7 +489,7 @@ pxr::VtValue IECoreUSD::DataAlgo::toUSD( const IECore::Data *data, bool arrayReq // Manual dispatch since CompoundData not handled by `dispatch()`. return valueFromData( cd, arrayRequired ); } - return IECore::dispatch( data, valueFromData, arrayRequired ); + return IECore::DataAlgo::dispatch( data, valueFromData, arrayRequired ); } catch( const IECore::Exception & ) { @@ -528,14 +528,14 @@ struct VtValueTypeNameFromData { using ArrayType = VtArray::USDType>; const auto &s = SdfSchema::GetInstance(); - return s.FindType( TfType::Find(), DataAlgo::role( data->getInterpretation() ) ); + return s.FindType( TfType::Find(), IECoreUSD::DataAlgo::role( data->getInterpretation() ) ); } template SdfValueTypeName operator()( const IECore::GeometricTypedData *data ) const { const auto &s = SdfSchema::GetInstance(); - return s.FindType( TfType::Find::USDType>(), DataAlgo::role( data->getInterpretation() ) ); + return s.FindType( TfType::Find::USDType>(), IECoreUSD::DataAlgo::role( data->getInterpretation() ) ); } // Colors @@ -600,7 +600,7 @@ pxr::SdfValueTypeName IECoreUSD::DataAlgo::valueTypeName( const IECore::Data *da { try { - return IECore::dispatch( data, VtValueTypeNameFromData() ); + return IECore::DataAlgo::dispatch( data, VtValueTypeNameFromData() ); } catch( const IECore::Exception & ) { diff --git a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp index 7cb620dac4..6afb068081 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp @@ -174,7 +174,7 @@ pxr::VtValue IECoreUSD::PrimitiveAlgo::toUSDExpanded( const IECoreScene::Primiti } else { - return IECore::dispatch( primitiveVariable.data.get(), VtValueFromExpandedData(), primitiveVariable.indices.get() ); + return IECore::DataAlgo::dispatch( primitiveVariable.data.get(), VtValueFromExpandedData(), primitiveVariable.indices.get() ); } } @@ -230,7 +230,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode return; } - IECore::DataPtr data = DataAlgo::fromUSD( + IECore::DataPtr data = IECoreUSD::DataAlgo::fromUSD( value, primVar.GetTypeName(), /* arrayAccepted = */ interpolation != IECoreScene::PrimitiveVariable::Constant || constantAcceptsArray ); @@ -245,7 +245,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode IECore::IntVectorDataPtr indices; if( !srcIndices.empty() ) { - indices = DataAlgo::fromUSD( srcIndices ); + indices = IECoreUSD::DataAlgo::fromUSD( srcIndices ); } addPrimitiveVariableIfValid( @@ -419,7 +419,7 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo } Canceller::check( canceller ); - auto p = boost::static_pointer_cast( DataAlgo::fromUSD( points ) ); + auto p = boost::static_pointer_cast( IECoreUSD::DataAlgo::fromUSD( points ) ); if( !p ) { return false; @@ -461,7 +461,7 @@ bool readPrimitiveVariables( const pxr::UsdSkelRoot &skelRoot, const pxr::UsdGeo if( normalsValid ) { - auto n = boost::static_pointer_cast( DataAlgo::fromUSD( normals ) ); + auto n = boost::static_pointer_cast( IECoreUSD::DataAlgo::fromUSD( normals ) ); n->setInterpretation( GeometricData::Normal ); addPrimitiveVariableIfValid( primitive, "N", IECoreScene::PrimitiveVariable( PrimitiveAlgo::fromUSD( normalsInterpolation ), n ), diff --git a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp index 9ed01c096c..bba43d6efb 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp @@ -647,13 +647,13 @@ void SceneCacheData::loadAttributes( const SceneInterface::Path& currentPath, Tf timeSamplesIO->read( g_interpretation, interpretationValue ); try { - setGeometricInterpretation( data, static_cast( interpretationValue ) ); + IECore::DataAlgo::setGeometricInterpretation( data, static_cast( interpretationValue ) ); } catch( ... ) { } } - usdType = DataAlgo::valueTypeName( data ); + usdType = IECoreUSD::DataAlgo::valueTypeName( data ); } else { @@ -815,13 +815,13 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo { try { - setGeometricInterpretation( data, static_cast( interpretationValue->readable() ) ); + IECore::DataAlgo::setGeometricInterpretation( data, static_cast( interpretationValue->readable() ) ); } catch( ... ) { } } - usdType = DataAlgo::valueTypeName( data ); + usdType = IECoreUSD::DataAlgo::valueTypeName( data ); } else { @@ -1643,14 +1643,14 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( attributeName == g_xformTransform ) { auto transform = currentScene->readTransformAsMatrix( frameToTime( time ) ); - return VtValue( DataAlgo::toUSD( transform ) ); + return VtValue( IECoreUSD::DataAlgo::toUSD( transform ) ); } else if ( attributeName == UsdGeomTokens->extent ) { auto bound = currentScene->readBound( frameToTime( time ) ); VtArray extent; - extent.push_back( DataAlgo::toUSD( V3f( bound.min ) ) ); - extent.push_back( DataAlgo::toUSD( V3f( bound.max ) ) ); + extent.push_back( IECoreUSD::DataAlgo::toUSD( V3f( bound.min ) ) ); + extent.push_back( IECoreUSD::DataAlgo::toUSD( V3f( bound.max ) ) ); return VtValue( extent ); } else if ( attributeName == UsdGeomTokens->visibility ) @@ -1675,7 +1675,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto attributeValue = currentScene->readAttribute( cortexAttributeName, frameToTime( time ) ) ) { - auto usdAttribute = DataAlgo::toUSD( runTimeCast( attributeValue.get() ) ); + auto usdAttribute = IECoreUSD::DataAlgo::toUSD( runTimeCast( attributeValue.get() ) ); return VtValue( usdAttribute ); } } @@ -1709,7 +1709,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time PrimitiveVariableMap::const_iterator csPrimVarIt = primitive->variables.find( g_csPrimVar ); if( csPrimVarIt != primitive->variables.end() ) { - auto usdCs = DataAlgo::toUSD( csPrimVarIt->second.data.get() ); + auto usdCs = IECoreUSD::DataAlgo::toUSD( csPrimVarIt->second.data.get() ); return VtValue( usdCs ); } } @@ -1721,7 +1721,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time PrimitiveVariableMap::const_iterator uvPrimVarIt = primitive->variables.find( g_uvPrimVar ); if( uvPrimVarIt != primitive->variables.end() ) { - auto usdST = DataAlgo::toUSD( uvPrimVarIt->second.data.get() ); + auto usdST = IECoreUSD::DataAlgo::toUSD( uvPrimVarIt->second.data.get() ); return VtValue( usdST ); } } @@ -1735,7 +1735,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto uvIndices = uvPrimVarIt->second.indices ) { - auto usdStIndices = DataAlgo::toUSD( uvIndices.get() ); + auto usdStIndices = IECoreUSD::DataAlgo::toUSD( uvIndices.get() ); return VtValue( usdStIndices ); } else @@ -1746,7 +1746,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { identityUvIndices.push_back( i ); } - return VtValue( DataAlgo::toUSD( identityUvIndicesData.get() ) ); + return VtValue( IECoreUSD::DataAlgo::toUSD( identityUvIndicesData.get() ) ); } } } @@ -1772,7 +1772,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto normalsIndices = normalsPrimVarIt->second.indices ) { - auto usdStIndices = DataAlgo::toUSD( normalsIndices.get() ); + auto usdStIndices = IECoreUSD::DataAlgo::toUSD( normalsIndices.get() ); return VtValue( usdStIndices ); } else @@ -1783,7 +1783,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { identityNormalsIndices.push_back( i ); } - return VtValue( DataAlgo::toUSD( identityNormalsIndicesData.get() ) ); + return VtValue( IECoreUSD::DataAlgo::toUSD( identityNormalsIndicesData.get() ) ); } } } @@ -1792,7 +1792,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdFaceVertexCounts = DataAlgo::toUSD( mesh->verticesPerFace() ); + auto usdFaceVertexCounts = IECoreUSD::DataAlgo::toUSD( mesh->verticesPerFace() ); return VtValue( usdFaceVertexCounts ); } } @@ -1800,7 +1800,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto curves = dynamic_cast( object.get() ) ) { - auto usdCurveVertexCounts = DataAlgo::toUSD( curves->verticesPerCurve() ); + auto usdCurveVertexCounts = IECoreUSD::DataAlgo::toUSD( curves->verticesPerCurve() ); return VtValue( usdCurveVertexCounts ); } } @@ -1863,7 +1863,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( auto camera = dynamic_cast( object.get() ) ) { float scale = 10.0f * camera->getFocalLengthWorldScale(); - auto usdFocal = DataAlgo::toUSD( camera->getFocalLength() * scale ); + auto usdFocal = IECoreUSD::DataAlgo::toUSD( camera->getFocalLength() * scale ); return VtValue( usdFocal ); } } @@ -1872,7 +1872,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( auto camera = dynamic_cast( object.get() ) ) { float scale = 10.0f * camera->getFocalLengthWorldScale(); - auto usdHorizontalAperture = DataAlgo::toUSD( camera->getAperture()[0] * scale ); + auto usdHorizontalAperture = IECoreUSD::DataAlgo::toUSD( camera->getAperture()[0] * scale ); return VtValue( usdHorizontalAperture ); } } @@ -1881,7 +1881,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( auto camera = dynamic_cast( object.get() ) ) { float scale = 10.0f * camera->getFocalLengthWorldScale(); - auto usdverticalAperture = DataAlgo::toUSD( camera->getAperture()[1] * scale ); + auto usdverticalAperture = IECoreUSD::DataAlgo::toUSD( camera->getAperture()[1] * scale ); return VtValue( usdverticalAperture ); } } @@ -1890,7 +1890,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( auto camera = dynamic_cast( object.get() ) ) { float scale = 10.0f * camera->getFocalLengthWorldScale(); - auto usdHorizontalApertureOffset = DataAlgo::toUSD( camera->getApertureOffset()[0] * scale ); + auto usdHorizontalApertureOffset = IECoreUSD::DataAlgo::toUSD( camera->getApertureOffset()[0] * scale ); return VtValue( usdHorizontalApertureOffset ); } } @@ -1899,7 +1899,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time if ( auto camera = dynamic_cast( object.get() ) ) { float scale = 10.0f * camera->getFocalLengthWorldScale(); - auto usdverticalApertureOffset = DataAlgo::toUSD( camera->getApertureOffset()[1] * scale ); + auto usdverticalApertureOffset = IECoreUSD::DataAlgo::toUSD( camera->getApertureOffset()[1] * scale ); return VtValue( usdverticalApertureOffset ); } } @@ -1907,7 +1907,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdVerticesPerFace = DataAlgo::toUSD( mesh->vertexIds() ); + auto usdVerticesPerFace = IECoreUSD::DataAlgo::toUSD( mesh->vertexIds() ); return VtValue( usdVerticesPerFace ); } } @@ -1915,7 +1915,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdCornerIndices = DataAlgo::toUSD( mesh->cornerIds() ); + auto usdCornerIndices = IECoreUSD::DataAlgo::toUSD( mesh->cornerIds() ); return VtValue( usdCornerIndices ); } } @@ -1923,7 +1923,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdCornerSharpnesses = DataAlgo::toUSD( mesh->cornerSharpnesses() ); + auto usdCornerSharpnesses = IECoreUSD::DataAlgo::toUSD( mesh->cornerSharpnesses() ); return VtValue( usdCornerSharpnesses ); } } @@ -1931,7 +1931,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdCreaseIndices = DataAlgo::toUSD( mesh->creaseIds() ); + auto usdCreaseIndices = IECoreUSD::DataAlgo::toUSD( mesh->creaseIds() ); return VtValue( usdCreaseIndices ); } } @@ -1939,7 +1939,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdCreaseLength = DataAlgo::toUSD( mesh->creaseLengths() ); + auto usdCreaseLength = IECoreUSD::DataAlgo::toUSD( mesh->creaseLengths() ); return VtValue( usdCreaseLength ); } } @@ -1947,7 +1947,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto mesh = dynamic_cast( object.get() ) ) { - auto usdCreaseSharpnesses = DataAlgo::toUSD( mesh->creaseSharpnesses() ); + auto usdCreaseSharpnesses = IECoreUSD::DataAlgo::toUSD( mesh->creaseSharpnesses() ); return VtValue( usdCreaseSharpnesses ); } } @@ -1973,7 +1973,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { if ( auto customIndices = customPrimVarIt->second.indices ) { - auto usdStIndices = DataAlgo::toUSD( customIndices.get() ); + auto usdStIndices = IECoreUSD::DataAlgo::toUSD( customIndices.get() ); return VtValue( usdStIndices ); } else @@ -1984,7 +1984,7 @@ const VtValue SceneCacheData::queryTimeSample( const SdfPath &path, double time { identityCustomIndices.push_back( i ); } - return VtValue( DataAlgo::toUSD( identityCustomIndicesData.get() ) ); + return VtValue( IECoreUSD::DataAlgo::toUSD( identityCustomIndicesData.get() ) ); } } else diff --git a/include/IECore/DataAlgo.h b/include/IECore/DataAlgo.h index 8d5ca21839..5ce071919a 100644 --- a/include/IECore/DataAlgo.h +++ b/include/IECore/DataAlgo.h @@ -41,6 +41,9 @@ namespace IECore { +namespace DataAlgo +{ + /// Try to get the geometric interpretation of the given data. Returns None if the data is not geometric. IECORE_API GeometricData::Interpretation getGeometricInterpretation( const IECore::Data *data ); @@ -104,6 +107,12 @@ typename std::invoke_result_t dispatch( Data *data, F &&fu template typename std::invoke_result_t dispatch( const Data *data, F &&functor, Args&&... args ); +} // namespace DataAlgo + +// Temporary backwards-compatibility with earlier non-namespaced version. +/// \todo Remove +using namespace DataAlgo; + } // namespace IECore #include "IECore/DataAlgo.inl" diff --git a/include/IECore/DataAlgo.inl b/include/IECore/DataAlgo.inl index c3fb36f17c..e52145b203 100644 --- a/include/IECore/DataAlgo.inl +++ b/include/IECore/DataAlgo.inl @@ -50,6 +50,31 @@ namespace IECore { +namespace Detail +{ + +template class Trait> +struct TestTrait +{ + + template + bool operator()( const T *data, typename std::enable_if::value>::type *enabler = nullptr ) + { + return true; + } + + bool operator()( const Data *data ) + { + return false; + } + +}; + +} // namespace Detail + +namespace DataAlgo +{ + template typename std::invoke_result_t dispatch( Data *data, F &&functor, Args&&... args ) { @@ -370,34 +395,14 @@ typename std::invoke_result_t dispatch( const Data * } } -namespace Detail -{ - -template class Trait> -struct TestTrait -{ - - template - bool operator()( const T *data, typename std::enable_if::value>::type *enabler = nullptr ) - { - return true; - } - - bool operator()( const Data *data ) - { - return false; - } - -}; - -} // namespace Detail - template class Trait> bool trait( const IECore::Data *data ) { return dispatch( data, Detail::TestTrait() ); } +} // namespace DataAlgo + } // namespace IECore #endif // IECORE_DATAALGO_INL diff --git a/src/IECore/DataAlgo.cpp b/src/IECore/DataAlgo.cpp index 356217f89e..94fefd9d9b 100644 --- a/src/IECore/DataAlgo.cpp +++ b/src/IECore/DataAlgo.cpp @@ -202,32 +202,32 @@ struct Address } // namespace -IECore::GeometricData::Interpretation IECore::getGeometricInterpretation( const IECore::Data *data ) +IECore::GeometricData::Interpretation IECore::DataAlgo::getGeometricInterpretation( const IECore::Data *data ) { return dispatch( data, GeometricInterpretationGetter() ); } -void IECore::setGeometricInterpretation( IECore::Data *data, IECore::GeometricData::Interpretation interpretation ) +void IECore::DataAlgo::setGeometricInterpretation( IECore::Data *data, IECore::GeometricData::Interpretation interpretation ) { dispatch( data, GeometricInterpretationSetter( interpretation ) ); } -IECore::DataPtr IECore::uniqueValues(const IECore::Data *data) +IECore::DataPtr IECore::DataAlgo::uniqueValues(const IECore::Data *data) { return dispatch( data, UniqueValueCollector() ); } -IECORE_API size_t IECore::size( const IECore::Data *data ) +IECORE_API size_t IECore::DataAlgo::size( const IECore::Data *data ) { return dispatch( data, Size() ); } -IECORE_API void *IECore::address( IECore::Data *data ) +IECORE_API void *IECore::DataAlgo::address( IECore::Data *data ) { return dispatch( data, Address() ); } -IECORE_API const void *IECore::address( const IECore::Data *data ) +IECORE_API const void *IECore::DataAlgo::address( const IECore::Data *data ) { return dispatch( data, Address() ); } diff --git a/src/IECore/ObjectInterpolator.cpp b/src/IECore/ObjectInterpolator.cpp index e7d01ca9d0..5093d77e25 100644 --- a/src/IECore/ObjectInterpolator.cpp +++ b/src/IECore/ObjectInterpolator.cpp @@ -115,7 +115,7 @@ struct DataInterpolator DataPtr interpolateData( const Data *y0, const Data *y1, double x ) { - return dispatch( y0, DataInterpolator( y1, x ) ); + return DataAlgo::dispatch( y0, DataInterpolator( y1, x ) ); } CompoundDataPtr interpolateCompoundData( const CompoundData *y0, const CompoundData *y1, double x ) diff --git a/src/IECoreGL/ToGLBufferConverter.cpp b/src/IECoreGL/ToGLBufferConverter.cpp index 2598136591..ab90290374 100644 --- a/src/IECoreGL/ToGLBufferConverter.cpp +++ b/src/IECoreGL/ToGLBufferConverter.cpp @@ -84,7 +84,7 @@ IECore::RunTimeTypedPtr ToGLBufferConverter::doConversion( IECore::ConstObjectPt const Data *data = static_cast( src.get() ); // safe because the parameter validated it for us return new Buffer( - address( data ), - dispatch( data, Bytes() ) + DataAlgo::address( data ), + DataAlgo::dispatch( data, Bytes() ) ); } diff --git a/src/IECoreImage/ImagePrimitive.cpp b/src/IECoreImage/ImagePrimitive.cpp index ce5176672a..ef241c831f 100644 --- a/src/IECoreImage/ImagePrimitive.cpp +++ b/src/IECoreImage/ImagePrimitive.cpp @@ -391,7 +391,7 @@ bool ImagePrimitive::channelValid( const IECore::Data *data, std::string *reason return false; } - if( !trait( data ) ) + if( !DataAlgo::trait( data ) ) { if( reason ) { @@ -400,7 +400,7 @@ bool ImagePrimitive::channelValid( const IECore::Data *data, std::string *reason return false; } - size_t size = IECore::size( data ); + size_t size = IECore::DataAlgo::size( data ); size_t numPixels = channelSize(); if( size!=numPixels ) { diff --git a/src/IECorePython/DataAlgoBinding.cpp b/src/IECorePython/DataAlgoBinding.cpp index 57e20b4519..89cbee6bdd 100644 --- a/src/IECorePython/DataAlgoBinding.cpp +++ b/src/IECorePython/DataAlgoBinding.cpp @@ -46,7 +46,7 @@ namespace PyObject *addressWrapper( Data *data ) { - return PyLong_FromVoidPtr( address( data ) ); + return PyLong_FromVoidPtr( DataAlgo::address( data ) ); } } // namespace @@ -56,12 +56,12 @@ namespace IECorePython void bindDataAlgo() { - def( "getGeometricInterpretation", &getGeometricInterpretation ); - def( "setGeometricInterpretation", &setGeometricInterpretation ); + def( "getGeometricInterpretation", &IECore::DataAlgo::getGeometricInterpretation ); + def( "setGeometricInterpretation", &IECore::DataAlgo::setGeometricInterpretation ); - def( "uniqueValues", &uniqueValues ); + def( "uniqueValues", &IECore::DataAlgo::uniqueValues ); - def( "size", &IECore::size ); + def( "size", &IECore::DataAlgo::size ); def( "address", &addressWrapper ); } diff --git a/src/IECorePython/MurmurHashBinding.cpp b/src/IECorePython/MurmurHashBinding.cpp index f5b73c96e7..f195e80151 100644 --- a/src/IECorePython/MurmurHashBinding.cpp +++ b/src/IECorePython/MurmurHashBinding.cpp @@ -110,15 +110,15 @@ void testMurmurHashDispatch() HashDispatchFunctor hashFunctor; IECore::MurmurHash h; h.append( 42.37f ); - IECORETEST_ASSERT( h == IECore::dispatch( IECore::FloatDataPtr( new IECore::FloatData( 42.37 ) ).get(), hashFunctor ) ); + IECORETEST_ASSERT( h == IECore::DataAlgo::dispatch( IECore::FloatDataPtr( new IECore::FloatData( 42.37 ) ).get(), hashFunctor ) ); h = IECore::MurmurHash(); h.append( std::string("foo") ); - IECORETEST_ASSERT( h == IECore::dispatch( IECore::StringDataPtr( new IECore::StringData( "foo" ) ).get(), hashFunctor ) ); + IECORETEST_ASSERT( h == IECore::DataAlgo::dispatch( IECore::StringDataPtr( new IECore::StringData( "foo" ) ).get(), hashFunctor ) ); h = IECore::MurmurHash(); h.append( std::vector{ 1, 3, 37.03 } ); - IECORETEST_ASSERT( h == IECore::dispatch( IECore::FloatVectorDataPtr( new IECore::FloatVectorData( std::vector{ 1, 3, 37.03 } ) ).get(), hashFunctor ) ); + IECORETEST_ASSERT( h == IECore::DataAlgo::dispatch( IECore::FloatVectorDataPtr( new IECore::FloatVectorData( std::vector{ 1, 3, 37.03 } ) ).get(), hashFunctor ) ); } } // namespace diff --git a/src/IECoreScene/CurvesAlgo.cpp b/src/IECoreScene/CurvesAlgo.cpp index 6484749832..cfab233997 100644 --- a/src/IECoreScene/CurvesAlgo.cpp +++ b/src/IECoreScene/CurvesAlgo.cpp @@ -398,7 +398,7 @@ CurvesPrimitivePtr deleteCurves( const IECore::Data *inputVertsPerCurve = IECore::runTimeCast( curvesPrimitive->verticesPerCurve() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputVertsPerCurve = dispatch( inputVertsPerCurve, deleteUniformFn ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputVertsPerCurve = DataAlgo::dispatch( inputVertsPerCurve, deleteUniformFn ); IntVectorDataPtr verticesPerCurve = IECore::runTimeCast( outputVertsPerCurve.data ); @@ -426,7 +426,7 @@ CurvesPrimitivePtr deleteCurves( { const IECore::Data *inputData = it->second.data.get(); deleteUniformFn.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch( inputData, deleteUniformFn ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch( inputData, deleteUniformFn ); outCurvesPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; @@ -436,7 +436,7 @@ CurvesPrimitivePtr deleteCurves( { const IECore::Data *inputData = it->second.data.get(); deleteVaryingFn.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch( inputData, deleteVaryingFn ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch( inputData, deleteVaryingFn ); outCurvesPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; @@ -445,7 +445,7 @@ CurvesPrimitivePtr deleteCurves( { const IECore::Data *inputData = it->second.data.get(); deleteVertexFn.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch( inputData, deleteVertexFn ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch( inputData, deleteVertexFn ); outCurvesPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; } @@ -524,12 +524,12 @@ void resamplePrimitiveVariable( const CurvesPrimitive *curves, PrimitiveVariable if ( interpolation == PrimitiveVariable::Constant ) { Detail::AverageValueFromVector fn; - dstData = dispatch( srcData.get(), fn ); + dstData = DataAlgo::dispatch( srcData.get(), fn ); } else if ( primitiveVariable.interpolation == PrimitiveVariable::Constant ) { Detail::FillVectorFromValue fn( curves->variableSize( interpolation ) ); - dstData = dispatch( srcData.get(), fn ); + dstData = DataAlgo::dispatch( srcData.get(), fn ); } else if ( interpolation == PrimitiveVariable::Uniform ) { diff --git a/src/IECoreScene/CurvesAlgoConvertPinned.cpp b/src/IECoreScene/CurvesAlgoConvertPinned.cpp index 964308f10d..56502f0156 100644 --- a/src/IECoreScene/CurvesAlgoConvertPinned.cpp +++ b/src/IECoreScene/CurvesAlgoConvertPinned.cpp @@ -150,7 +150,7 @@ void CurvesAlgo::convertPinnedToNonPeriodic( CurvesPrimitive *curves, const IECo } else { - dispatch( + DataAlgo::dispatch( primitiveVariable.data.get(), /// \todo Capture can just be `[&]` when we get C++20. [&, &primitiveVariable=primitiveVariable] ( auto data ) { diff --git a/src/IECoreScene/CurvesAlgoSegment.cpp b/src/IECoreScene/CurvesAlgoSegment.cpp index e0237b44fe..3049fe9bc5 100644 --- a/src/IECoreScene/CurvesAlgoSegment.cpp +++ b/src/IECoreScene/CurvesAlgoSegment.cpp @@ -51,7 +51,7 @@ std::vector IECoreScene::CurvesAlgo::segment( const CurvesPr DataPtr data; if( !segmentValues ) { - data = IECore::uniqueValues( primitiveVariable.data.get() ); + data = IECore::DataAlgo::uniqueValues( primitiveVariable.data.get() ); segmentValues = data.get(); } @@ -74,5 +74,5 @@ std::vector IECoreScene::CurvesAlgo::segment( const CurvesPr IECoreScene::Detail::TaskSegmenter segmenter( curves, const_cast ( segmentValues ), primitiveVariableName, f, canceller ); - return dispatch( primitiveVariable.data.get(), segmenter ); + return DataAlgo::dispatch( primitiveVariable.data.get(), segmenter ); } diff --git a/src/IECoreScene/CurvesAlgoUpdateEndpointMultiplicity.cpp b/src/IECoreScene/CurvesAlgoUpdateEndpointMultiplicity.cpp index 75f7a4037e..16037d2b39 100644 --- a/src/IECoreScene/CurvesAlgoUpdateEndpointMultiplicity.cpp +++ b/src/IECoreScene/CurvesAlgoUpdateEndpointMultiplicity.cpp @@ -81,7 +81,7 @@ void adjustEndPoints( const std::vector &in, std::vector &out, const Curve out.push_back( in[curveOffset + j] ); } - // duplicate the end point + // duplicate the end point for( size_t j = 0; j < (size_t)adjustment; ++j ) { out.push_back( in[curveOffset + size - 1] ); @@ -137,7 +137,7 @@ struct DuplicateEndPoints adjustEndPoints( in, newOut->writable(), curves, primVar.interpolation, adjustment ); - setGeometricInterpretation( newOut.get(), getGeometricInterpretation( data ) ); + DataAlgo::setGeometricInterpretation( newOut.get(), DataAlgo::getGeometricInterpretation( data ) ); return newOut; } @@ -199,12 +199,12 @@ CurvesPrimitivePtr IECoreScene::CurvesAlgo::updateEndpointMultiplicity( const IE Canceller::check( canceller ); if( it.second.indices ) { - auto newIndices = IECore::runTimeCast( IECore::dispatch( it.second.indices.get(), endPointDuplicator, curves, it.second ) ); + auto newIndices = IECore::runTimeCast( IECore::DataAlgo::dispatch( it.second.indices.get(), endPointDuplicator, curves, it.second ) ); newPrimVars[it.first] = IECoreScene::PrimitiveVariable( it.second.interpolation, it.second.data, newIndices ); } else { - auto newVertexData = IECore::dispatch( it.second.data.get(), endPointDuplicator, curves, it.second ); + auto newVertexData = IECore::DataAlgo::dispatch( it.second.data.get(), endPointDuplicator, curves, it.second ); newPrimVars[it.first] = IECoreScene::PrimitiveVariable( it.second.interpolation, newVertexData ); } }; diff --git a/src/IECoreScene/MeshAlgoDeleteFaces.cpp b/src/IECoreScene/MeshAlgoDeleteFaces.cpp index d83929fd83..1dd9dbcd13 100644 --- a/src/IECoreScene/MeshAlgoDeleteFaces.cpp +++ b/src/IECoreScene/MeshAlgoDeleteFaces.cpp @@ -160,13 +160,13 @@ MeshPrimitivePtr deleteFaces( const MeshPrimitive *meshPrimitive, PrimitiveVaria // filter verticesPerFace using DeleteFlaggedUniformFunctor const IECore::Data *inputVerticesPerFace = IECore::runTimeCast( meshPrimitive->verticesPerFace() ); uniformFunctor.setIndices( nullptr ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputVerticesPerFace = dispatch( inputVerticesPerFace, uniformFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputVerticesPerFace = DataAlgo::dispatch( inputVerticesPerFace, uniformFunctor ); IntVectorDataPtr verticesPerFace = IECore::runTimeCast( outputVerticesPerFace.data ); // filter VertexIds using DeleteFlaggedFaceVaryingFunctor const IECore::Data *inputVertexIds = IECore::runTimeCast( meshPrimitive->vertexIds() ); faceVaryingFunctor.setIndices( nullptr ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputVertexIds = dispatch( inputVertexIds, faceVaryingFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputVertexIds = DataAlgo::dispatch( inputVertexIds, faceVaryingFunctor ); // remap the indices also ConstIntVectorDataPtr remappingData = vertexFunctor.getRemapping(); @@ -205,7 +205,7 @@ MeshPrimitivePtr deleteFaces( const MeshPrimitive *meshPrimitive, PrimitiveVaria { const IECore::Data *inputData = it->second.data.get(); uniformFunctor.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch( inputData, uniformFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch( inputData, uniformFunctor ); outMeshPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; } @@ -214,7 +214,7 @@ MeshPrimitivePtr deleteFaces( const MeshPrimitive *meshPrimitive, PrimitiveVaria { const IECore::Data *inputData = it->second.data.get(); vertexFunctor.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch( inputData, vertexFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch( inputData, vertexFunctor ); outMeshPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; } @@ -223,7 +223,7 @@ MeshPrimitivePtr deleteFaces( const MeshPrimitive *meshPrimitive, PrimitiveVaria { const IECore::Data *inputData = it->second.data.get(); faceVaryingFunctor.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = dispatch(inputData, faceVaryingFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData outputData = DataAlgo::dispatch(inputData, faceVaryingFunctor ); outMeshPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, outputData.data, outputData.indices ); break; } diff --git a/src/IECoreScene/MeshAlgoDistributePoints.cpp b/src/IECoreScene/MeshAlgoDistributePoints.cpp index e99dc84fad..8f3e9e91fa 100644 --- a/src/IECoreScene/MeshAlgoDistributePoints.cpp +++ b/src/IECoreScene/MeshAlgoDistributePoints.cpp @@ -541,7 +541,7 @@ PointsPrimitivePtr MeshAlgo::distributePoints( const MeshPrimitive *mesh, float else { PrimitiveVariable::Interpolation sourceInterpolation = i.second.interpolation; - dispatch( i.second.data.get(), + DataAlgo::dispatch( i.second.data.get(), [ &i, numPoints, sourceInterpolation, &result, &toResample]( const auto *sourceData ) { using DataType = typename std::remove_const_t< std::remove_pointer_t< decltype( sourceData ) > >; @@ -596,7 +596,7 @@ PointsPrimitivePtr MeshAlgo::distributePoints( const MeshPrimitive *mesh, float { for( auto &var : toResample ) { - dispatch( var.target, + DataAlgo::dispatch( var.target, [ &var, &vertexIds, &chunkResults, &chunkOffsets, &range, canceller ]( auto *targetData ) { using DataType = typename std::remove_const_t< std::remove_pointer_t< decltype( targetData ) > >; diff --git a/src/IECoreScene/MeshAlgoReorder.cpp b/src/IECoreScene/MeshAlgoReorder.cpp index 6eec2e4478..a2d5d5d60e 100644 --- a/src/IECoreScene/MeshAlgoReorder.cpp +++ b/src/IECoreScene/MeshAlgoReorder.cpp @@ -530,7 +530,7 @@ void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2, } else { - it->second.data = dispatch( it->second.data.get(), faceVaryingFn, it->first ); + it->second.data = DataAlgo::dispatch( it->second.data.get(), faceVaryingFn, it->first ); } } else if( it->second.interpolation == PrimitiveVariable::Vertex || it->second.interpolation == PrimitiveVariable::Varying ) @@ -542,7 +542,7 @@ void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2, } else { - it->second.data = dispatch( it->second.data.get(), vertexFn, it->first ); + it->second.data = DataAlgo::dispatch( it->second.data.get(), vertexFn, it->first ); } } else if( it->second.interpolation == PrimitiveVariable::Uniform ) @@ -554,7 +554,7 @@ void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2, } else { - it->second.data = dispatch( it->second.data.get(), uniformFn, it->first ); + it->second.data = DataAlgo::dispatch( it->second.data.get(), uniformFn, it->first ); } } } diff --git a/src/IECoreScene/MeshAlgoResample.cpp b/src/IECoreScene/MeshAlgoResample.cpp index 4fa7de5786..fdb6543422 100644 --- a/src/IECoreScene/MeshAlgoResample.cpp +++ b/src/IECoreScene/MeshAlgoResample.cpp @@ -322,7 +322,7 @@ void IECoreScene::MeshAlgo::resamplePrimitiveVariable( const MeshPrimitive *mesh if ( interpolation == PrimitiveVariable::Constant ) { IECoreScene::Detail::AverageValueFromVector fn; - dstData = dispatch( srcData.get(), fn ); + dstData = DataAlgo::dispatch( srcData.get(), fn ); primitiveVariable = PrimitiveVariable( interpolation, dstData ); return; } @@ -330,7 +330,7 @@ void IECoreScene::MeshAlgo::resamplePrimitiveVariable( const MeshPrimitive *mesh if ( primitiveVariable.interpolation == PrimitiveVariable::Constant ) { IECoreScene::Detail::FillVectorFromValue fn( mesh->variableSize( interpolation ) ); - DataPtr arrayData = dispatch( srcData.get(), fn ); + DataPtr arrayData = DataAlgo::dispatch( srcData.get(), fn ); if (arrayData) { primitiveVariable = PrimitiveVariable(interpolation, arrayData); diff --git a/src/IECoreScene/MeshAlgoSegment.cpp b/src/IECoreScene/MeshAlgoSegment.cpp index 46a31f3480..a2c755b8c2 100644 --- a/src/IECoreScene/MeshAlgoSegment.cpp +++ b/src/IECoreScene/MeshAlgoSegment.cpp @@ -59,7 +59,7 @@ std::vector IECoreScene::MeshAlgo::segment( const MeshPrimitiv } else { - IECore::dispatch( segmentValues, + IECore::DataAlgo::dispatch( segmentValues, [ ms, numMeshes, &ret, canceller ]( auto *typedSegmentValues ) { using DataType = typename std::remove_pointer_t< decltype( typedSegmentValues ) >; diff --git a/src/IECoreScene/MeshAlgoSplit.cpp b/src/IECoreScene/MeshAlgoSplit.cpp index 587e3e3304..0c25ef1791 100644 --- a/src/IECoreScene/MeshAlgoSplit.cpp +++ b/src/IECoreScene/MeshAlgoSplit.cpp @@ -362,7 +362,7 @@ IECoreScene::MeshAlgo::MeshSplitter::MeshSplitter( ConstMeshPrimitivePtr mesh, c int remapSegmentIndexMin = 0; - IECore::dispatch( segmentPrimitiveVariable.data.get(), [ segmentPrimitiveVariable, &numSegments, &faceToSegmentIndexData, &remapSegmentIndices, &remapSegmentIndexMin, canceller]( const auto *primVarData ) + IECore::DataAlgo::dispatch( segmentPrimitiveVariable.data.get(), [ segmentPrimitiveVariable, &numSegments, &faceToSegmentIndexData, &remapSegmentIndices, &remapSegmentIndexMin, canceller]( const auto *primVarData ) { using DataType = typename std::remove_pointer_t< decltype( primVarData ) >; if constexpr ( !TypeTraits::IsVectorTypedData::value ) @@ -960,7 +960,7 @@ MeshPrimitivePtr IECoreScene::MeshAlgo::MeshSplitter::mesh( int segmentId, const continue; } Canceller::check( canceller ); - ret->variables[ p.first ] = IECore::dispatch( p.second.data.get(), ResamplePrimitiveVariableFunctor(), p.second, startIndex, numFaces, totalFaceVerts, m_faceRemap, sourceVerticesPerFace, m_faceIndices, vertRemapBackwards, canceller ); + ret->variables[ p.first ] = IECore::DataAlgo::dispatch( p.second.data.get(), ResamplePrimitiveVariableFunctor(), p.second, startIndex, numFaces, totalFaceVerts, m_faceRemap, sourceVerticesPerFace, m_faceIndices, vertRemapBackwards, canceller ); } return ret; diff --git a/src/IECoreScene/MeshAlgoTangents.cpp b/src/IECoreScene/MeshAlgoTangents.cpp index 22a8500951..212233ffbf 100644 --- a/src/IECoreScene/MeshAlgoTangents.cpp +++ b/src/IECoreScene/MeshAlgoTangents.cpp @@ -164,7 +164,7 @@ std::pair IECoreScene::MeshAlgo::calculate PrimitiveVariable::IndexedView uvIndexedView( *uvData, uvIndices ); - size_t numUVs = IECore::size( uvIt->second.data.get() ); + size_t numUVs = IECore::DataAlgo::size( uvIt->second.data.get() ); Canceller::check( canceller ); std::vector uTangents( numUVs, V3f( 0 ) ); diff --git a/src/IECoreScene/MeshAlgoTriangulate.cpp b/src/IECoreScene/MeshAlgoTriangulate.cpp index c4b9b46707..d65b88f0f1 100644 --- a/src/IECoreScene/MeshAlgoTriangulate.cpp +++ b/src/IECoreScene/MeshAlgoTriangulate.cpp @@ -144,7 +144,7 @@ void triangulateMeshIndices( DataPtr newMatchingData( const Data *source ) { - return dispatch( source, + return DataAlgo::dispatch( source, []( const auto *typedSource ) -> DataPtr { using DataType = typename std::remove_const_t< std::remove_pointer_t< decltype( typedSource ) > >; diff --git a/src/IECoreScene/MeshAlgoWinding.cpp b/src/IECoreScene/MeshAlgoWinding.cpp index ee4c1de0eb..40ad79f602 100644 --- a/src/IECoreScene/MeshAlgoWinding.cpp +++ b/src/IECoreScene/MeshAlgoWinding.cpp @@ -113,7 +113,7 @@ void IECoreScene::MeshAlgo::reverseWinding( MeshPrimitive *mesh, const Canceller } else if( visited.insert( it.second.data.get() ).second ) { - dispatch( it.second.data.get(), reverseWindingFunctor ); + DataAlgo::dispatch( it.second.data.get(), reverseWindingFunctor ); } } } diff --git a/src/IECoreScene/PointsAlgo.cpp b/src/IECoreScene/PointsAlgo.cpp index 2e329870e1..2e7b45b3c1 100644 --- a/src/IECoreScene/PointsAlgo.cpp +++ b/src/IECoreScene/PointsAlgo.cpp @@ -129,7 +129,7 @@ PointsPrimitivePtr deletePoints( const PointsPrimitive *pointsPrimitive, IECoreS } const IECore::Data *inputData = it->second.data.get(); vertexFunctor.setIndices( it->second.indices.get() ); - IECoreScene::PrimitiveVariableAlgos::IndexedData indexedData = dispatch( inputData, vertexFunctor ); + IECoreScene::PrimitiveVariableAlgos::IndexedData indexedData = DataAlgo::dispatch( inputData, vertexFunctor ); outPointsPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, indexedData.data, indexedData.indices ); break; } @@ -244,7 +244,7 @@ void resamplePrimitiveVariable( const PointsPrimitive *points, PrimitiveVariable if ( interpolation == PrimitiveVariable::Constant ) { Detail::AverageValueFromVector fn; - dstData = dispatch( srcData.get(), fn ); + dstData = DataAlgo::dispatch( srcData.get(), fn ); primitiveVariable = PrimitiveVariable(PrimitiveVariable::Constant, dstData ); return; } @@ -252,7 +252,7 @@ void resamplePrimitiveVariable( const PointsPrimitive *points, PrimitiveVariable if ( primitiveVariable.interpolation == PrimitiveVariable::Constant ) { Detail::FillVectorFromValue fn( points->variableSize( interpolation ) ); - DataPtr arrayData = dispatch( srcData.get(), fn ); + DataPtr arrayData = DataAlgo::dispatch( srcData.get(), fn ); if (arrayData) { primitiveVariable = PrimitiveVariable(interpolation, arrayData); diff --git a/src/IECoreScene/PointsAlgoSegment.cpp b/src/IECoreScene/PointsAlgoSegment.cpp index b1151d2ff4..0533254ff2 100644 --- a/src/IECoreScene/PointsAlgoSegment.cpp +++ b/src/IECoreScene/PointsAlgoSegment.cpp @@ -54,7 +54,7 @@ std::vector IECoreScene::PointsAlgo::segment( DataPtr data; if( !segmentValues ) { - data = IECore::uniqueValues( primitiveVariable.data.get() ); + data = IECore::DataAlgo::uniqueValues( primitiveVariable.data.get() ); segmentValues = data.get(); } @@ -75,5 +75,5 @@ std::vector IECoreScene::PointsAlgo::segment( auto f = PointsAlgo::deletePoints; IECoreScene::Detail::TaskSegmenter segmenter( points, const_cast (segmentValues), primitiveVariableName, f, canceller ); - return dispatch( primitiveVariable.data.get(), segmenter ); + return DataAlgo::dispatch( primitiveVariable.data.get(), segmenter ); } diff --git a/src/IECoreScene/PrimitiveInterpolator.cpp b/src/IECoreScene/PrimitiveInterpolator.cpp index 69ea3aaafd..4eb2e16bbf 100644 --- a/src/IECoreScene/PrimitiveInterpolator.cpp +++ b/src/IECoreScene/PrimitiveInterpolator.cpp @@ -78,8 +78,8 @@ PrimitivePtr interpolatePrimitive( const Primitive *y0, const Primitive *y1, dou const Data *y0Sample = y0PrimVar.data.get(); const Data *y1Sample = y1PrimVar.data.get(); - size_t y0Size = IECore::size( y0Sample ); - size_t y1Size = IECore::size( y1Sample ); + size_t y0Size = IECore::DataAlgo::size( y0Sample ); + size_t y1Size = IECore::DataAlgo::size( y1Sample ); if( y0Size != y1Size ) { diff --git a/src/IECoreScene/PrimitiveVariable.cpp b/src/IECoreScene/PrimitiveVariable.cpp index 1a6648adc7..5b4b095de8 100644 --- a/src/IECoreScene/PrimitiveVariable.cpp +++ b/src/IECoreScene/PrimitiveVariable.cpp @@ -169,5 +169,5 @@ DataPtr PrimitiveVariable::expandedData() const return data->copy(); } - return dispatch( data.get(), Expander( indices->readable() ) ); + return DataAlgo::dispatch( data.get(), Expander( indices->readable() ) ); } diff --git a/src/IECoreScene/ShaderNetworkAlgo.cpp b/src/IECoreScene/ShaderNetworkAlgo.cpp index 09e73196e8..b11016b2dc 100644 --- a/src/IECoreScene/ShaderNetworkAlgo.cpp +++ b/src/IECoreScene/ShaderNetworkAlgo.cpp @@ -441,7 +441,7 @@ void ShaderNetworkAlgo::addComponentConnectionAdapters( ShaderNetwork *network, // Set fallback values for adapter input parameters (since all may not receive connections). - dispatch( + DataAlgo::dispatch( parameterValue, [&] ( auto *d ) { using DataType = typename std::remove_const_t>; diff --git a/src/IECoreScene/bindings/MeshAlgoBinding.cpp b/src/IECoreScene/bindings/MeshAlgoBinding.cpp index 5559d4f83b..0d521ba199 100644 --- a/src/IECoreScene/bindings/MeshAlgoBinding.cpp +++ b/src/IECoreScene/bindings/MeshAlgoBinding.cpp @@ -227,7 +227,7 @@ std::pair correspondingFaceV // type IECore::DataPtr meshSplitterValueWrapper( const IECoreScene::MeshAlgo::MeshSplitter &meshSplitter, int segmentId ) { - return IECore::dispatch( meshSplitter.segmentPrimitiveVariable().data.get(), [ meshSplitter, segmentId ]( const auto *primVarData ) -> IECore::DataPtr + return IECore::DataAlgo::dispatch( meshSplitter.segmentPrimitiveVariable().data.get(), [ meshSplitter, segmentId ]( const auto *primVarData ) -> IECore::DataPtr { using DataType = typename std::remove_pointer_t< decltype( primVarData ) >; if constexpr ( !IECore::TypeTraits::IsVectorTypedData::value )