From e123772be9dda73f49ac646deaa5725015a36d27 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 15:41:34 -0400 Subject: [PATCH 01/40] HYDRA-1098 : Add new pruning scene index --- lib/flowViewport/sceneIndex/CMakeLists.txt | 2 + .../sceneIndex/fvpPruningSceneIndex.cpp | 76 +++++++++++++++++++ .../sceneIndex/fvpPruningSceneIndex.h | 73 ++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp create mode 100644 lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h diff --git a/lib/flowViewport/sceneIndex/CMakeLists.txt b/lib/flowViewport/sceneIndex/CMakeLists.txt index 56d3c1458..364e0463d 100644 --- a/lib/flowViewport/sceneIndex/CMakeLists.txt +++ b/lib/flowViewport/sceneIndex/CMakeLists.txt @@ -13,6 +13,7 @@ target_sources(${TARGET_NAME} fvpWireframeSelectionHighlightSceneIndex.cpp fvpDisplayStyleOverrideSceneIndex.cpp fvpPruneTexturesSceneIndex.cpp + fvpPruningSceneIndex.cpp fvpBBoxSceneIndex.cpp fvpReprSelectorSceneIndex.cpp fvpBlockPrimRemovalPropagationSceneIndex.cpp @@ -32,6 +33,7 @@ set(HEADERS fvpWireframeSelectionHighlightSceneIndex.h fvpDisplayStyleOverrideSceneIndex.h fvpPruneTexturesSceneIndex.h + fvpPruningSceneIndex.h fvpBBoxSceneIndex.h fvpReprSelectorSceneIndex.h fvpBlockPrimRemovalPropagationSceneIndex.h diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp new file mode 100644 index 000000000..fa6a216db --- /dev/null +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -0,0 +1,76 @@ +// Copyright 2024 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "flowViewport/sceneIndex/fvpPruningSceneIndex.h" + +#include +#include +#include +#include +#include + +#include + +PXR_NAMESPACE_USING_DIRECTIVE + +namespace { + +} // namespace + +namespace FVP_NS_DEF { + +PruningSceneIndexRefPtr PruningSceneIndex::New(const HdSceneIndexBaseRefPtr &inputSceneIndex) +{ + return TfCreateRefPtr(new PruningSceneIndex(inputSceneIndex)); +} + +PruningSceneIndex::PruningSceneIndex(HdSceneIndexBaseRefPtr const &inputSceneIndex) : + HdSingleInputFilteringSceneIndexBase(inputSceneIndex), + InputSceneIndexUtils(inputSceneIndex) +{ +} + +HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const +{ + return GetInputSceneIndex()->GetPrim(primPath); +} + +SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) const +{ + return GetInputSceneIndex()->GetChildPrimPaths(primPath); +} + +void PruningSceneIndex::_PrimsAdded( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) +{ + +} + +void PruningSceneIndex::_PrimsRemoved( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries &entries) +{ + +} + +void PruningSceneIndex::_PrimsDirtied( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) +{ + +} + +} // namespace FVP_NS_DEF diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h new file mode 100644 index 000000000..577ac0e0a --- /dev/null +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -0,0 +1,73 @@ +// Copyright 2024 Autodesk +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#ifndef FVP_PRUNING_SCENE_INDEX_H +#define FVP_PRUNING_SCENE_INDEX_H + +#include "flowViewport/api.h" +#include "flowViewport/sceneIndex/fvpSceneIndexUtils.h" + +#include +#include +#include +#include + +namespace FVP_NS_DEF { + +class PruningSceneIndex; +typedef PXR_NS::TfRefPtr PruningSceneIndexRefPtr; +typedef PXR_NS::TfRefPtr PruningSceneIndexConstRefPtr; + +class PruningSceneIndex : + public PXR_NS::HdSingleInputFilteringSceneIndexBase + , public Fvp::InputSceneIndexUtils +{ +public: + using PXR_NS::HdSingleInputFilteringSceneIndexBase::_GetInputSceneIndex; + + FVP_API + static PruningSceneIndexRefPtr New(const PXR_NS::HdSceneIndexBaseRefPtr &inputScene); + + FVP_API + ~PruningSceneIndex() override = default; + + FVP_API + PXR_NS::HdSceneIndexPrim GetPrim(const PXR_NS::SdfPath& primPath) const override; + + FVP_API + PXR_NS::SdfPathVector GetChildPrimPaths(const PXR_NS::SdfPath& primPath) const override; + +protected: + FVP_API + PruningSceneIndex(PXR_NS::HdSceneIndexBaseRefPtr const &inputSceneIndex); + + FVP_API + void _PrimsAdded( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) override; + + FVP_API + void _PrimsRemoved( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries &entries) override; + + FVP_API + void _PrimsDirtied( + const PXR_NS::HdSceneIndexBase &sender, + const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) override; +}; + +} // namespace FVP_NS_DEF + +#endif // FVP_PRUNING_SCENE_INDEX_H From 3f36ca7175343a0b3696becef9dc2b6c616335f3 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 16:18:02 -0400 Subject: [PATCH 02/40] HYDRA-1098 : Implement enable/disable filter --- .../sceneIndex/fvpPruningSceneIndex.cpp | 58 ++++++++++++++++++- .../sceneIndex/fvpPruningSceneIndex.h | 12 ++++ 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index fa6a216db..b228a3641 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -14,9 +14,13 @@ // #include "flowViewport/sceneIndex/fvpPruningSceneIndex.h" +#include "fvpPruningSceneIndex.h" #include +#include #include +#include +#include #include #include #include @@ -27,6 +31,11 @@ PXR_NAMESPACE_USING_DIRECTIVE namespace { +bool _PrunePrim(const HdSceneIndexPrim& prim, const TfToken& filterToken) +{ + return true; +} + } // namespace namespace FVP_NS_DEF { @@ -52,25 +61,68 @@ SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) cons return GetInputSceneIndex()->GetChildPrimPaths(primPath); } +bool PruningSceneIndex::EnableFilter(const TfToken& filterToken) +{ + if (_prunedPathsByFilter.find(filterToken) != _prunedPathsByFilter.end()) { + // Filter already enabled, no change needed. + return false; + } + + HdSceneIndexObserver::RemovedPrimEntries prunedPrims; + + for (const SdfPath& primPath: HdSceneIndexPrimView(GetInputSceneIndex())) { + if (_PrunePrim(GetInputSceneIndex()->GetPrim(primPath), filterToken)) { + _prunedPathsByFilter[filterToken].emplace(primPath); + prunedPrims.emplace_back(primPath); + } + } + + if (!prunedPrims.empty()) { + _SendPrimsRemoved(prunedPrims); + } + + return true; +} + +bool PruningSceneIndex::DisableFilter(const TfToken& filterToken) +{ + if (_prunedPathsByFilter.find(filterToken) == _prunedPathsByFilter.end()) { + // Filter already disabled, no change needed. + return false; + } + + HdSceneIndexObserver::AddedPrimEntries unprunedPrims; + + for (const auto& primPath : _prunedPathsByFilter[filterToken]) { + unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); + } + + if (!unprunedPrims.empty()) { + _SendPrimsAdded(unprunedPrims); + } + + return true; +} + void PruningSceneIndex::_PrimsAdded( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) { - +// Catch prims to prune } void PruningSceneIndex::_PrimsRemoved( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries &entries) { - +// Remove from map if it was pruned } void PruningSceneIndex::_PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) { - +// Check if prim pruning status should change } } // namespace FVP_NS_DEF diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 577ac0e0a..67994878d 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -18,10 +18,13 @@ #include "flowViewport/api.h" #include "flowViewport/sceneIndex/fvpSceneIndexUtils.h" +#include #include #include #include #include +#include +#include namespace FVP_NS_DEF { @@ -48,6 +51,12 @@ class PruningSceneIndex : FVP_API PXR_NS::SdfPathVector GetChildPrimPaths(const PXR_NS::SdfPath& primPath) const override; + FVP_API + bool EnableFilter(const PXR_NS::TfToken& filterToken); + + FVP_API + bool DisableFilter(const PXR_NS::TfToken& filterToken); + protected: FVP_API PruningSceneIndex(PXR_NS::HdSceneIndexBaseRefPtr const &inputSceneIndex); @@ -66,6 +75,9 @@ class PruningSceneIndex : void _PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) override; + + // Maps a filtering token to the set of prim paths that have been pruned out by this token + std::map _prunedPathsByFilter; }; } // namespace FVP_NS_DEF From dc636e547dbcb0d6059c9b99c5b74a2b8da870a7 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 16:21:12 -0400 Subject: [PATCH 03/40] HYDRA-1098 : Add pruning tokens --- .../sceneIndex/fvpPruningSceneIndex.cpp | 22 ++++++++++++------- .../sceneIndex/fvpPruningSceneIndex.h | 14 ++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index b228a3641..9668c80b9 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -27,11 +27,17 @@ #include +PXR_NAMESPACE_OPEN_SCOPE + +TF_DEFINE_PUBLIC_TOKENS(FvpPruningTokens, FVP_PRUNING_TOKENS); + +PXR_NAMESPACE_CLOSE_SCOPE + PXR_NAMESPACE_USING_DIRECTIVE namespace { -bool _PrunePrim(const HdSceneIndexPrim& prim, const TfToken& filterToken) +bool _PrunePrim(const HdSceneIndexPrim& prim, const TfToken& pruningToken) { return true; } @@ -61,9 +67,9 @@ SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) cons return GetInputSceneIndex()->GetChildPrimPaths(primPath); } -bool PruningSceneIndex::EnableFilter(const TfToken& filterToken) +bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) { - if (_prunedPathsByFilter.find(filterToken) != _prunedPathsByFilter.end()) { + if (_prunedPathsByFilter.find(pruningToken) != _prunedPathsByFilter.end()) { // Filter already enabled, no change needed. return false; } @@ -71,8 +77,8 @@ bool PruningSceneIndex::EnableFilter(const TfToken& filterToken) HdSceneIndexObserver::RemovedPrimEntries prunedPrims; for (const SdfPath& primPath: HdSceneIndexPrimView(GetInputSceneIndex())) { - if (_PrunePrim(GetInputSceneIndex()->GetPrim(primPath), filterToken)) { - _prunedPathsByFilter[filterToken].emplace(primPath); + if (_PrunePrim(GetInputSceneIndex()->GetPrim(primPath), pruningToken)) { + _prunedPathsByFilter[pruningToken].emplace(primPath); prunedPrims.emplace_back(primPath); } } @@ -84,16 +90,16 @@ bool PruningSceneIndex::EnableFilter(const TfToken& filterToken) return true; } -bool PruningSceneIndex::DisableFilter(const TfToken& filterToken) +bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) { - if (_prunedPathsByFilter.find(filterToken) == _prunedPathsByFilter.end()) { + if (_prunedPathsByFilter.find(pruningToken) == _prunedPathsByFilter.end()) { // Filter already disabled, no change needed. return false; } HdSceneIndexObserver::AddedPrimEntries unprunedPrims; - for (const auto& primPath : _prunedPathsByFilter[filterToken]) { + for (const auto& primPath : _prunedPathsByFilter[pruningToken]) { unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); } diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 67994878d..134596cca 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -26,6 +26,20 @@ #include #include +PXR_NAMESPACE_OPEN_SCOPE + +// clang-format off +#define FVP_PRUNING_TOKENS \ + (mesh) \ + (sphere) \ + (cone) \ + (cube) +// clang-format on + +TF_DECLARE_PUBLIC_TOKENS(FvpPruningTokens, FVP_API, FVP_PRUNING_TOKENS); + +PXR_NAMESPACE_CLOSE_SCOPE + namespace FVP_NS_DEF { class PruningSceneIndex; From 325880944960e287929cefb528ab14e42feb3548 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 16:47:07 -0400 Subject: [PATCH 04/40] HYDRA-1098 : Implement notifications handlers --- .../sceneIndex/fvpPruningSceneIndex.cpp | 65 +++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 9668c80b9..328edde60 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -39,7 +40,10 @@ namespace { bool _PrunePrim(const HdSceneIndexPrim& prim, const TfToken& pruningToken) { - return true; + if (pruningToken == FvpPruningTokens->mesh) { + return prim.primType == HdPrimTypeTokens->mesh; + } + return false; } } // namespace @@ -114,21 +118,74 @@ void PruningSceneIndex::_PrimsAdded( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) { -// Catch prims to prune + HdSceneIndexObserver::AddedPrimEntries editedEntries; + for (const auto& addedEntry : entries) { + for (auto& filterEntry : _prunedPathsByFilter) { + if (_PrunePrim(GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { + filterEntry.second.emplace(addedEntry.primPath); + } else { + editedEntries.emplace_back(addedEntry); + } + } + } + if (!editedEntries.empty()) { + _SendPrimsAdded(editedEntries); + } } void PruningSceneIndex::_PrimsRemoved( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries &entries) { -// Remove from map if it was pruned + HdSceneIndexObserver::RemovedPrimEntries editedEntries; + for (const auto& removedEntry : entries) { + for (auto& filterEntry : _prunedPathsByFilter) { + if (filterEntry.second.find(removedEntry.primPath) != filterEntry.second.end()) { + filterEntry.second.erase(removedEntry.primPath); + } else { + editedEntries.emplace_back(removedEntry); + } + } + } + if (!editedEntries.empty()) { + _SendPrimsRemoved(editedEntries); + } } void PruningSceneIndex::_PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) { -// Check if prim pruning status should change + HdSceneIndexObserver::DirtiedPrimEntries editedEntries; + HdSceneIndexObserver::RemovedPrimEntries removedEntries; + HdSceneIndexObserver::AddedPrimEntries addedEntries; + + for (const auto& dirtiedEntry : entries) { + for (const auto& filterEntry : _prunedPathsByFilter) { + HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); + + bool isPruned = filterEntry.second.find(dirtiedEntry.primPath) != filterEntry.second.end(); + bool shouldBePruned = _PrunePrim(dirtiedPrim, filterEntry.first); + + if (!isPruned && shouldBePruned) { + removedEntries.emplace_back(dirtiedEntry.primPath); + } else if (isPruned && !shouldBePruned) { + addedEntries.emplace_back(dirtiedEntry.primPath, dirtiedPrim.primType); + } else { + editedEntries.emplace_back(dirtiedEntry); + } + } + } + + if (!removedEntries.empty()) { + _SendPrimsRemoved(removedEntries); + } + if (!addedEntries.empty()) { + _SendPrimsAdded(addedEntries); + } + if (!editedEntries.empty()) { + _SendPrimsDirtied(editedEntries); + } } } // namespace FVP_NS_DEF From 8fd711d5306e50f054ee855aa12dff70ce507fb3 Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 17:14:36 -0400 Subject: [PATCH 05/40] HYDRA-1098 : Workaround for PathInterface + basic integration --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h | 13 ++++++++++++- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 11 ++++++++++- lib/mayaHydra/mayaPlugin/renderOverride.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 134596cca..2d0cc6549 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -17,7 +17,9 @@ #include "flowViewport/api.h" #include "flowViewport/sceneIndex/fvpSceneIndexUtils.h" +#include "flowViewport/sceneIndex/fvpPathInterface.h" +#include #include #include #include @@ -48,7 +50,8 @@ typedef PXR_NS::TfRefPtr PruningSceneIndexConstRefPtr; class PruningSceneIndex : public PXR_NS::HdSingleInputFilteringSceneIndexBase - , public Fvp::InputSceneIndexUtils + , public InputSceneIndexUtils + , public PathInterface // As a workaround until we move to exclusively using PathMappers { public: using PXR_NS::HdSingleInputFilteringSceneIndexBase::_GetInputSceneIndex; @@ -71,6 +74,14 @@ class PruningSceneIndex : FVP_API bool DisableFilter(const PXR_NS::TfToken& filterToken); + FVP_API + PrimSelections UfePathToPrimSelections(const Ufe::Path& appPath) const override { + PXR_NAMESPACE_USING_DIRECTIVE; + const PathInterface* pathInterface = dynamic_cast(&*GetInputSceneIndex()); + TF_AXIOM(pathInterface); + return pathInterface->UfePathToPrimSelections(appPath); + } + protected: FVP_API PruningSceneIndex(PXR_NS::HdSceneIndexBaseRefPtr const &inputSceneIndex); diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index f04ba1b09..62f72dc7b 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -102,6 +102,7 @@ #include #include #include +#include #include #include #include @@ -802,6 +803,13 @@ MStatus MtohRenderOverride::Render( _displayStyleSceneIndex->SetRefineLevel({true, delegateParams.refineLevel}); } + auto objectExclusions = framecontext->objectTypeExclusions(); + if (objectExclusions & MHWRender::MFrameContext::kExcludeMeshes) { + _pruningSceneIndex->EnableFilter(FvpPruningTokens->mesh); + } else { + _pruningSceneIndex->DisableFilter(FvpPruningTokens->mesh); + } + // Toggle textures in the material network const unsigned int currentDisplayMode = drawContext.getDisplayStyle(); bool isTextured = currentDisplayMode & MHWRender::MFrameContext::kTextured; @@ -1088,8 +1096,9 @@ void MtohRenderOverride::_InitHydraResources(const MHWRender::MDrawContext& draw //Put BlockPrimRemovalPropagationSceneIndex first as it can block/unblock the prim removal propagation on the whole scene indices chain _blockPrimRemovalPropagationSceneIndex = Fvp::BlockPrimRemovalPropagationSceneIndex::New(_inputSceneIndexOfFilteringSceneIndicesChain); + _pruningSceneIndex = Fvp::PruningSceneIndex::New(_blockPrimRemovalPropagationSceneIndex); _selection = std::make_shared(); - _selectionSceneIndex = Fvp::SelectionSceneIndex::New(_blockPrimRemovalPropagationSceneIndex, _selection); + _selectionSceneIndex = Fvp::SelectionSceneIndex::New(_pruningSceneIndex, _selection); _selectionSceneIndex->SetDisplayName("Flow Viewport Selection Scene Index"); _inputSceneIndexOfFilteringSceneIndicesChain = _selectionSceneIndex; diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.h b/lib/mayaHydra/mayaPlugin/renderOverride.h index a04d4b6c0..41cf634c1 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.h +++ b/lib/mayaHydra/mayaPlugin/renderOverride.h @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -280,6 +281,7 @@ class MtohRenderOverride : public MHWRender::MRenderOverride, Fvp::SelectionPtr _selection; Fvp::WireframeSelectionHighlightSceneIndexRefPtr _wireframeSelectionHighlightSceneIndex; Fvp::BlockPrimRemovalPropagationSceneIndexRefPtr _blockPrimRemovalPropagationSceneIndex; + Fvp::PruningSceneIndexRefPtr _pruningSceneIndex; Fvp::LightsManagementSceneIndexRefPtr _lightsManagementSceneIndex; // Naming this identifier _ufeSelection clashes with UFE's selection.h From 580eda8882988b5c91298a4545e4501461f1f3dd Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 17:20:59 -0400 Subject: [PATCH 06/40] HYDRA-1098 : Implement GetPrim and GetChildPrimPaths --- .../sceneIndex/fvpPruningSceneIndex.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 328edde60..026656a32 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -63,12 +64,31 @@ PruningSceneIndex::PruningSceneIndex(HdSceneIndexBaseRefPtr const &inputSceneInd HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const { + for (const auto& filterEntry : _prunedPathsByFilter) { + if (filterEntry.second.find(primPath) != filterEntry.second.end()) { + return {}; + } + } return GetInputSceneIndex()->GetPrim(primPath); } SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) const { - return GetInputSceneIndex()->GetChildPrimPaths(primPath); + SdfPathVector baseChildPaths = GetInputSceneIndex()->GetChildPrimPaths(primPath); + SdfPathVector editedChildPaths; + for (const auto& baseChildPath : baseChildPaths) { + bool isPruned = false; + for (const auto& filterEntry : _prunedPathsByFilter) { + if (filterEntry.second.find(baseChildPath) != filterEntry.second.end()) { + isPruned = true; + break; + } + } + if (!isPruned) { + editedChildPaths.emplace_back(baseChildPath); + } + } + return editedChildPaths; } bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) From c68aa74346b74dd6e4781497320277a14139a88f Mon Sep 17 00:00:00 2001 From: debloip Date: Thu, 10 Oct 2024 17:28:49 -0400 Subject: [PATCH 07/40] HYDRA-1098 : Update filter map on enable/disable --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 026656a32..a40e115f9 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -98,6 +98,8 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) return false; } + _prunedPathsByFilter[pruningToken] = SdfPathSet(); + HdSceneIndexObserver::RemovedPrimEntries prunedPrims; for (const SdfPath& primPath: HdSceneIndexPrimView(GetInputSceneIndex())) { @@ -127,6 +129,8 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); } + _prunedPathsByFilter.erase(pruningToken); + if (!unprunedPrims.empty()) { _SendPrimsAdded(unprunedPrims); } From 30387f1728433abd79cb4fccece315fe7dd9984a Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 11:34:20 -0400 Subject: [PATCH 08/40] HYDRA-108 : Exclude scene roots --- .../sceneIndex/fvpPruningSceneIndex.cpp | 39 ++++++++++++++----- .../sceneIndex/fvpPruningSceneIndex.h | 12 ++++++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index a40e115f9..63640a093 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -39,14 +39,6 @@ PXR_NAMESPACE_USING_DIRECTIVE namespace { -bool _PrunePrim(const HdSceneIndexPrim& prim, const TfToken& pruningToken) -{ - if (pruningToken == FvpPruningTokens->mesh) { - return prim.primType == HdPrimTypeTokens->mesh; - } - return false; -} - } // namespace namespace FVP_NS_DEF { @@ -62,6 +54,32 @@ PruningSceneIndex::PruningSceneIndex(HdSceneIndexBaseRefPtr const &inputSceneInd { } +void PruningSceneIndex::AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot) +{ + _excludedSceneRoots.emplace(sceneRoot); +} + +bool PruningSceneIndex::_IsExcluded(const PXR_NS::SdfPath& primPath) const +{ + for (const auto& excludedSceneRoot : _excludedSceneRoots) { + if (primPath.HasPrefix(excludedSceneRoot)) { + return true; + } + } + return false; +} + +bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPrim& prim, const TfToken& pruningToken) const +{ + if (_IsExcluded(primPath)) { + return false; + } + if (pruningToken == FvpPruningTokens->mesh) { + return prim.primType == HdPrimTypeTokens->mesh; + } + return false; +} + HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const { for (const auto& filterEntry : _prunedPathsByFilter) { @@ -102,7 +120,7 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) HdSceneIndexObserver::RemovedPrimEntries prunedPrims; - for (const SdfPath& primPath: HdSceneIndexPrimView(GetInputSceneIndex())) { + for (const SdfPath& primPath : HdSceneIndexPrimView(GetInputSceneIndex())) { if (_PrunePrim(GetInputSceneIndex()->GetPrim(primPath), pruningToken)) { _prunedPathsByFilter[pruningToken].emplace(primPath); prunedPrims.emplace_back(primPath); @@ -144,6 +162,7 @@ void PruningSceneIndex::_PrimsAdded( { HdSceneIndexObserver::AddedPrimEntries editedEntries; for (const auto& addedEntry : entries) { + // We're executing the full loop for each filter, so too many notification sent for (auto& filterEntry : _prunedPathsByFilter) { if (_PrunePrim(GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { filterEntry.second.emplace(addedEntry.primPath); @@ -163,6 +182,7 @@ void PruningSceneIndex::_PrimsRemoved( { HdSceneIndexObserver::RemovedPrimEntries editedEntries; for (const auto& removedEntry : entries) { + // We're executing the full loop for each filter, so too many notification sent for (auto& filterEntry : _prunedPathsByFilter) { if (filterEntry.second.find(removedEntry.primPath) != filterEntry.second.end()) { filterEntry.second.erase(removedEntry.primPath); @@ -185,6 +205,7 @@ void PruningSceneIndex::_PrimsDirtied( HdSceneIndexObserver::AddedPrimEntries addedEntries; for (const auto& dirtiedEntry : entries) { + // We're executing the full loop for each filter, so too many notification sent for (const auto& filterEntry : _prunedPathsByFilter) { HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 2d0cc6549..92da72f48 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -25,6 +25,7 @@ #include #include #include + #include #include @@ -74,6 +75,9 @@ class PruningSceneIndex : FVP_API bool DisableFilter(const PXR_NS::TfToken& filterToken); + FVP_API + void AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot); + FVP_API PrimSelections UfePathToPrimSelections(const Ufe::Path& appPath) const override { PXR_NAMESPACE_USING_DIRECTIVE; @@ -101,8 +105,16 @@ class PruningSceneIndex : const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) override; + FVP_API + bool _IsExcluded(const PXR_NS::SdfPath& primPath) const; + + FVP_API + bool _PrunePrim(const PXR_NS::SdfPath& primPath, const PXR_NS::HdSceneIndexPrim& prim, const PXR_NS::TfToken& pruningToken) const; + // Maps a filtering token to the set of prim paths that have been pruned out by this token std::map _prunedPathsByFilter; + + std::set _excludedSceneRoots; }; } // namespace FVP_NS_DEF From ae0e6ae43cd9cbbb8f4c3620010e3430a095d33a Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 12:06:03 -0400 Subject: [PATCH 09/40] HYDRA-1098 : Add ancestor check --- .../sceneIndex/fvpPruningSceneIndex.cpp | 57 ++++++++++++------- .../sceneIndex/fvpPruningSceneIndex.h | 4 ++ 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 63640a093..72048e45c 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -61,6 +61,7 @@ void PruningSceneIndex::AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot) bool PruningSceneIndex::_IsExcluded(const PXR_NS::SdfPath& primPath) const { + // TODO : Use parent-based approach for (const auto& excludedSceneRoot : _excludedSceneRoots) { if (primPath.HasPrefix(excludedSceneRoot)) { return true; @@ -80,13 +81,24 @@ bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPr return false; } -HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const +bool PruningSceneIndex::_IsAncestorPrunedInclusive(const SdfPath& primPath) const { - for (const auto& filterEntry : _prunedPathsByFilter) { - if (filterEntry.second.find(primPath) != filterEntry.second.end()) { - return {}; + SdfPath currPath = primPath; + while (!currPath.IsAbsoluteRootPath()) { + if (_filtersByPrunedPath.find(currPath) != _filtersByPrunedPath.end()) { + return true; + } else { + currPath = currPath.GetParentPath(); } } + return false; +} + +HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const +{ + if (_filtersByPrunedPath.find(primPath) != _filtersByPrunedPath.end()) { + return {}; + } return GetInputSceneIndex()->GetPrim(primPath); } @@ -95,14 +107,7 @@ SdfPathVector PruningSceneIndex::GetChildPrimPaths(const SdfPath& primPath) cons SdfPathVector baseChildPaths = GetInputSceneIndex()->GetChildPrimPaths(primPath); SdfPathVector editedChildPaths; for (const auto& baseChildPath : baseChildPaths) { - bool isPruned = false; - for (const auto& filterEntry : _prunedPathsByFilter) { - if (filterEntry.second.find(baseChildPath) != filterEntry.second.end()) { - isPruned = true; - break; - } - } - if (!isPruned) { + if (_filtersByPrunedPath.find(baseChildPath) == _filtersByPrunedPath.end()) { editedChildPaths.emplace_back(baseChildPath); } } @@ -116,14 +121,16 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) return false; } - _prunedPathsByFilter[pruningToken] = SdfPathSet(); - HdSceneIndexObserver::RemovedPrimEntries prunedPrims; for (const SdfPath& primPath : HdSceneIndexPrimView(GetInputSceneIndex())) { - if (_PrunePrim(GetInputSceneIndex()->GetPrim(primPath), pruningToken)) { + if (_PrunePrim(primPath, GetInputSceneIndex()->GetPrim(primPath), pruningToken)) { + if (!_IsAncestorPrunedInclusive(primPath)) { + // Only send notification if it was not already pruned out, directly or indirectly + prunedPrims.emplace_back(primPath); + } _prunedPathsByFilter[pruningToken].emplace(primPath); - prunedPrims.emplace_back(primPath); + _filtersByPrunedPath[primPath].emplace(pruningToken); } } @@ -141,13 +148,23 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) return false; } - HdSceneIndexObserver::AddedPrimEntries unprunedPrims; + SdfPathSet prunedPaths = _prunedPathsByFilter[pruningToken]; - for (const auto& primPath : _prunedPathsByFilter[pruningToken]) { - unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); + _prunedPathsByFilter.erase(pruningToken); + for (const auto& primPath : prunedPaths) { + _filtersByPrunedPath[primPath].erase(pruningToken); + if (_filtersByPrunedPath[primPath].empty()) { + _filtersByPrunedPath.erase(primPath); + } } - _prunedPathsByFilter.erase(pruningToken); + HdSceneIndexObserver::AddedPrimEntries unprunedPrims; + for (const auto& primPath : prunedPaths) { + // If it's still pruned, avoid sending a notification + if (!_IsAncestorPrunedInclusive(primPath)) { + unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); + } + } if (!unprunedPrims.empty()) { _SendPrimsAdded(unprunedPrims); diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 92da72f48..f41efaf04 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -111,8 +111,12 @@ class PruningSceneIndex : FVP_API bool _PrunePrim(const PXR_NS::SdfPath& primPath, const PXR_NS::HdSceneIndexPrim& prim, const PXR_NS::TfToken& pruningToken) const; + FVP_API + bool _IsAncestorPrunedInclusive(const PXR_NS::SdfPath& primPath) const; + // Maps a filtering token to the set of prim paths that have been pruned out by this token std::map _prunedPathsByFilter; + std::map> _filtersByPrunedPath; std::set _excludedSceneRoots; }; From b157daea76f0c45cadb9490cfb961c97392cdb46 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 12:27:53 -0400 Subject: [PATCH 10/40] HYDRA-1098 : Handle all the different cases (hopefully) --- .../sceneIndex/fvpPruningSceneIndex.cpp | 54 ++++++++++++------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 72048e45c..572afe156 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -84,7 +84,7 @@ bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPr bool PruningSceneIndex::_IsAncestorPrunedInclusive(const SdfPath& primPath) const { SdfPath currPath = primPath; - while (!currPath.IsAbsoluteRootPath()) { + while (!currPath.IsEmpty() && !currPath.IsAbsoluteRootPath()) { if (_filtersByPrunedPath.find(currPath) != _filtersByPrunedPath.end()) { return true; } else { @@ -179,14 +179,15 @@ void PruningSceneIndex::_PrimsAdded( { HdSceneIndexObserver::AddedPrimEntries editedEntries; for (const auto& addedEntry : entries) { - // We're executing the full loop for each filter, so too many notification sent for (auto& filterEntry : _prunedPathsByFilter) { - if (_PrunePrim(GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { + if (_PrunePrim(addedEntry.primPath, GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { filterEntry.second.emplace(addedEntry.primPath); - } else { - editedEntries.emplace_back(addedEntry); + _filtersByPrunedPath[addedEntry.primPath].emplace(filterEntry.first); } } + if (!_IsAncestorPrunedInclusive(addedEntry.primPath)) { + editedEntries.emplace_back(addedEntry); + } } if (!editedEntries.empty()) { _SendPrimsAdded(editedEntries); @@ -199,14 +200,15 @@ void PruningSceneIndex::_PrimsRemoved( { HdSceneIndexObserver::RemovedPrimEntries editedEntries; for (const auto& removedEntry : entries) { - // We're executing the full loop for each filter, so too many notification sent for (auto& filterEntry : _prunedPathsByFilter) { if (filterEntry.second.find(removedEntry.primPath) != filterEntry.second.end()) { filterEntry.second.erase(removedEntry.primPath); - } else { - editedEntries.emplace_back(removedEntry); } } + _filtersByPrunedPath.erase(removedEntry.primPath); + if (!_IsAncestorPrunedInclusive(removedEntry.primPath)) { + editedEntries.emplace_back(removedEntry); + } } if (!editedEntries.empty()) { _SendPrimsRemoved(editedEntries); @@ -222,20 +224,34 @@ void PruningSceneIndex::_PrimsDirtied( HdSceneIndexObserver::AddedPrimEntries addedEntries; for (const auto& dirtiedEntry : entries) { - // We're executing the full loop for each filter, so too many notification sent - for (const auto& filterEntry : _prunedPathsByFilter) { - HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); - - bool isPruned = filterEntry.second.find(dirtiedEntry.primPath) != filterEntry.second.end(); - bool shouldBePruned = _PrunePrim(dirtiedPrim, filterEntry.first); + bool wasInitiallyPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); + HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); + for (auto& filterEntry : _prunedPathsByFilter) { + bool shouldBePruned = _PrunePrim(dirtiedEntry.primPath, dirtiedPrim, filterEntry.first); - if (!isPruned && shouldBePruned) { - removedEntries.emplace_back(dirtiedEntry.primPath); - } else if (isPruned && !shouldBePruned) { - addedEntries.emplace_back(dirtiedEntry.primPath, dirtiedPrim.primType); + if (shouldBePruned) { + filterEntry.second.emplace(dirtiedEntry.primPath); + _filtersByPrunedPath[dirtiedEntry.primPath].emplace(filterEntry.first); } else { - editedEntries.emplace_back(dirtiedEntry); + if (filterEntry.second.find(dirtiedEntry.primPath) != filterEntry.second.end()) { + filterEntry.second.erase(dirtiedEntry.primPath); + } + if (_filtersByPrunedPath.find(dirtiedEntry.primPath) != _filtersByPrunedPath.end()) { + _filtersByPrunedPath[dirtiedEntry.primPath].erase(filterEntry.first); + if (_filtersByPrunedPath[dirtiedEntry.primPath].empty()) { + _filtersByPrunedPath.erase(dirtiedEntry.primPath); + } + } } + + } + bool isNowPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); + if (!wasInitiallyPruned && isNowPruned) { + removedEntries.emplace_back(dirtiedEntry.primPath); + } else if (wasInitiallyPruned && !isNowPruned) { + addedEntries.emplace_back(dirtiedEntry.primPath, dirtiedPrim.primType); + } else { + editedEntries.emplace_back(dirtiedEntry); } } From 0a29f77d8cd37a2f342f7995cea715ebc44f8a9c Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 12:33:15 -0400 Subject: [PATCH 11/40] HYDRA-1098 : Refactor common code --- .../sceneIndex/fvpPruningSceneIndex.cpp | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 572afe156..84dc08227 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -39,6 +39,19 @@ PXR_NAMESPACE_USING_DIRECTIVE namespace { +template +bool _HasAncestorInclusiveInContainer(const SdfPath& path, const Container& pathsContainer) { + SdfPath currPath = path; + while (!currPath.IsEmpty() && !currPath.IsAbsoluteRootPath()) { + if (pathsContainer.find(currPath) != pathsContainer.end()) { + return true; + } else { + currPath = currPath.GetParentPath(); + } + } + return false; +} + } // namespace namespace FVP_NS_DEF { @@ -61,13 +74,7 @@ void PruningSceneIndex::AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot) bool PruningSceneIndex::_IsExcluded(const PXR_NS::SdfPath& primPath) const { - // TODO : Use parent-based approach - for (const auto& excludedSceneRoot : _excludedSceneRoots) { - if (primPath.HasPrefix(excludedSceneRoot)) { - return true; - } - } - return false; + return _HasAncestorInclusiveInContainer(primPath, _excludedSceneRoots); } bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPrim& prim, const TfToken& pruningToken) const @@ -83,15 +90,7 @@ bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPr bool PruningSceneIndex::_IsAncestorPrunedInclusive(const SdfPath& primPath) const { - SdfPath currPath = primPath; - while (!currPath.IsEmpty() && !currPath.IsAbsoluteRootPath()) { - if (_filtersByPrunedPath.find(currPath) != _filtersByPrunedPath.end()) { - return true; - } else { - currPath = currPath.GetParentPath(); - } - } - return false; + return _HasAncestorInclusiveInContainer(primPath, _filtersByPrunedPath); } HdSceneIndexPrim PruningSceneIndex::GetPrim(const SdfPath& primPath) const From e05f9dfc9bfac3026e3f80e63f80eaf7367d7334 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 12:56:46 -0400 Subject: [PATCH 12/40] HYDRA-1098 : Refactor common code --- .../sceneIndex/fvpPruningSceneIndex.cpp | 48 ++++++++++--------- .../sceneIndex/fvpPruningSceneIndex.h | 10 +++- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 84dc08227..4cccb528d 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -172,6 +172,26 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) return true; } +void PruningSceneIndex::_InsertEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken) +{ + _prunedPathsByFilter[pruningToken].emplace(primPath); + _filtersByPrunedPath[primPath].emplace(pruningToken); +} + +void PruningSceneIndex::_RemoveEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken) +{ + if (_prunedPathsByFilter.find(pruningToken) != _prunedPathsByFilter.end()) { + _prunedPathsByFilter[pruningToken].erase(primPath); + } + + if (_filtersByPrunedPath.find(primPath) != _filtersByPrunedPath.end()) { + _filtersByPrunedPath[primPath].erase(pruningToken); + if (_filtersByPrunedPath[primPath].empty()) { + _filtersByPrunedPath.erase(primPath); + } + } +} + void PruningSceneIndex::_PrimsAdded( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) @@ -180,8 +200,7 @@ void PruningSceneIndex::_PrimsAdded( for (const auto& addedEntry : entries) { for (auto& filterEntry : _prunedPathsByFilter) { if (_PrunePrim(addedEntry.primPath, GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { - filterEntry.second.emplace(addedEntry.primPath); - _filtersByPrunedPath[addedEntry.primPath].emplace(filterEntry.first); + _InsertEntry(addedEntry.primPath, filterEntry.first); } } if (!_IsAncestorPrunedInclusive(addedEntry.primPath)) { @@ -200,11 +219,8 @@ void PruningSceneIndex::_PrimsRemoved( HdSceneIndexObserver::RemovedPrimEntries editedEntries; for (const auto& removedEntry : entries) { for (auto& filterEntry : _prunedPathsByFilter) { - if (filterEntry.second.find(removedEntry.primPath) != filterEntry.second.end()) { - filterEntry.second.erase(removedEntry.primPath); - } + _RemoveEntry(removedEntry.primPath, filterEntry.first); } - _filtersByPrunedPath.erase(removedEntry.primPath); if (!_IsAncestorPrunedInclusive(removedEntry.primPath)) { editedEntries.emplace_back(removedEntry); } @@ -218,31 +234,19 @@ void PruningSceneIndex::_PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) { - HdSceneIndexObserver::DirtiedPrimEntries editedEntries; HdSceneIndexObserver::RemovedPrimEntries removedEntries; HdSceneIndexObserver::AddedPrimEntries addedEntries; + HdSceneIndexObserver::DirtiedPrimEntries editedEntries; for (const auto& dirtiedEntry : entries) { bool wasInitiallyPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); for (auto& filterEntry : _prunedPathsByFilter) { - bool shouldBePruned = _PrunePrim(dirtiedEntry.primPath, dirtiedPrim, filterEntry.first); - - if (shouldBePruned) { - filterEntry.second.emplace(dirtiedEntry.primPath); - _filtersByPrunedPath[dirtiedEntry.primPath].emplace(filterEntry.first); + if (_PrunePrim(dirtiedEntry.primPath, dirtiedPrim, filterEntry.first)) { + _InsertEntry(dirtiedEntry.primPath, filterEntry.first); } else { - if (filterEntry.second.find(dirtiedEntry.primPath) != filterEntry.second.end()) { - filterEntry.second.erase(dirtiedEntry.primPath); - } - if (_filtersByPrunedPath.find(dirtiedEntry.primPath) != _filtersByPrunedPath.end()) { - _filtersByPrunedPath[dirtiedEntry.primPath].erase(filterEntry.first); - if (_filtersByPrunedPath[dirtiedEntry.primPath].empty()) { - _filtersByPrunedPath.erase(dirtiedEntry.primPath); - } - } + _RemoveEntry(dirtiedEntry.primPath, filterEntry.first); } - } bool isNowPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); if (!wasInitiallyPruned && isNowPruned) { diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index f41efaf04..2c7f1bf69 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -70,10 +70,10 @@ class PruningSceneIndex : PXR_NS::SdfPathVector GetChildPrimPaths(const PXR_NS::SdfPath& primPath) const override; FVP_API - bool EnableFilter(const PXR_NS::TfToken& filterToken); + bool EnableFilter(const PXR_NS::TfToken& pruningToken); FVP_API - bool DisableFilter(const PXR_NS::TfToken& filterToken); + bool DisableFilter(const PXR_NS::TfToken& pruningToken); FVP_API void AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot); @@ -104,6 +104,12 @@ class PruningSceneIndex : void _PrimsDirtied( const PXR_NS::HdSceneIndexBase &sender, const PXR_NS::HdSceneIndexObserver::DirtiedPrimEntries &entries) override; + + FVP_API + void _InsertEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken); + + FVP_API + void _RemoveEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken); FVP_API bool _IsExcluded(const PXR_NS::SdfPath& primPath) const; From 4b543d20417e589bf2fa9e25ebd52365e52ff411 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:01:15 -0400 Subject: [PATCH 13/40] HYDRA-1098 : Provide accessor for active filters --- .../sceneIndex/fvpPruningSceneIndex.cpp | 27 ++++++++++++------- .../sceneIndex/fvpPruningSceneIndex.h | 3 +++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 4cccb528d..9154666da 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -172,6 +172,15 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) return true; } +std::set PruningSceneIndex::GetActiveFilters() +{ + std::set pruningTokens; + for (const auto& filterEntry : _prunedPathsByFilter) { + pruningTokens.emplace(filterEntry.first); + } + return pruningTokens; +} + void PruningSceneIndex::_InsertEntry(const PXR_NS::SdfPath& primPath, const PXR_NS::TfToken& pruningToken) { _prunedPathsByFilter[pruningToken].emplace(primPath); @@ -198,9 +207,9 @@ void PruningSceneIndex::_PrimsAdded( { HdSceneIndexObserver::AddedPrimEntries editedEntries; for (const auto& addedEntry : entries) { - for (auto& filterEntry : _prunedPathsByFilter) { - if (_PrunePrim(addedEntry.primPath, GetInputSceneIndex()->GetPrim(addedEntry.primPath), filterEntry.first)) { - _InsertEntry(addedEntry.primPath, filterEntry.first); + for (const auto& pruningToken : GetActiveFilters()) { + if (_PrunePrim(addedEntry.primPath, GetInputSceneIndex()->GetPrim(addedEntry.primPath), pruningToken)) { + _InsertEntry(addedEntry.primPath, pruningToken); } } if (!_IsAncestorPrunedInclusive(addedEntry.primPath)) { @@ -218,8 +227,8 @@ void PruningSceneIndex::_PrimsRemoved( { HdSceneIndexObserver::RemovedPrimEntries editedEntries; for (const auto& removedEntry : entries) { - for (auto& filterEntry : _prunedPathsByFilter) { - _RemoveEntry(removedEntry.primPath, filterEntry.first); + for (const auto& pruningToken : GetActiveFilters()) { + _RemoveEntry(removedEntry.primPath, pruningToken); } if (!_IsAncestorPrunedInclusive(removedEntry.primPath)) { editedEntries.emplace_back(removedEntry); @@ -241,11 +250,11 @@ void PruningSceneIndex::_PrimsDirtied( for (const auto& dirtiedEntry : entries) { bool wasInitiallyPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); - for (auto& filterEntry : _prunedPathsByFilter) { - if (_PrunePrim(dirtiedEntry.primPath, dirtiedPrim, filterEntry.first)) { - _InsertEntry(dirtiedEntry.primPath, filterEntry.first); + for (const auto& pruningToken : GetActiveFilters()) { + if (_PrunePrim(dirtiedEntry.primPath, dirtiedPrim, pruningToken)) { + _InsertEntry(dirtiedEntry.primPath, pruningToken); } else { - _RemoveEntry(dirtiedEntry.primPath, filterEntry.first); + _RemoveEntry(dirtiedEntry.primPath, pruningToken); } } bool isNowPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 2c7f1bf69..417bd88ce 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -75,6 +75,9 @@ class PruningSceneIndex : FVP_API bool DisableFilter(const PXR_NS::TfToken& pruningToken); + FVP_API + std::set GetActiveFilters(); + FVP_API void AddExcludedSceneRoot(const PXR_NS::SdfPath& sceneRoot); From 34e68cd990837e729433b54b0898602ec4b2e262 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:01:51 -0400 Subject: [PATCH 14/40] HYDRA-1098 : Adjust comment --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 417bd88ce..29b4fe71f 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -123,7 +123,7 @@ class PruningSceneIndex : FVP_API bool _IsAncestorPrunedInclusive(const PXR_NS::SdfPath& primPath) const; - // Maps a filtering token to the set of prim paths that have been pruned out by this token + // Maps a pruning token to the set of prim paths that have been pruned out by this token std::map _prunedPathsByFilter; std::map> _filtersByPrunedPath; From aa23f843a219152a106e3866cafcac5b49f88555 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:05:52 -0400 Subject: [PATCH 15/40] HYDRA-1098 : Legibility improvements --- .../sceneIndex/fvpPruningSceneIndex.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 9154666da..b8887f34d 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -206,16 +206,19 @@ void PruningSceneIndex::_PrimsAdded( const PXR_NS::HdSceneIndexObserver::AddedPrimEntries &entries) { HdSceneIndexObserver::AddedPrimEntries editedEntries; + for (const auto& addedEntry : entries) { for (const auto& pruningToken : GetActiveFilters()) { if (_PrunePrim(addedEntry.primPath, GetInputSceneIndex()->GetPrim(addedEntry.primPath), pruningToken)) { _InsertEntry(addedEntry.primPath, pruningToken); } } + if (!_IsAncestorPrunedInclusive(addedEntry.primPath)) { editedEntries.emplace_back(addedEntry); } } + if (!editedEntries.empty()) { _SendPrimsAdded(editedEntries); } @@ -226,14 +229,17 @@ void PruningSceneIndex::_PrimsRemoved( const PXR_NS::HdSceneIndexObserver::RemovedPrimEntries &entries) { HdSceneIndexObserver::RemovedPrimEntries editedEntries; + for (const auto& removedEntry : entries) { - for (const auto& pruningToken : GetActiveFilters()) { - _RemoveEntry(removedEntry.primPath, pruningToken); - } if (!_IsAncestorPrunedInclusive(removedEntry.primPath)) { editedEntries.emplace_back(removedEntry); + } else { + for (const auto& pruningToken : GetActiveFilters()) { + _RemoveEntry(removedEntry.primPath, pruningToken); + } } } + if (!editedEntries.empty()) { _SendPrimsRemoved(editedEntries); } @@ -249,7 +255,9 @@ void PruningSceneIndex::_PrimsDirtied( for (const auto& dirtiedEntry : entries) { bool wasInitiallyPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); + HdSceneIndexPrim dirtiedPrim = GetInputSceneIndex()->GetPrim(dirtiedEntry.primPath); + for (const auto& pruningToken : GetActiveFilters()) { if (_PrunePrim(dirtiedEntry.primPath, dirtiedPrim, pruningToken)) { _InsertEntry(dirtiedEntry.primPath, pruningToken); @@ -257,7 +265,9 @@ void PruningSceneIndex::_PrimsDirtied( _RemoveEntry(dirtiedEntry.primPath, pruningToken); } } + bool isNowPruned = _IsAncestorPrunedInclusive(dirtiedEntry.primPath); + if (!wasInitiallyPruned && isNowPruned) { removedEntries.emplace_back(dirtiedEntry.primPath); } else if (wasInitiallyPruned && !isNowPruned) { From d313b1b91cd29cdb480c39da378a711988f3c96f Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:15:05 -0400 Subject: [PATCH 16/40] HYDRA-1098 : Minor touchups for consistency --- .../sceneIndex/fvpPruningSceneIndex.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index b8887f34d..b66d45aee 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -120,6 +120,9 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) return false; } + // Enable the filter + _prunedPathsByFilter[pruningToken] = SdfPathSet(); + HdSceneIndexObserver::RemovedPrimEntries prunedPrims; for (const SdfPath& primPath : HdSceneIndexPrimView(GetInputSceneIndex())) { @@ -128,8 +131,7 @@ bool PruningSceneIndex::EnableFilter(const TfToken& pruningToken) // Only send notification if it was not already pruned out, directly or indirectly prunedPrims.emplace_back(primPath); } - _prunedPathsByFilter[pruningToken].emplace(primPath); - _filtersByPrunedPath[primPath].emplace(pruningToken); + _InsertEntry(primPath, pruningToken); } } @@ -147,24 +149,20 @@ bool PruningSceneIndex::DisableFilter(const TfToken& pruningToken) return false; } - SdfPathSet prunedPaths = _prunedPathsByFilter[pruningToken]; - - _prunedPathsByFilter.erase(pruningToken); - for (const auto& primPath : prunedPaths) { - _filtersByPrunedPath[primPath].erase(pruningToken); - if (_filtersByPrunedPath[primPath].empty()) { - _filtersByPrunedPath.erase(primPath); - } - } - HdSceneIndexObserver::AddedPrimEntries unprunedPrims; + + SdfPathSet prunedPaths = _prunedPathsByFilter[pruningToken]; for (const auto& primPath : prunedPaths) { - // If it's still pruned, avoid sending a notification + _RemoveEntry(primPath, pruningToken); if (!_IsAncestorPrunedInclusive(primPath)) { + // Only send notification if it was pruned and no longer is unprunedPrims.emplace_back(primPath, GetInputSceneIndex()->GetPrim(primPath).primType); } } + // Disable the filter + _prunedPathsByFilter.erase(pruningToken); + if (!unprunedPrims.empty()) { _SendPrimsAdded(unprunedPrims); } From 88c4bbc5a8f51224d6c15a759c06e56a9c1eaf6d Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:18:56 -0400 Subject: [PATCH 17/40] HYDRA-1098 : Add filtering tokens --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 29b4fe71f..8e114da69 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -33,10 +33,16 @@ PXR_NAMESPACE_OPEN_SCOPE // clang-format off #define FVP_PRUNING_TOKENS \ - (mesh) \ - (sphere) \ - (cone) \ - (cube) + (meshes) \ + (capsules) \ + (cones) \ + (cubes) \ + (cylinders) \ + (spheres) \ + (nurbsPatches) \ + (nurbsCurves) \ + (lightGizmos) \ + (cameraGizmos) // clang-format on TF_DECLARE_PUBLIC_TOKENS(FvpPruningTokens, FVP_API, FVP_PRUNING_TOKENS); From cb21f9ad001d9511e94b766c066adcb194ec25d5 Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:19:25 -0400 Subject: [PATCH 18/40] HYDRA-1098 : Remove unimplementable tokens for now --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 8e114da69..5d59759e2 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -41,8 +41,6 @@ PXR_NAMESPACE_OPEN_SCOPE (spheres) \ (nurbsPatches) \ (nurbsCurves) \ - (lightGizmos) \ - (cameraGizmos) // clang-format on TF_DECLARE_PUBLIC_TOKENS(FvpPruningTokens, FVP_API, FVP_PRUNING_TOKENS); From 239e0feb3a016a4e9cc58674baf23f298275a1cf Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:30:33 -0400 Subject: [PATCH 19/40] HYDRA-1098 : Implement various filter handlers --- .../sceneIndex/fvpPruningSceneIndex.cpp | 57 +++++++++++++++++-- .../sceneIndex/fvpPruningSceneIndex.h | 2 +- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index b66d45aee..87fcf5452 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -27,6 +27,7 @@ #include #include +#include #include PXR_NAMESPACE_OPEN_SCOPE @@ -52,6 +53,46 @@ bool _HasAncestorInclusiveInContainer(const SdfPath& path, const Container& path return false; } +bool _MeshesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->mesh; +} + +bool _CapsulesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->capsule; +} + +bool _ConesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->cone; +} + +bool _CubesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->cube; +} + +bool _CylindersFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->cylinder; +} + +bool _SpheresFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->sphere; +} + +bool _NurbsCurvesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->nurbsCurves; +} + +bool _NurbsPatchesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) +{ + return prim.primType == HdPrimTypeTokens->nurbsPatch; +} + } // namespace namespace FVP_NS_DEF { @@ -82,10 +123,18 @@ bool PruningSceneIndex::_PrunePrim(const SdfPath& primPath, const HdSceneIndexPr if (_IsExcluded(primPath)) { return false; } - if (pruningToken == FvpPruningTokens->mesh) { - return prim.primType == HdPrimTypeTokens->mesh; - } - return false; + using FilterHandler = std::function; + static std::map filterHandlers = { + { FvpPruningTokens->meshes, _MeshesFilterHandler }, + { FvpPruningTokens->capsules, _CapsulesFilterHandler }, + { FvpPruningTokens->cones, _ConesFilterHandler }, + { FvpPruningTokens->cubes, _CubesFilterHandler }, + { FvpPruningTokens->cylinders, _CylindersFilterHandler }, + { FvpPruningTokens->spheres, _SpheresFilterHandler }, + { FvpPruningTokens->nurbsCurves, _NurbsCurvesFilterHandler }, + { FvpPruningTokens->nurbsPatches, _NurbsPatchesFilterHandler } + }; + return filterHandlers[pruningToken](GetInputSceneIndex(), primPath, prim); } bool PruningSceneIndex::_IsAncestorPrunedInclusive(const SdfPath& primPath) const diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h index 5d59759e2..a534d0882 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.h @@ -39,8 +39,8 @@ PXR_NAMESPACE_OPEN_SCOPE (cubes) \ (cylinders) \ (spheres) \ - (nurbsPatches) \ (nurbsCurves) \ + (nurbsPatches) \ // clang-format on TF_DECLARE_PUBLIC_TOKENS(FvpPruningTokens, FVP_API, FVP_PRUNING_TOKENS); From d9b3a65bcef84044c368461eb2b8a0effbc22cad Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 13:41:56 -0400 Subject: [PATCH 20/40] HYDRA-1098 : Plug Maya filters to Fvp pruning scene index --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 38 +++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 62f72dc7b..6d40150ff 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -803,12 +803,38 @@ MStatus MtohRenderOverride::Render( _displayStyleSceneIndex->SetRefineLevel({true, delegateParams.refineLevel}); } - auto objectExclusions = framecontext->objectTypeExclusions(); - if (objectExclusions & MHWRender::MFrameContext::kExcludeMeshes) { - _pruningSceneIndex->EnableFilter(FvpPruningTokens->mesh); - } else { - _pruningSceneIndex->DisableFilter(FvpPruningTokens->mesh); - } + // Update "Show" menu filters + { + auto objectExclusions = framecontext->objectTypeExclusions(); + + TfTokenVector polygonFilters = { + FvpPruningTokens->meshes, + FvpPruningTokens->capsules, + FvpPruningTokens->cones, + FvpPruningTokens->cubes, + FvpPruningTokens->cylinders, + FvpPruningTokens->spheres + }; + for (const auto& polygonFilter : polygonFilters) { + if (objectExclusions & MHWRender::MFrameContext::kExcludeMeshes) { + _pruningSceneIndex->EnableFilter(polygonFilter); + } else { + _pruningSceneIndex->DisableFilter(polygonFilter); + } + } + + if (objectExclusions & MHWRender::MFrameContext::kExcludeNurbsCurves) { + _pruningSceneIndex->EnableFilter(FvpPruningTokens->nurbsCurves); + } else { + _pruningSceneIndex->DisableFilter(FvpPruningTokens->nurbsCurves); + } + + if (objectExclusions & MHWRender::MFrameContext::kExcludeNurbsSurfaces) { + _pruningSceneIndex->EnableFilter(FvpPruningTokens->nurbsPatches); + } else { + _pruningSceneIndex->DisableFilter(FvpPruningTokens->nurbsPatches); + } + } // Toggle textures in the material network const unsigned int currentDisplayMode = drawContext.getDisplayStyle(); From 36a1013a2b6ccd6a31fda22b39554f63de71f2ca Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 14:35:00 -0400 Subject: [PATCH 21/40] HYDRA-1098 : Restructure Maya plugging code --- lib/mayaHydra/mayaPlugin/renderOverride.cpp | 33 ++++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 6d40150ff..2b038187a 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -114,6 +114,7 @@ #include #include #include +#include #include #include @@ -807,7 +808,7 @@ MStatus MtohRenderOverride::Render( { auto objectExclusions = framecontext->objectTypeExclusions(); - TfTokenVector polygonFilters = { + static TfTokenVector polygonFilters = { FvpPruningTokens->meshes, FvpPruningTokens->capsules, FvpPruningTokens->cones, @@ -815,24 +816,20 @@ MStatus MtohRenderOverride::Render( FvpPruningTokens->cylinders, FvpPruningTokens->spheres }; - for (const auto& polygonFilter : polygonFilters) { - if (objectExclusions & MHWRender::MFrameContext::kExcludeMeshes) { - _pruningSceneIndex->EnableFilter(polygonFilter); - } else { - _pruningSceneIndex->DisableFilter(polygonFilter); - } - } - - if (objectExclusions & MHWRender::MFrameContext::kExcludeNurbsCurves) { - _pruningSceneIndex->EnableFilter(FvpPruningTokens->nurbsCurves); - } else { - _pruningSceneIndex->DisableFilter(FvpPruningTokens->nurbsCurves); - } + static std::map mayaFiltersToFvpPruningTokens = { + { MHWRender::MFrameContext::kExcludeMeshes, polygonFilters }, + { MHWRender::MFrameContext::kExcludeNurbsCurves, {FvpPruningTokens->nurbsCurves} }, + { MHWRender::MFrameContext::kExcludeNurbsSurfaces, {FvpPruningTokens->nurbsPatches} } + }; - if (objectExclusions & MHWRender::MFrameContext::kExcludeNurbsSurfaces) { - _pruningSceneIndex->EnableFilter(FvpPruningTokens->nurbsPatches); - } else { - _pruningSceneIndex->DisableFilter(FvpPruningTokens->nurbsPatches); + for (auto [mayaFilter, fvpPruningTokens] : mayaFiltersToFvpPruningTokens) { + for (const auto& fvpPruningToken : fvpPruningTokens) { + if (objectExclusions & mayaFilter) { + _pruningSceneIndex->EnableFilter(fvpPruningToken); + } else { + _pruningSceneIndex->DisableFilter(fvpPruningToken); + } + } } } From f8a0f70f105e3e4c2f0ac7f69daccc781b27258d Mon Sep 17 00:00:00 2001 From: debloip Date: Fri, 11 Oct 2024 15:33:03 -0400 Subject: [PATCH 22/40] HYDRA-1098 : Add comment --- lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp index 87fcf5452..6e713f53f 100644 --- a/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp +++ b/lib/flowViewport/sceneIndex/fvpPruningSceneIndex.cpp @@ -55,6 +55,8 @@ bool _HasAncestorInclusiveInContainer(const SdfPath& path, const Container& path bool _MeshesFilterHandler(const HdSceneIndexBaseRefPtr& sceneIndex, const SdfPath& primPath, const HdSceneIndexPrim& prim) { + // Currently we just flat out remove any prim with a mesh type. If we were to add extra checks to make sure this is not + // a mesh prim that serves another purpose, we would add them here. return prim.primType == HdPrimTypeTokens->mesh; } From 1fd1afba37b69d617eb1379024df2935eec8ef09 Mon Sep 17 00:00:00 2001 From: debloip Date: Tue, 15 Oct 2024 15:51:32 -0400 Subject: [PATCH 23/40] HYDRA-1098 : Add filter tests with USD data for polygon and nurbs curve filters --- .../nurbsCurves_USD_excluded.png | Bin 0 -> 1563 bytes .../nurbsCurves_USD_included.png | Bin 0 -> 5176 bytes .../polygons_USD_excluded.png | Bin 0 -> 1563 bytes .../polygons_USD_included.png | Bin 0 -> 13820 bytes .../render/mayaToHydra/testViewportFilters.py | 63 ++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_excluded.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_included.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_excluded.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_included.png diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_excluded.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_excluded.png new file mode 100644 index 0000000000000000000000000000000000000000..dbedef32fd8f3b0a32f32b3420710101c9e1097e GIT binary patch literal 1563 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL9Be?5hW%z|fD~V9glC$sFM}44%>l$9a4C2) zkmSsFb1Me(LBuVsZRZ#mSZ8{=IEGZrd3)87mqAhBz=6jl>*{4Q7RWmpEncvH-OQg1 z53bZ(Gc=e>axio@GE9&drAC8bG!=|ygwe8q#>HXI_W%}?wyzd{fMqrAGM&NG)z4*} HQ$iB}d4q$r literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_included.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsCurves_USD_included.png new file mode 100644 index 0000000000000000000000000000000000000000..ddd8f44330797b25ee941c92554051223826331b GIT binary patch literal 5176 zcmeG=XH-*Lvq_8+u%sYWgaD!U+;AyUB7_z}njjz$X(~l2(lHtYDJE2dbm@o`K?DV* zNDrW(flw7eFVc;Lzy%b(!@b|%x7Pdle!Q%;Pxh2OGiPS@>^&#Z>a5989$_932z1oU zlwbn_fm8Pf>=1yVwEy`U_&et1V0OvE0wfR2VZhk`F>UVwPi}u>2u+EYac8hpX=k}n$24YgOJ8=E5XBRD3 zX_L3D^Nzkkp?I2_B3j08Rjv#_s$}0o^g66(EPef0b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=!v}NWBnD+xB!$`Vy^4vpi28M<$QGB%^HoM z3Bb6-stD)ztx?Z`2KRJ4QKH6=oLvL`e0JM#Cp0IwDJKQwCTMNonTg-(YHJs>_^HK> zh(oCnLe~xr5Zxqn#xQunp`wQqM)d}TB9Z0IauVnCBo9)i&w)JPOiLCx5n~#R!7Y{;ip`;(a#a))f&kAo#kMoMIqR;`9w*Cu| zqRvwIS*V=3YdqsT`{wS8O-_UR)ZG;rg3(~`v0D$mfkay|{K&k&j~xSM9gAe%xehfb z?A)JDSul9A6uz+NACw#v7JU4Xzq@&+EjI#Id_F6yK_U|rO>yE_(5p4$LD9259E(`4 z1r%B})dmO^(6+sL6|^ng8Dj&5nSaV^OEgm;0>q+~W8`48L>V_C%b5pRb?7w)7jdE}U<;);|q=$oro^_<_uf&JrFQT)h1sCezw} literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_excluded.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_excluded.png new file mode 100644 index 0000000000000000000000000000000000000000..dbedef32fd8f3b0a32f32b3420710101c9e1097e GIT binary patch literal 1563 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL9Be?5hW%z|fD~V9glC$sFM}44%>l$9a4C2) zkmSsFb1Me(LBuVsZRZ#mSZ8{=IEGZrd3)87mqAhBz=6jl>*{4Q7RWmpEncvH-OQg1 z53bZ(Gc=e>axio@GE9&drAC8bG!=|ygwe8q#>HXI_W%}?wyzd{fMqrAGM&NG)z4*} HQ$iB}d4q$r literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_included.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/polygons_USD_included.png new file mode 100644 index 0000000000000000000000000000000000000000..9f33a504754ea0de12f2d03b2dc115545a3acf9a GIT binary patch literal 13820 zcmeIZS6EY9*e;5I3Mf^2@6wxq7`h}7kPe|L7!WB^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4nVzp|w%0I!^Q7q)Gtr1L4Be6TkE1?C4Jxqk+DQHZ|}Y$}|(l9HlrJqkYw!Ri66 zi%M-|+L1UWia2RuhQbDYL5!i`uu(D)sJc8qD4DNnaLTyF%}7X)SPF2oRA`S|%i{|{%vS1bSk literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/testViewportFilters.py b/test/lib/mayaUsd/render/mayaToHydra/testViewportFilters.py index a09780cfa..524127119 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testViewportFilters.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testViewportFilters.py @@ -14,8 +14,13 @@ # import maya.cmds as cmds import fixturesUtils +import functools +import mayaUsd_createStageWithNewLayer +import mayaUsd.lib import mayaUtils import mtohUtils +import testUtils +import usdUtils # Note : the order of the bit flags does not correspond to the order # of the options in the "Show" -> "Viewport" UI. @@ -103,6 +108,8 @@ def checkFilter(self, name, exclusionMask, cameraDistance=15): # Restore old mask cmds.modelEditor(activeViewport, edit=True, excludeObjectMask=oldMask) + # --- Maya data --- + # TODO : Construction planes (not working in Hydra as of 2024-05-03) def test_Dimensions(self): @@ -222,5 +229,61 @@ def test_Strokes(self): # TODO : Texture Placements (not working in Hydra as of 2024-05-03) + # --- USD data --- + + def test_UsdPolygons(self): + from pxr import UsdGeom + + stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() + stage = mayaUsd.lib.GetPrim(stagePath).GetStage() + + capsuleName = "UsdCapsule" + capsuleXform = UsdGeom.Xform.Define(stage, "/" + capsuleName + "Xform") + capsuleXform.AddTranslateOp().Set(value=(6, 0, 0)) + UsdGeom.Capsule.Define(stage, str(capsuleXform.GetPath()) + "/" + capsuleName) + cmds.select(clear=True) + + coneName = "UsdCone" + coneXform = UsdGeom.Xform.Define(stage, "/" + coneName + "Xform") + coneXform.AddTranslateOp().Set(value=(2, 0, -2)) + UsdGeom.Cone.Define(stage, str(coneXform.GetPath()) + "/" + coneName) + cmds.select(clear=True) + + cubeName = "UsdCube" + cubeXform = UsdGeom.Xform.Define(stage, "/" + cubeName + "Xform") + cubeXform.AddTranslateOp().Set(value=(-3, 0, -3)) + UsdGeom.Cube.Define(stage, str(cubeXform.GetPath()) + "/" + cubeName) + cmds.select(clear=True) + + cylinderName = "UsdCylinder" + cylinderXform = UsdGeom.Xform.Define(stage, "/" + cylinderName + "Xform") + cylinderXform.AddTranslateOp().Set(value=(-2, 0, 2)) + UsdGeom.Cylinder.Define(stage, str(cylinderXform.GetPath()) + "/" + cylinderName) + cmds.select(clear=True) + + sphereName = "UsdSphere" + sphereXform = UsdGeom.Xform.Define(stage, "/" + sphereName + "Xform") + sphereXform.AddTranslateOp().Set(value=(0, 0, 6)) + UsdGeom.Sphere.Define(stage, str(sphereXform.GetPath()) + "/" + sphereName) + cmds.select(clear=True) + + cmds.polyTorus() + cmds.move(3, 0, 3) + cmds.select(clear=True) + + cmds.refresh() + self.checkFilter("polygons_USD", kExcludeMeshes, 10) + + def test_UsdNurbsCurves(self): + def createUsdCurve(stagePath): + circleName = cmds.circle() + usdCircleName = mayaUsd.lib.PrimUpdaterManager.duplicate(cmds.ls(circleName[0], long=True)[0], stagePath) + cmds.select(circleName) + cmds.delete() + cmds.select(usdCircleName) + stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() + self.stackInstances(functools.partial(createUsdCurve, stagePath), 50, [0, 0, 0.005]) + self.checkFilter("nurbsCurves_USD", kExcludeNurbsCurves, 2) + if __name__ == '__main__': fixturesUtils.runTests(globals()) From 751dece8b5e52d64cd38b58b29414238d9c5d15d Mon Sep 17 00:00:00 2001 From: debloip Date: Tue, 15 Oct 2024 16:12:29 -0400 Subject: [PATCH 24/40] HYDRA-1098 : Add filter test with USD data for nurbs patches filter --- .../nurbsPatches_USD_excluded.png | Bin 0 -> 1563 bytes .../nurbsPatches_USD_included.png | Bin 0 -> 20117 bytes .../render/mayaToHydra/testViewportFilters.py | 13 +++++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_excluded.png create mode 100644 test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_included.png diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_excluded.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_excluded.png new file mode 100644 index 0000000000000000000000000000000000000000..dbedef32fd8f3b0a32f32b3420710101c9e1097e GIT binary patch literal 1563 zcmeAS@N?(olHy`uVBq!ia0y~yV4MKL9Be?5hW%z|fD~V9glC$sFM}44%>l$9a4C2) zkmSsFb1Me(LBuVsZRZ#mSZ8{=IEGZrd3)87mqAhBz=6jl>*{4Q7RWmpEncvH-OQg1 z53bZ(Gc=e>axio@GE9&drAC8bG!=|ygwe8q#>HXI_W%}?wyzd{fMqrAGM&NG)z4*} HQ$iB}d4q$r literal 0 HcmV?d00001 diff --git a/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_included.png b/test/lib/mayaUsd/render/mayaToHydra/ViewportFiltersTest/nurbsPatches_USD_included.png new file mode 100644 index 0000000000000000000000000000000000000000..6c42ebcf78abd4df79bcb3fecc85c187be93b258 GIT binary patch literal 20117 zcmeEu`#aNr{I^q$oXM2KFsEWDl^o_gXC>t@XTrxRMeMa_0$fWeYSk4Edkm|6L~K8U`2` z#2HKwx>l%{YxxstqT^x54p4(2@0&#)8oJ_?WKV|}1&177)wtr$7vkKr>@<@Wy37fj z?FHF7MoREO3?gmbSjEFG(>Ta`;OV}0#dJk&Q&UN6#lX?u7`@N$AB?JbMbj(mD+WTe zPxc2Jfe($b!MlW>0$vbgczA#(CmkK&8p_DX$iOgkiiL%NK}Yca|KtB*OS-oVY#CzE z!5cHJ`80gQy7zHKb=xFnHbJmT3%xz>itmxNz)v~cqB9^bii^9hp^yG-d8m^PH)lJY z_|jt5pOq1egKT?7?}kSYh#Z_OAe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