HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_ConfigurePrims.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_ConfigurePrims_h__
19 #define __HUSD_ConfigurePrims_h__
20 
21 #include "HUSD_API.h"
22 #include "HUSD_DataHandle.h"
23 #include "HUSD_TimeCode.h"
24 #include "HUSD_Utils.h"
25 #include <UT/UT_StringHolder.h>
26 
27 class HUSD_FindPrims;
28 
30 {
31 public:
34 
35  bool setType(const HUSD_FindPrims &findprims,
36  const UT_StringRef &primtype) const;
37  bool setSpecifier(const HUSD_FindPrims &findprims,
38  const UT_StringRef &specifier) const;
39  bool setActive(const HUSD_FindPrims &findprims,
40  bool active) const;
41  /// Forces the effective activation of a given set of prims by traversing
42  /// the prim hierarchy and manipulating ancestor prims' active status.
43  ///
44  /// This is somewhat akin to MakeVisible in UsdGeomImageable.
45  ///
46  /// As this can be used in a corrective context, it can optionally emit
47  /// a warning message if any maniption actually takes place.
48  ///
49  /// NOTE: Unlike the rest of the methods in this class, we do not accept
50  /// a HUSD_FindPrims as it will fail to actually find prims that have
51  /// inactive ancestors (this is by design in USD)
52  ///
53  /// NOTE: This function will not work if run while there is an active
54  /// Sdf change block (and there doesn't seem to be a way to check)
55  bool makePrimsAndAncestorsActive(
56  const HUSD_PathSet &pathset,
57  bool emit_warning_on_action = false) const;
58  bool setKind(const HUSD_FindPrims &findprims,
59  const UT_StringRef &kind) const;
60  bool fixKindHierarchy(const HUSD_FindPrims &findprims) const;
61  bool fixGprimHierarchy(const HUSD_FindPrims &findprims) const;
62  bool fixPrimvarInterpolation(const HUSD_FindPrims &findprims,
63  const UT_StringHolder &primvarPath) const;
64  bool setDrawMode(const HUSD_FindPrims &findprims,
65  const UT_StringRef &drawmode) const;
66  bool setApplyDrawMode(const HUSD_FindPrims &findprim,
67  bool apply) const;
68  bool setPurpose(const HUSD_FindPrims &findprims,
69  const UT_StringRef &purpose) const;
70  bool setProxy(const HUSD_FindPrims &findprims,
71  const UT_StringRef &proxy) const;
72  bool setInstanceable(const HUSD_FindPrims &findprims,
73  bool instanceable) const;
74  enum Visibility {
77  VISIBILITY_VISIBLE
78  };
79  bool setInvisible(const HUSD_FindPrims &findprims,
80  Visibility vis,
81  const HUSD_TimeCode &timecode,
82  bool ignore_time_varying_stage) const;
83  bool setVariantSelection(const HUSD_FindPrims &findprims,
84  const UT_StringRef &variantset,
85  const UT_StringRef &variant) const;
86 
87  enum Clear {
88  NO_CLEAR, // add a sample to existing ones
89  CLEAR // remove all the old samples
90  };
91  bool setComputedExtents(const HUSD_FindPrims &findprims,
92  const HUSD_TimeCode &timecode,
93  Clear clear,
94  HUSD_PathSet *overwrite_prims = nullptr) const;
95 
96  bool setAssetName(const HUSD_FindPrims &findprims,
97  const UT_StringRef &name) const;
98  bool setAssetIdentifier(const HUSD_FindPrims &findprims,
99  const UT_StringRef &identifier) const;
100  bool setAssetVersion(const HUSD_FindPrims &findprims,
101  const UT_StringRef &version) const;
102  bool setAssetDependencies(const HUSD_FindPrims &findprims,
103  const UT_StringArray &dependencies) const;
104  // This function sets the asset info on UsdModelAPI-enabled prims.
105  // The UtValueType parameters can be any of:
106  // bool
107  // int
108  // int64
109  // UT_Vector2i
110  // UT_Vector3i
111  // UT_Vector4i
112  // fpreal32
113  // fpreal64
114  // UT_Vector2F
115  // UT_Vector3F
116  // UT_Vector4F
117  // UT_QuaternionF
118  // UT_QuaternionH
119  // UT_Matrix3D
120  // UT_Matrix4D
121  // UT_StringHolder
122  // UT_Array<UT_StringHolder>
123  // HUSD_AssetPath
124  // UT_Array<HUSD_AssetPath>
125  // HUSD_Token
126  // UT_Array<HUSD_Token>
127  // Make sure to explicitly cast to one of these data types, even if
128  // implicit conversions exist.
129  template<typename UtValueType>
130  bool setAssetInfo(const HUSD_FindPrims &findprims,
131  const UT_StringRef &key,
132  const UtValueType &value) const;
133  bool removeAssetInfo(const HUSD_FindPrims &findprims,
134  const UT_StringRef &key) const;
135  bool clearAssetInfo(const HUSD_FindPrims &findprims) const;
136 
137  bool setEditable(const HUSD_FindPrims &findprims,
138  bool editable) const;
139  bool setSelectable(const HUSD_FindPrims &findprims,
140  bool selectable) const;
141  bool setHideInUi(const HUSD_FindPrims &findprims,
142  bool hide) const;
143 
144  bool addEditorNodeId(
145  const HUSD_FindPrims &findprims,
146  int nodeid) const;
147  bool clearEditorNodeIds(
148  const HUSD_FindPrims &findprims) const;
149 
150  bool applyAPI(const HUSD_FindPrims &findprims,
151  const UT_StringRef &schema) const;
152  bool applyAPI(const HUSD_FindPrims &findprims,
153  const UT_StringRef &schema,
154  UT_StringSet *failedapis) const;
155 
156  bool getIsTimeVarying() const;
157 
158 private:
159  HUSD_AutoWriteLock &myWriteLock;
160  mutable HUSD_TimeSampling myTimeSampling;
161 };
162 
163 #endif
164 
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_TimeSampling
Definition: HUSD_Utils.h:98
GLuint const GLchar * name
Definition: glcorearb.h:786
GT_API const UT_StringHolder version
Definition: core.h:1131