sceneIndexObserver.h
1 //
2 // Copyright 2021 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_SCENE_INDEX_OBSERVER_H
25 #define PXR_IMAGING_HD_SCENE_INDEX_OBSERVER_H
26 
27 #include "pxr/pxr.h"
28 
30 
31 #include "pxr/usd/sdf/path.h"
32 
33 #include "pxr/imaging/hd/api.h"
34 #include "pxr/imaging/hd/dataSourceLocator.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 class HdSceneIndexBase;
39 
42 
49 {
50 public:
51 
52  HD_API
53  virtual ~HdSceneIndexObserver();
54 
59  {
60  SdfPath primPath;
61  TfToken primType;
62 
63  AddedPrimEntry(const SdfPath &primPath, const TfToken &primType)
64  : primPath(primPath)
65  , primType(primType)
66  {
67  }
68  };
70 
71  //----------------------------------
72 
77  {
78  SdfPath primPath;
79 
80  RemovedPrimEntry(const SdfPath &primPath)
81  : primPath(primPath)
82  {}
83  };
84 
86 
87  //----------------------------------
88 
95  {
96  SdfPath primPath;
97  HdDataSourceLocatorSet dirtyLocators;
98 
100  const SdfPath &primPath,
101  const HdDataSourceLocatorSet &dirtyLocators)
102  : primPath(primPath)
103  , dirtyLocators(dirtyLocators)
104  {}
105  };
106 
108 
109  //-------------------------------------------------------------------------
110 
118  HD_API
119  virtual void PrimsAdded(
120  const HdSceneIndexBase &sender,
121  const AddedPrimEntries &entries) = 0;
122 
127  HD_API
128  virtual void PrimsRemoved(
129  const HdSceneIndexBase &sender,
130  const RemovedPrimEntries &entries) = 0;
131 
138  HD_API
139  virtual void PrimsDirtied(
140  const HdSceneIndexBase &sender,
141  const DirtiedPrimEntries &entries) = 0;
142 };
143 
144 PXR_NAMESPACE_CLOSE_SCOPE
145 
146 #endif // PXR_IMAGING_HD_SCENE_INDEX_OBSERVER_H
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:62
Standard pointer typedefs.
virtual HD_API void PrimsAdded(const HdSceneIndexBase &sender, const AddedPrimEntries &entries)=0
A notification indicating prims have been added to the scene.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:89
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
Observer of scene data.
A notice indicating a prim of a given type was added to the scene.
Abstract interface to scene data.
Definition: sceneIndex.h:62
virtual HD_API void PrimsDirtied(const HdSceneIndexBase &sender, const DirtiedPrimEntries &entries)=0
A notification indicating prim datasources have been invalidated.
A notice indicating a prim subtree was removed from the scene.
Represents a set of data source locators closed under descendancy.
virtual HD_API void PrimsRemoved(const HdSceneIndexBase &sender, const RemovedPrimEntries &entries)=0
A notification indicating prims have been removed from the scene.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
A notice indicating a prim was invalidated.
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:141