All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
notice.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 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 SDF_NOTICE_H
25 #define SDF_NOTICE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/api.h"
31 #include "pxr/usd/sdf/changeList.h"
32 #include "pxr/usd/sdf/declareHandles.h"
33 #include "pxr/usd/sdf/path.h"
34 #include "pxr/base/tf/notice.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 SDF_DECLARE_HANDLES(SdfLayer);
39 
44 class SdfNotice {
45 public:
51  class Base : public TfNotice {
52  public:
53  SDF_API ~Base();
54  };
55 
61  public:
62  BaseLayersDidChange(const SdfLayerChangeListMap &changeMap,
63  size_t serialNumber)
64  : _map(&changeMap)
65  , _serialNumber(serialNumber)
66  {}
67 
69  SDF_API
70  SdfLayerHandleVector GetLayers() const;
71 
73  const SdfLayerChangeListMap &GetChangeListMap() const { return *_map; }
74 
76  size_t GetSerialNumber() const { return _serialNumber; }
77 
78  private:
79  const SdfLayerChangeListMap *_map;
80  const size_t _serialNumber;
81  };
82 
93  : public Base, public BaseLayersDidChange {
94  public:
95  LayersDidChangeSentPerLayer(const SdfLayerChangeListMap &changeMap,
96  size_t serialNumber)
97  : BaseLayersDidChange(changeMap, serialNumber) {}
98  SDF_API virtual ~LayersDidChangeSentPerLayer();
99  };
100 
106  : public Base, public BaseLayersDidChange {
107  public:
108  LayersDidChange(const SdfLayerChangeListMap &changeMap,
109  size_t serialNumber)
110  : BaseLayersDidChange(changeMap, serialNumber) {}
111  SDF_API virtual ~LayersDidChange();
112  };
113 
118  class LayerInfoDidChange : public Base {
119  public:
120  LayerInfoDidChange( const TfToken &key ) :
121  _key(key) {}
122  SDF_API ~LayerInfoDidChange();
123 
125  const TfToken & key() const { return _key; }
126  private:
127  TfToken _key;
128  };
129 
135  public:
136  SDF_API
137  LayerIdentifierDidChange(const std::string& oldIdentifier,
138  const std::string& newIdentifier);
139  SDF_API
140  ~LayerIdentifierDidChange();
141 
143  const std::string& GetOldIdentifier() const { return _oldId; }
144 
146  const std::string& GetNewIdentifier() const { return _newId; }
147 
148  private:
149  std::string _oldId;
150  std::string _newId;
151  };
152 
157  class LayerDidReplaceContent : public Base {
158  public:
159  SDF_API ~LayerDidReplaceContent();
160  };
161 
165  public:
166  SDF_API virtual ~LayerDidReloadContent();
167  };
168 
173  class LayerDidSaveLayerToFile : public Base {
174  public:
175  SDF_API ~LayerDidSaveLayerToFile();
176  };
177 
183  class LayerDirtinessChanged : public Base {
184  public:
185  SDF_API ~LayerDirtinessChanged();
186  };
187 
194  class LayerMutenessChanged : public Base {
195  public:
196  LayerMutenessChanged(const std::string& layerPath, bool wasMuted)
197  : _layerPath(layerPath)
198  , _wasMuted(wasMuted)
199  { }
200 
201  SDF_API ~LayerMutenessChanged();
202 
204  const std::string& GetLayerPath() const { return _layerPath; }
205 
207  bool WasMuted() const { return _wasMuted; }
208 
209  private:
210  std::string _layerPath;
211  bool _wasMuted;
212  };
213 };
214 
215 PXR_NAMESPACE_CLOSE_SCOPE
216 
217 #endif // SDF_NOTICE_H
SDF_API SdfLayerHandleVector GetLayers() const
A list of layers changed.
A unit of scene description that you combine with other units of scene description to form a shot...
Definition: layer.h:93
const std::string & GetLayerPath() const
Returns the path of the layer that was muted or unmuted.
Definition: notice.h:204
The base class for objects used to notify interested parties (listeners) when events have occurred...
Definition: notice.h:93
Similar behavior to LayersDidChange, but only gets sent if a change in the dirty status of a layer oc...
Definition: notice.h:183
Wrapper class for Sdf notices.
Definition: notice.h:44
Base class for LayersDidChange and LayersDidChangeSentPerLayer.
Definition: notice.h:60
bool WasMuted() const
Returns true if the layer was muted, false if unmuted.
Definition: notice.h:207
size_t GetSerialNumber() const
The serial number for this round of change processing.
Definition: notice.h:76
Sent after a layer has been added or removed from the set of muted layers.
Definition: notice.h:194
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
Base notification class for scene.
Definition: notice.h:51
Sent when the (scene spec) info of a layer have changed.
Definition: notice.h:118
const std::string & GetOldIdentifier() const
Returns the old identifier for the layer.
Definition: notice.h:143
Global notice sent to indicate that layer contents have changed.
Definition: notice.h:105
Sent after a menv layer has been loaded from a file.
Definition: notice.h:157
Notice sent per-layer indicating all layers whose contents have changed within a single round of chan...
Definition: notice.h:92
const std::string & GetNewIdentifier() const
Returns the new identifier for the layer.
Definition: notice.h:146
const TfToken & key() const
Return the key affected.
Definition: notice.h:125
Sent after a layer is reloaded.
Definition: notice.h:164
Sent when the identifier of a layer has changed.
Definition: notice.h:134
Sent after a layer is saved to file.
Definition: notice.h:173
const SdfLayerChangeListMap & GetChangeListMap() const
A map of layers to the changes that occurred to them.
Definition: notice.h:73