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 
78  bool setSoloLights(HUSD_AutoWriteOverridesLock &lock,
79  const HUSD_FindPrims &prims);
80  bool addSoloLights(HUSD_AutoWriteOverridesLock &lock,
81  const HUSD_FindPrims &prims);
82  bool removeSoloLights(HUSD_AutoWriteOverridesLock &lock,
83  const HUSD_FindPrims &prims);
84  bool getSoloLights(HUSD_PathSet &paths) const;
85  bool setSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
86  const HUSD_FindPrims &prims);
87  bool addSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
88  const HUSD_FindPrims &prims);
89  bool removeSoloGeometry(HUSD_AutoWriteOverridesLock &lock,
90  const HUSD_FindPrims &prims);
91  bool getSoloGeometry(HUSD_PathSet &paths) const;
92  bool setDisplayOpacity(HUSD_AutoWriteOverridesLock &lock,
93  const HUSD_FindPrims &prims,
94  const HUSD_TimeCode &timecode,
95  fpreal opacity);
96 
97  // Indicate that this override's data is being authored on a stage.
98  // We should only be locked to one XUSD_Data at a time, and we
99  // should always have a single unlock paired with each lock. The
100  // XUSD_Data pointer is passed to the unlock function only to
101  // verify this condition. When locked to an XUSD_Data, all requests
102  // to edit the owner overrides are applied to the stage's session
103  // layers directly. When unlocking, the stage's session layers are
104  // copied back into the layers stored in the myLayer array.
105  void lockToData(PXR_NS::XUSD_Data *data);
106  void unlockFromData(PXR_NS::XUSD_Data *data);
107 
108  PXR_NS::XUSD_OverridesData &data() const
109  { return *myData; }
110  exint versionId() const
111  { return myVersionId; }
112 
113 private:
115  exint myVersionId;
116 };
117 
118 #endif
119 
exint versionId() const
GLenum src
Definition: glew.h:2410
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:33
HUSD_OverridesLayerId
Definition: HUSD_Utils.h:59
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
static const UT_StringHolder theEmptyString
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
fpreal64 fpreal
Definition: SYS_Types.h:277
OIIO_API bool copy(string_view from, string_view to, std::string &err)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:83
GLenum const void * paths
Definition: glew.h:13589