HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
prefixingSceneIndex.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_PREFIXING_SCENE_INDEX_H
8 #define PXR_IMAGING_HD_PREFIXING_SCENE_INDEX_H
9 
10 #include "pxr/imaging/hd/api.h"
12 
14 
17 
18 ///
19 /// \class HdPrefixingSceneIndex
20 ///
21 /// A prefixing scene index is one in which the input scene contains
22 /// data sources whose paths are all prefixed with a given prefix.
23 ///
25 {
26 public:
27 
28  /// Creates a new prefixing scene index.
29  ///
30  static HdPrefixingSceneIndexRefPtr New(
31  const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &prefix)
32  {
33  return TfCreateRefPtr(new HdPrefixingSceneIndex(inputScene, prefix));
34  }
35 
36  // satisfying HdSceneIndexBase
37  HD_API
38  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
39 
40  HD_API
41  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
42 
43 protected:
44 
45  HD_API
46  HdPrefixingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene,
47  const SdfPath &prefix);
48 
49  // satisfying HdSingleInputFilteringSceneIndexBase
50  void _PrimsAdded(
51  const HdSceneIndexBase &sender,
52  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
53 
54  void _PrimsRemoved(
55  const HdSceneIndexBase &sender,
56  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
57 
58  void _PrimsDirtied(
59  const HdSceneIndexBase &sender,
60  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
61 
62 private:
63 
64  SdfPath _AddPathPrefix(const SdfPath &primPath) const;
65 
66  SdfPath _RemovePathPrefix(const SdfPath &primPath) const;
67 
68  const SdfPath _prefix;
69 };
70 
72 
73 #endif
74 
TfRefPtr< T > TfCreateRefPtr(T *ptr)
Definition: refPtr.h:1190
void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
HD_API HdPrefixingSceneIndex(const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &prefix)
HD_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
#define HD_API
Definition: api.h:23
void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
std::vector< class SdfPath > SdfPathVector
static HdPrefixingSceneIndexRefPtr New(const HdSceneIndexBaseRefPtr &inputScene, const SdfPath &prefix)
Definition: path.h:273
void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
TF_DECLARE_REF_PTRS(HdPrefixingSceneIndex)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HD_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override