HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_CvexBindingMap.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_CvexBindingMap__
19 #define __HUSD_CvexBindingMap__
20 
21 #include "HUSD_API.h"
22 #include <UT/UT_StringMap.h>
23 class OP_Node;
24 
26 {
27 public:
28  /// Convenience function for building the map from node's parameters.
29  /// The parameters are assumed to have 1-base index (ie, default).
30  static HUSD_CvexBindingMap
31  constructBindingsMap( const OP_Node &node,
32  const char *bindings_num_parm,
33  const char *cvex_parm_name_parm,
34  const char *usd_attrib_name_parm,
35  const char *usd_attrib_type_parm,
36  const char *auto_bind_parm,
37  const char *bound_output_mask_parm);
38 
39  /// Add an entry to the map.
40  void addBinding( const UT_StringHolder &parm_name,
41  const UT_StringHolder &attrib_name,
42  const UT_StringHolder &attrib_type = UT_StringHolder());
43 
44  /// Specify if attrib name can be used as parm name.
45  void setDefaultToIdentity( bool do_identity );
46 
47  /// Specify the mask for bound output parms.
48  void setBoundOutputMask( const UT_StringRef &mask );
49  void clearBoundOutputMask();
50 
51  /// Obtain the attribute name for the given cvex parameter name.
52  UT_StringHolder getAttribFromParm( const UT_StringRef &parm ) const;
53 
54  /// Obtain the requested attribute type for the given cvex parameter name.
55  UT_StringHolder getAttribTypeFromParm( const UT_StringRef &parm ) const;
56 
57  /// Returns true if the given parameter is allowed to be bound for output.
58  /// Ie, whether the computed VEX export parameter value should be actually
59  /// transfered to the bound attribute on the USD primitive.
60  bool isOutBoundParm( const UT_StringRef &parm ) const;
61 
62 private:
63  UT_StringMap<UT_StringHolder> myAttribFromParm;
64  UT_StringMap<UT_StringHolder> myAttribTypeFromParm;
65  bool myDefaultToIdentity = true;
66  bool myHasBoundOutputMask = false;
67  UT_StringHolder myBoundOutputMask;
68 };
69 
70 
71 #endif
72 
#define HUSD_API
Definition: HUSD_API.h:32
GLint GLuint mask
Definition: glcorearb.h:124