HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_Overrides.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Side Effects Software Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __HUSD_Overrides_h__
19 #define __HUSD_Overrides_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_Utils.h"
24 #include <UT/UT_IntrusivePtr.h>
25 #include <UT/UT_IStream.h>
26 #include <UT/UT_StringMap.h>
27 #include <UT/UT_UniquePtr.h>
28 #include <pxr/pxr.h>
29 #include <iosfwd>
30 #include <vector>
31 
33 
34 class XUSD_Data;
35 class XUSD_OverridesData;
36 
38 
39 class HUSD_TimeCode;
40 class HUSD_PathSet;
41 
42 class HUSD_API HUSD_Overrides : public UT_IntrusiveRefCounter<HUSD_Overrides>,
43  public UT_NonCopyable
44 {
45 public:
47  ~HUSD_Overrides();
48 
49  void save(std::ostream &os) const;
50  bool load(UT_IStream &is);
51  void copy(const HUSD_Overrides &src);
52  bool isEmpty() const;
53  bool isEmpty(HUSD_OverridesLayerId layer_id) const;
54 
55  void clear(const UT_StringRef &fromprim =
57  void clear(HUSD_OverridesLayerId layer_id,
58  const UT_StringRef &fromprim =
60 
61  bool getDrawModeOverrides(const UT_StringRef &primpath,
62  UT_StringMap<UT_StringHolder> &overrides) const;
63  bool setDrawMode(HUSD_AutoWriteOverridesLock &lock,
64  const HUSD_FindPrims &prims,
65  const UT_StringRef &drawmode);
66  bool getActiveOverrides(const UT_StringRef &primpath,
67  UT_StringMap<bool> &overrides) const;
68  bool setActive(HUSD_AutoWriteOverridesLock &lock,
69  const HUSD_FindPrims &prims,
70  bool active);
71  bool getVisibleOverrides(const UT_StringRef &primpath,
72  UT_StringMap<UT_StringHolder> &overrides) const;
73  bool setVisible(HUSD_AutoWriteOverridesLock &lock,
74  const HUSD_FindPrims &prims,
75  const HUSD_TimeCode &timecode,
76  bool visible);
77  bool getSelectableOverrides(const UT_StringRef &primpath,
78  UT_StringMap<bool> &overrides) const;
79  bool setSelectable(HUSD_AutoWriteOverridesLock &lock,
80  const HUSD_FindPrims &prims,
81  bool active, bool solo);
82  bool clearSelectable(HUSD_AutoWriteOverridesLock &lock);
83 
84  bool setSoloLights(HUSD_AutoWriteOverridesLock &lock,
85  const HUSD_FindPrims &prims);
86  bool addSoloLights(HUSD_AutoWriteOverridesLock &lock,
87  const HUSD_FindPrims &prims);
88  bool removeSoloLights(HUSD_AutoWriteOverridesLock &lock,
89  const HUSD_FindPrims &prims);
90  bool getSoloLights(HUSD_PathSet &paths) const;
91  bool setSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
92  const HUSD_FindPrims &prims);
93  bool addSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
94  const HUSD_FindPrims &prims);
95  bool removeSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
96  const HUSD_FindPrims &prims);
97  bool getSoloGeometry(HUSD_PathSet &paths) const;
98  bool showPurpose(HUSD_AutoWriteOverridesLock &lock,
99  const HUSD_FindPrims &prims,
100  const UT_StringRef &purpose);
101  bool setDisplayOpacity(HUSD_AutoWriteOverridesLock &lock,
102  const HUSD_FindPrims &prims,
103  const HUSD_TimeCode &timecode,
104  fpreal opacity);
105 
106  // Indicate that this override's data is being authored on a stage.
107  // We should only be locked to one XUSD_Data at a time, and we
108  // should always have a single unlock paired with each lock. The
109  // XUSD_Data pointer is passed to the unlock function only to
110  // verify this condition. When locked to an XUSD_Data, all requests
111  // to edit the owner overrides are applied to the stage's session
112  // layers directly. When unlocking, the stage's session layers are
113  // copied back into the layers stored in the myLayer array.
114  void lockToData(PXR_NS::XUSD_Data *data);
115  void unlockFromData(PXR_NS::XUSD_Data *data);
116 
117  PXR_NS::XUSD_OverridesData &data() const
118  { return *myData; }
119  exint versionId() const
120  { return myVersionId; }
121 
122 private:
124  exint myVersionId;
125 };
126 
127 #endif
128 
exint versionId() const
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
int64 exint
Definition: SYS_Types.h:125
#define HUSD_API
Definition: HUSD_API.h:32
PXR_NS::XUSD_OverridesData & data() const
A reference counter base class for use with UT_IntrusivePtr.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
HUSD_OverridesLayerId
Definition: HUSD_Utils.h:73
static const UT_StringHolder theEmptyString
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
fpreal64 fpreal
Definition: SYS_Types.h:277
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: format.h:895
GLenum src
Definition: glcorearb.h:1793