HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
selectionSceneIndex.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_USD_IMAGING_USD_IMAGING_SELECTION_SCENE_INDEX_H
8 #define PXR_USD_IMAGING_USD_IMAGING_SELECTION_SCENE_INDEX_H
9 
11 
13 
15 
16 namespace UsdImagingSelectionSceneIndex_Impl
17 {
18 using _SelectionInfoSharedPtr = std::shared_ptr<struct _SelectionInfo>;
19 }
20 
22 
23 /// \class UsdImagingSelectionSceneIndex
24 ///
25 /// A simple scene index adding HdSelectionsSchema to all prims selected
26 /// with AddSelection.
27 ///
30 {
31 public:
33  static UsdImagingSelectionSceneIndexRefPtr New(
34  HdSceneIndexBaseRefPtr const &inputSceneIndex);
35 
37 
39  HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
40 
42  SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
43 
44  /// Given a path (including usd proxy path inside a native instance) of
45  /// a USD prim, determine the corresponding prim in the Usd scene index
46  /// (filtered by the UsdImagingNiPrototypePropagatingSceneIndex) and
47  /// populate its selections data source.
49  void AddSelection(const SdfPath &usdPath);
50 
51  /// Reset the scene index selection state.
53  void ClearSelection();
54 
55 protected:
56  void _PrimsAdded(
57  const HdSceneIndexBase &sender,
58  const HdSceneIndexObserver::AddedPrimEntries &entries) override;
59 
60  void _PrimsRemoved(
61  const HdSceneIndexBase &sender,
62  const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
63 
64  void _PrimsDirtied(
65  const HdSceneIndexBase &sender,
66  const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
67 
68 
69 private:
71  const HdSceneIndexBaseRefPtr &inputSceneIndex);
72 
74  _SelectionInfoSharedPtr _selectionInfo;
75 };
76 
78 
79 #endif
#define USDIMAGING_API
Definition: api.h:23
void _PrimsRemoved(const HdSceneIndexBase &sender, const HdSceneIndexObserver::RemovedPrimEntries &entries) override
USDIMAGING_API void AddSelection(const SdfPath &usdPath)
static USDIMAGING_API UsdImagingSelectionSceneIndexRefPtr New(HdSceneIndexBaseRefPtr const &inputSceneIndex)
USDIMAGING_API HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override
std::vector< class SdfPath > SdfPathVector
USDIMAGING_API void ClearSelection()
Reset the scene index selection state.
USDIMAGING_API SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override
void _PrimsDirtied(const HdSceneIndexBase &sender, const HdSceneIndexObserver::DirtiedPrimEntries &entries) override
Definition: path.h:273
std::shared_ptr< struct _SelectionInfo > _SelectionInfoSharedPtr
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
void _PrimsAdded(const HdSceneIndexBase &sender, const HdSceneIndexObserver::AddedPrimEntries &entries) override
TF_DECLARE_REF_PTRS(UsdImagingSelectionSceneIndex)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
~UsdImagingSelectionSceneIndex() override