HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
selectionSceneIndexObserver.h
Go to the documentation of this file.
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_IMAGING_HDX_SELECTION_SCENE_INDEX_OBSERVER_H
8 #define PXR_IMAGING_HDX_SELECTION_SCENE_INDEX_OBSERVER_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdx/api.h"
14 
16 
17 /// \class HdxSelectionSceneIndexObserver
18 ///
19 /// Queries each prim of the given scene index for the HdSelectionsSchema to
20 /// compute a HdSelection.
21 ///
23 {
24 public:
25  HDX_API
27 
28  /// Set which scene index to query for selection.
29  HDX_API
30  void SetSceneIndex(HdSceneIndexBaseRefPtr const &sceneIndex);
31 
32  /// Increased every time the selection in the scene index gets dirtied
33  /// (or a difference scene index is set).
34  HDX_API
35  int GetVersion() const;
36 
37  /// Get the result of querying the scene index for the selection as
38  /// HdSelection.
39  HDX_API
41 
42  HDX_API
43  void PrimsAdded(
44  const HdSceneIndexBase &sender,
45  const AddedPrimEntries &entries) override;
46  HDX_API
47  void PrimsDirtied(
48  const HdSceneIndexBase &sender,
49  const DirtiedPrimEntries &entries) override;
50  HDX_API
51  void PrimsRemoved(
52  const HdSceneIndexBase &sender,
53  const RemovedPrimEntries &entries) override;
54 
55  HDX_API
56  void PrimsRenamed(
57  const HdSceneIndexBase &sender,
58  const RenamedPrimEntries &entries) override;
59 
60 private:
61  HdSelectionSharedPtr _ComputeSelection();
62 
63  HdSceneIndexBaseRefPtr _sceneIndex;
64 
65  int _version;
66  HdSelectionSharedPtr _selection;
67  SdfPathSet _dirtiedPrims;
68 };
69 
71 
72 #endif
HDX_API void PrimsDirtied(const HdSceneIndexBase &sender, const DirtiedPrimEntries &entries) override
HDX_API void PrimsAdded(const HdSceneIndexBase &sender, const AddedPrimEntries &entries) override
#define HDX_API
Definition: api.h:23
HDX_API void SetSceneIndex(HdSceneIndexBaseRefPtr const &sceneIndex)
Set which scene index to query for selection.
HDX_API void PrimsRenamed(const HdSceneIndexBase &sender, const RenamedPrimEntries &entries) override
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
Definition: path.h:192
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDX_API int GetVersion() const
std::shared_ptr< class HdSelection > HdSelectionSharedPtr
Definition: selection.h:23
HDX_API void PrimsRemoved(const HdSceneIndexBase &sender, const RemovedPrimEntries &entries) override
HDX_API HdSelectionSharedPtr GetSelection()