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  // Supported UT_ValueTypes can be found in HUSD_CustomData.h.
106  // Make sure to explicitly cast to one of these data types, even if
107  // implicit conversions exist.
108  template<typename UtValueType>
109  bool setAssetInfo(const HUSD_FindPrims &findprims,
110  const UT_StringRef &key,
111  const UtValueType &value) const;
112  bool removeAssetInfo(const HUSD_FindPrims &findprims,
113  const UT_StringRef &key) const;
114  bool clearAssetInfo(const HUSD_FindPrims &findprims) const;
115 
116  bool setEditable(const HUSD_FindPrims &findprims,
117  bool editable) const;
118  bool setSelectable(const HUSD_FindPrims &findprims,
119  bool selectable) const;
120  bool setHideInUi(const HUSD_FindPrims &findprims,
121  bool hide) const;
122 
123  bool addEditorNodeId(
124  const HUSD_FindPrims &findprims,
125  int nodeid) const;
126  bool clearEditorNodeIds(
127  const HUSD_FindPrims &findprims) const;
128 
129  bool applyAPI(const HUSD_FindPrims &findprims,
130  const UT_StringRef &schema) const;
131  bool applyAPI(const HUSD_FindPrims &findprims,
132  const UT_StringRef &schema,
133  UT_StringSet *failedapis) const;
134 
135  bool getIsTimeVarying() const;
136 
137 private:
138  HUSD_AutoWriteLock &myWriteLock;
139  mutable HUSD_TimeSampling myTimeSampling;
140 };
141 
142 #endif
143 
#define HUSD_API
Definition: HUSD_API.h:32
HUSD_TimeSampling
Definition: HUSD_Utils.h:99
GLuint const GLchar * name
Definition: glcorearb.h:786
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
GT_API const UT_StringHolder version
Definition: core.h:1131