Loading...
Searching...
No Matches
hydraObserver.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_USDVIEWQ_HYDRA_OBSERVER_H
8#define PXR_USD_IMAGING_USDVIEWQ_HYDRA_OBSERVER_H
9
10#include "pxr/imaging/hd/sceneIndex.h"
11#include "pxr/usdImaging/usdviewq/api.h"
12
13
14PXR_NAMESPACE_OPEN_SCOPE
15
29{
30public:
31
32 USDVIEWQ_API
33 UsdviewqHydraObserver() = default;
34
35 USDVIEWQ_API
37
41 USDVIEWQ_API
42 static
43 std::vector<std::string> GetRegisteredSceneIndexNames();
44
45
48 USDVIEWQ_API
49 bool TargetToNamedSceneIndex(const std::string &name);
50
51 using IndexList = std::vector<size_t> ;
52
59 USDVIEWQ_API
60 bool TargetToInputSceneIndex(const IndexList &inputIndices);
61
62
65 USDVIEWQ_API
66 std::string GetDisplayName();
67
75 USDVIEWQ_API
76 std::vector<std::string> GetInputDisplayNames(
77 const IndexList &inputIndices);
78
81 USDVIEWQ_API
82 SdfPathVector GetChildPrimPaths(const SdfPath &primPath);
83
86 USDVIEWQ_API
88
92 {
94 : added(entries)
95 {}
96
98 : removed(entries)
99 {}
100
102 : dirtied(entries)
103 {}
104
105 NoticeEntry(const NoticeEntry &other) = default;
106
110 };
111
112 using NoticeEntryVector = std::vector<NoticeEntry>;
113
116 USDVIEWQ_API
118
121 USDVIEWQ_API
122 NoticeEntryVector GetPendingNotices();
123
125 USDVIEWQ_API
127
128private:
129
130 bool _Target(const HdSceneIndexBaseRefPtr &sceneIndex);
131
132 class _Observer : public HdSceneIndexObserver
133 {
134 public:
135 USDVIEWQ_API
136 void PrimsAdded(
137 const HdSceneIndexBase &sender,
138 const AddedPrimEntries &entries) override;
139
140 USDVIEWQ_API
141 void PrimsRemoved(
142 const HdSceneIndexBase &sender,
143 const RemovedPrimEntries &entries) override;
144
145 USDVIEWQ_API
146 void PrimsDirtied(
147 const HdSceneIndexBase &sender,
148 const DirtiedPrimEntries &entries) override;
149
150 USDVIEWQ_API
151 void PrimsRenamed(
152 const HdSceneIndexBase &sender,
153 const RenamedPrimEntries &entries) override;
154
155
156 NoticeEntryVector notices;
157 };
158
159 HdSceneIndexBaseRefPtr _sceneIndex;
160 _Observer _observer;
161};
162
163PXR_NAMESPACE_CLOSE_SCOPE
164
165#endif
Abstract interface to scene data.
Definition: sceneIndex.h:48
Observer of scene data.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Abstracts pieces necessary for implementing a Hydra Scene Browser in a manner convenient for exposing...
Definition: hydraObserver.h:29
USDVIEWQ_API bool HasPendingNotices()
Returns true if there are pending scene change notices.
USDVIEWQ_API NoticeEntryVector GetPendingNotices()
Returns (and clears) any accumulated scene change notices.
USDVIEWQ_API std::vector< std::string > GetInputDisplayNames(const IndexList &inputIndices)
Starting from the currently targeted HdSceneIndex, each value in the inputIndices is treated as an in...
USDVIEWQ_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath)
Returns the paths of the immediate children of the specified primPath for the actively observer scene...
USDVIEWQ_API bool TargetToInputSceneIndex(const IndexList &inputIndices)
Starting from the currently targeted HdSceneIndex, each value in the inputIndices is treated as an in...
USDVIEWQ_API bool TargetToNamedSceneIndex(const std::string &name)
Target this observer to a scene index with the given name previously registered via HdSceneIndexNameR...
USDVIEWQ_API std::string GetDisplayName()
Returns the display name of the actively targeted scene index.
static USDVIEWQ_API std::vector< std::string > GetRegisteredSceneIndexNames()
Returns the names of scene indices previously registered with HdSceneIndexNameRegistry.
USDVIEWQ_API void ClearPendingNotices()
Clears any accumulated scene change notices.
USDVIEWQ_API HdSceneIndexPrim GetPrim(const SdfPath &primPath)
Returns the prim type and data source for the specified primPath for the actively observer scene inde...
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35
Aggregate of HdSceneIndexObserver entry types for easier binding to python.
Definition: hydraObserver.h:92