HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
prefixPathPruningSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 #ifndef PXR_IMAGING_HDSI_PREFIX_PATH_PRUNING_SCENE_INDEX_H
7 #define PXR_IMAGING_HDSI_PREFIX_PATH_PRUNING_SCENE_INDEX_H
8 
9 #include "pxr/pxr.h"
10 
12 #include "pxr/imaging/hdsi/api.h"
13 
15 
16 #define HDSI_PREFIX_PATH_PRUNING_SCENE_INDEX_TOKENS \
17  (excludePathPrefixes)
18 
19 TF_DECLARE_PUBLIC_TOKENS(HdsiPrefixPathPruningSceneIndexTokens, HDSI_API,
21 
23 
24 ///
25 /// A scene index that prunes prims at or below the list of provided
26 /// prefix paths.
27 /// The list of prefix paths may be provided at c'tor time using a path vector
28 /// data source for the "excludePathPrefixes" locator, and updated
29 /// using the SetExcludePathPrefixes method.
30 ///
31 /// \note
32 /// "Pruning" is an overloaded term in the context of scene indices and
33 /// deserves some clarification.
34 /// The pruning behavior of this scene index removes the subtree of prims
35 /// rooted at the provided path prefixes. Thus, the topology of the input scene
36 /// is modified as a result of pruning.
37 /// Notices are also filtered to exclude entries for paths that are pruned.
38 ///
39 /// While this scene index seems similar in nature to
40 /// HdsiPrimTypeAndPathPruningSceneIndex and HdsiPrimTypePruningSceneIndex, it
41 /// differs from them in the pruning behavior. The former two scene indices
42 /// do not modify the topology of the input scene, but instead return an empty
43 /// prim type and prim container for a prim that is "pruned".
44 ///
47 {
48 public:
49  HDSI_API
50  static HdsiPrefixPathPruningSceneIndexRefPtr
51  New(HdSceneIndexBaseRefPtr const &inputSceneIndex,
52  HdContainerDataSourceHandle const &inputArgs);
53 
54 public:
55  // HdSceneIndex overrides
56  HDSI_API
57  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
58  HDSI_API
59  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
60 
61  // Public API
62  HDSI_API
64 
65 protected:
66  // HdSingleInputFilteringSceneIndexBase overrides
67  HDSI_API
68  void _PrimsAdded(
69  const HdSceneIndexBase &sender,
70  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
71  HDSI_API
72  void _PrimsRemoved(
73  const HdSceneIndexBase &sender,
74  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
75  HDSI_API
76  void _PrimsDirtied(
77  const HdSceneIndexBase &sender,
78  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
79 
80 private:
81  HDSI_API
83  HdSceneIndexBaseRefPtr const &inputSceneIndex,
84  HdContainerDataSourceHandle const &inputArgs);
85  HDSI_API
86  ~HdsiPrefixPathPruningSceneIndex() override;
87 
88  bool _IsPruned(const SdfPath &primPath) const;
89 
90  void _RemovePrunedChildren(SdfPathVector *childPaths) const;
91 
92  SdfPathVector _sortedExcludePaths;
93  SdfPathSet _excludePathPrefixes;
94 };
95 
97 
98 #endif
HDSI_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
HDSI_API void SetExcludePathPrefixes(SdfPathVector paths)
HDSI_API void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
std::vector< class SdfPath > SdfPathVector
Definition: path.h:273
#define HDSI_API
Definition: api.h:23
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
Definition: path.h:192
HDSI_API void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
HDSI_API void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
HDSI_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
TF_DECLARE_WEAK_AND_REF_PTRS(HdsiPrefixPathPruningSceneIndex)
#define HDSI_PREFIX_PATH_PRUNING_SCENE_INDEX_TOKENS
TF_DECLARE_PUBLIC_TOKENS(HdsiPrefixPathPruningSceneIndexTokens, HDSI_API, HDSI_PREFIX_PATH_PRUNING_SCENE_INDEX_TOKENS)
static HDSI_API HdsiPrefixPathPruningSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputSceneIndex, HdContainerDataSourceHandle const &inputArgs)