diff --git a/pxr/usdImaging/usdImaging/delegate.cpp b/pxr/usdImaging/usdImaging/delegate.cpp index 6ce62ce57c..445d0dd0b3 100644 --- a/pxr/usdImaging/usdImaging/delegate.cpp +++ b/pxr/usdImaging/usdImaging/delegate.cpp @@ -1330,6 +1330,11 @@ UsdImagingDelegate::_ResyncUsdPrim(SdfPath const& usdPath, TF_DEBUG(USDIMAGING_CHANGES).Msg(" (repopulating from root)\n"); proxy->Repopulate(usdPath); } else { + // Build a TfHashSet of excluded prims for fast rejection. + TfHashSet excludedSet; + TF_FOR_ALL(pathIt, _excludedPrimPaths) { + excludedSet.insert(*pathIt); + } // If we resynced prims individually, walk the subtree for new prims UsdPrimRange range(_stage->GetPrimAtPath(usdPath), _GetDisplayPredicate()); @@ -1342,6 +1347,13 @@ UsdImagingDelegate::_ResyncUsdPrim(SdfPath const& usdPath, iter.PruneChildren(); continue; } + if (excludedSet.find(iter->GetPath()) != excludedSet.end()) { + iter.PruneChildren(); + TF_DEBUG(USDIMAGING_CHANGES).Msg("[Resync Prim] Pruned at <%s> " + "due to exclusion list\n", + iter->GetPath().GetText()); + continue; + } // Check if this prim (& subtree) should be pruned based on // prim type. if (UsdImagingPrimAdapter::ShouldCullSubtree(*iter)) {