diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 5e1853824..783e8fdf3 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -159,11 +159,20 @@ SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) cons return editedChildPaths; } -bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) +void PruningSceneIndex::SetFilterStatus(const TfToken& pruningToken, bool enabled) +{ + if (enabled) { + _EnableFilter(pruningToken); + } else { + _DisableFilter(pruningToken); + } +} + +void PruningSceneIndex::_EnableFilter(const TfToken& pruningToken) { if (_prunedPathsByFilter.find(pruningToken) != _prunedPathsByFilter.end()) { // Filter already enabled, no change needed. - return false; + return; } // Enable the filter @@ -185,15 +194,13 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) if (!prunedPrims.empty()) { _SendPrimsRemoved(prunedPrims); } - - return true; } -bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) +void PruningSceneIndex::_DisableFilter(const TfToken& pruningToken) { if (_prunedPathsByFilter.find(pruningToken) == _prunedPathsByFilter.end()) { // Filter already disabled, no change needed. - return false; + return; } HdSceneIndexObserver::AddedPrimEntries unprunedPrims; @@ -214,8 +221,6 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) if (!unprunedPrims.empty()) { _SendPrimsAdded(unprunedPrims); } - - return true; } std::set PruningSceneIndex::GetActiveFilters() diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index cba10bd5a..3549959cb 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -74,13 +74,9 @@ class PruningSceneIndex : FVP_API void AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot); - // Enable a filter and prune out its matching prims + // Enable or disable a filter and send corresponding prim notifications FVP_API - bool EnableFilter(const PXR_NS::TfToken& pruningToken); - - // Disable a filter and re-add its filtered prims - FVP_API - bool DisableFilter(const PXR_NS::TfToken& pruningToken); + void SetFilterStatus(const PXR_NS::TfToken& pruningToken, bool enabled); // Returns the tokens corresponding to the currently enabled filters. FVP_API @@ -113,6 +109,12 @@ class PruningSceneIndex : void _PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) override; + + FVP_API + void _EnableFilter(const PXR_NS::TfToken& pruningToken); + + FVP_API + void _DisableFilter(const PXR_NS::TfToken& pruningToken); FVP_API void _InsertEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index ce321f9ea..63efe1361 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -824,11 +824,7 @@ MStatus MtohRenderOverride::Render( for (auto [mayaFilter, fvpPruningTokens] : mayaFiltersToFvpPruningTokens) { for (const auto& fvpPruningToken : fvpPruningTokens) { - if (objectExclusions & mayaFilter) { - _pruningSceneIndex->EnableFilter(fvpPruningToken); - } else { - _pruningSceneIndex->DisableFilter(fvpPruningToken); - } + _pruningSceneIndex->SetFilterStatus(fvpPruningToken, objectExclusions & mayaFilter); } } }