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 
40 class HUSD_PathSet;
41 class HUSD_TimeCode;
42 
43 class HUSD_API HUSD_Overrides : public UT_IntrusiveRefCounter<HUSD_Overrides>,
44  public UT_NonCopyable
45 {
46 public:
48  ~HUSD_Overrides();
49 
50  void save(std::ostream &os,
51  const UT_Array<HUSD_OverridesLayerId> &layerids) const;
52  bool load(UT_IStream &is);
53  void copy(const HUSD_Overrides &src);
54  bool isEmpty(const UT_Array<HUSD_OverridesLayerId> &layerids) const;
55  bool isEmpty(HUSD_OverridesLayerId layer_id) const;
56 
57  void clear(const UT_Array<HUSD_OverridesLayerId> &layerids,
58  const UT_StringRef &fromprim =
60  void clear(HUSD_OverridesLayerId layer_id,
61  const UT_StringRef &fromprim =
63 
64  bool getDrawModeOverrides(const UT_StringRef &primpath,
65  UT_StringMap<UT_StringHolder> &overrides) const;
66  bool setDrawMode(HUSD_AutoWriteOverridesLock &lock,
67  const HUSD_FindPrims &prims,
68  const UT_StringRef &drawmode);
69  bool getActiveOverrides(const UT_StringRef &primpath,
70  UT_StringMap<bool> &overrides) const;
71  bool setActive(HUSD_AutoWriteOverridesLock &lock,
72  const HUSD_FindPrims &prims,
73  bool active);
74  bool getVisibleOverrides(const UT_StringRef &primpath,
75  UT_StringMap<UT_StringHolder> &overrides) const;
76  bool setVisible(HUSD_AutoWriteOverridesLock &lock,
77  const HUSD_FindPrims &prims,
78  const HUSD_TimeCode &timecode,
79  bool visible);
80  bool getSelectableOverrides(const UT_StringRef &primpath,
81  UT_StringMap<bool> &overrides) const;
82  bool setSelectable(HUSD_AutoWriteOverridesLock &lock,
83  const HUSD_FindPrims &prims,
84  bool active, bool solo);
85  bool clearSelectable(HUSD_AutoWriteOverridesLock &lock);
86 
87  bool setSoloLights(HUSD_AutoWriteOverridesLock &lock,
88  const HUSD_FindPrims &prims);
89  bool addSoloLights(HUSD_AutoWriteOverridesLock &lock,
90  const HUSD_FindPrims &prims);
91  bool removeSoloLights(HUSD_AutoWriteOverridesLock &lock,
92  const HUSD_FindPrims &prims);
93  bool getSoloLights(HUSD_PathSet &paths) const;
94  bool setSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
95  const HUSD_FindPrims &prims);
96  bool addSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
97  const HUSD_FindPrims &prims);
98  bool removeSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
99  const HUSD_FindPrims &prims);
100  bool getSoloGeometry(HUSD_PathSet &paths) const;
101  bool showPurpose(HUSD_AutoWriteOverridesLock &lock,
102  const HUSD_FindPrims &prims,
103  const UT_StringRef &purpose);
104  bool setDisplayOpacity(HUSD_AutoWriteOverridesLock &lock,
105  const HUSD_FindPrims &prims,
106  const HUSD_TimeCode &timecode,
107  fpreal opacity);
108 
109  // Handle the expansion state auto-reveal. This may be implemented
110  // through various means, so the method names are being left
111  // intentionally vague.
112  bool setExpansionStateDrawMode(HUSD_AutoAnyLock &lock,
113  const HUSD_ExpansionState &expansionstate);
114  bool setExpansionStateVisibility(HUSD_AutoAnyLock &lock,
115  const HUSD_ExpansionState &expansionstate);
116 
117  // Indicate that this override's data is being authored on a stage.
118  // We should only be locked to one XUSD_Data at a time, and we
119  // should always have a single unlock paired with each lock. The
120  // XUSD_Data pointer is passed to the unlock function only to
121  // verify this condition. When locked to an XUSD_Data, all requests
122  // to edit the owner overrides are applied to the stage's session
123  // layers directly. When unlocking, the stage's session layers are
124  // copied back into the layers stored in the myLayer array.
125  void lockToData(PXR_NS::XUSD_Data *data);
126  void unlockFromData(PXR_NS::XUSD_Data *data);
127 
128  PXR_NS::XUSD_OverridesData &data() const
129  { return *myData; }
130  exint versionId() const
131  { return myVersionId; }
132 
133 private:
135  exint myVersionId;
136 };
137 
138 #endif
139 
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:31
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:79
static const UT_StringHolder theEmptyString
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
fpreal64 fpreal
Definition: SYS_Types.h:278
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: format.h:1821
GLenum src
Definition: glcorearb.h:1793