Loading...
Searching...
No Matches
rerootingSceneIndex.h
1//
2// Copyright 2022 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_USD_IMAGING_USD_IMAGING_REROOTING_SCENE_INDEX_H
8#define PXR_USD_IMAGING_USD_IMAGING_REROOTING_SCENE_INDEX_H
9
10#include "pxr/usdImaging/usdImaging/api.h"
11
12#include "pxr/imaging/hd/filteringSceneIndex.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
17
33{
34public:
35 static UsdImagingRerootingSceneIndexRefPtr New(
36 HdSceneIndexBaseRefPtr const &inputScene,
37 const SdfPath &srcPrefix,
38 const SdfPath &dstPrefix)
39 {
40 return TfCreateRefPtr(
42 inputScene, srcPrefix, dstPrefix));
43 }
44
45 USDIMAGING_API
46 HdSceneIndexPrim GetPrim(const SdfPath& primPath) const override;
47
48 USDIMAGING_API
49 SdfPathVector GetChildPrimPaths(const SdfPath& primPath) const override;
50
51protected:
52 USDIMAGING_API
54 HdSceneIndexBaseRefPtr const &inputScene,
55 const SdfPath &srcPrefix,
56 const SdfPath &dstPrefix);
57
58 USDIMAGING_API
60
61 // satisfying HdSingleInputFilteringSceneIndexBase
62 void _PrimsAdded(
63 const HdSceneIndexBase& sender,
64 const HdSceneIndexObserver::AddedPrimEntries& entries) override;
65
66 void _PrimsRemoved(
67 const HdSceneIndexBase& sender,
68 const HdSceneIndexObserver::RemovedPrimEntries& entries) override;
69
70 void _PrimsDirtied(
71 const HdSceneIndexBase& sender,
72 const HdSceneIndexObserver::DirtiedPrimEntries& entries) override;
73
74private:
75 SdfPath _SrcPathToDstPath(const SdfPath &primPath) const;
76 SdfPath _DstPathToSrcPath(const SdfPath &primPath) const;
77
78 const SdfPath _srcPrefix;
79 const SdfPath _dstPrefix;
80 // Prefixes of _dstPrefix
81 const SdfPathVector _dstPrefixes;
82 // Is _srcPrefix equal to _dstPrefix?
83 const bool _srcEqualsDst;
84 // Is _srcPrefix == / ?
85 const bool _srcPrefixIsRoot;
86};
87
88PXR_NAMESPACE_CLOSE_SCOPE
89
90#endif
Abstract interface to scene data.
Definition: sceneIndex.h:54
An abstract base class for a filtering scene index that observes a single input scene index.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Drops all prims not under srcPrefix and moves those under srcPrefix to dstPrefix.
USDIMAGING_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
Returns the paths of all scene index prims located immediately below primPath.
USDIMAGING_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
Returns a pair of (prim type, datasource).
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35