HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniApexShapeBindingAPI.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USDHOUDINI_GENERATED_HOUDINIAPEXSHAPEBINDINGAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINIAPEXSHAPEBINDINGAPI_H
9 
10 /// \file usdHoudini/houdiniApexShapeBindingAPI.h
11 
12 #include "pxr/pxr.h"
13 #include "./api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "./tokens.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // HOUDINIAPEXSHAPEBINDINGAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniApexShapeBindingAPI
37 ///
38 /// Houdini API schema for binding a USD primitive to a geometry input
39 /// and/or output of an APEX character's rig. This is intended for use with
40 /// the HoudiniApexCharacterAPI schema.
41 ///
42 ///
43 class
46 {
47 public:
48  /// Compile time constant representing what kind of schema this class is.
49  ///
50  /// \sa UsdSchemaKind
52 
53  /// Construct a UsdHoudiniHoudiniApexShapeBindingAPI on UsdPrim \p prim with
54  /// name \p name . Equivalent to
55  /// UsdHoudiniHoudiniApexShapeBindingAPI::Get(
56  /// prim.GetStage(),
57  /// prim.GetPath().AppendProperty(
58  /// "houdini:apex:shape:name"));
59  ///
60  /// for a \em valid \p prim, but will not immediately throw an error for
61  /// an invalid \p prim
63  const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken())
64  : UsdAPISchemaBase(prim, /*instanceName*/ name)
65  { }
66 
67  /// Construct a UsdHoudiniHoudiniApexShapeBindingAPI on the prim held by \p schemaObj with
68  /// name \p name. Should be preferred over
69  /// UsdHoudiniHoudiniApexShapeBindingAPI(schemaObj.GetPrim(), name), as it preserves
70  /// SchemaBase state.
72  const UsdSchemaBase& schemaObj, const TfToken &name)
73  : UsdAPISchemaBase(schemaObj, /*instanceName*/ name)
74  { }
75 
76  /// Destructor.
77  virtual ~UsdHoudiniHoudiniApexShapeBindingAPI() override;
78 
79  /// Return a vector of names of all pre-declared attributes for this schema
80  /// class and all its ancestor classes. Does not include attributes that
81  /// may be authored by custom/extended methods of the schemas involved.
82  static const TfTokenVector &
83  GetSchemaAttributeNames(bool includeInherited=true);
84 
85  /// Return a vector of names of all pre-declared attributes for this schema
86  /// class and all its ancestor classes for a given instance name. Does not
87  /// include attributes that may be authored by custom/extended methods of
88  /// the schemas involved. The names returned will have the proper namespace
89  /// prefix.
90  static TfTokenVector
91  GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName);
92 
93  /// Returns the name of this multiple-apply schema instance
94  TfToken GetName() const {
95  return _GetInstanceName();
96  }
97 
98  /// Return a UsdHoudiniHoudiniApexShapeBindingAPI holding the prim adhering to this
99  /// schema at \p path on \p stage. If no prim exists at \p path on
100  /// \p stage, or if the prim at that path does not adhere to this schema,
101  /// return an invalid schema object. \p path must be of the format
102  /// <path>.houdini:apex:shape:name .
103  ///
104  /// This is shorthand for the following:
105  ///
106  /// \code
107  /// TfToken name = SdfPath::StripNamespace(path.GetToken());
108  /// UsdHoudiniHoudiniApexShapeBindingAPI(
109  /// stage->GetPrimAtPath(path.GetPrimPath()), name);
110  /// \endcode
111  ///
113  Get(const UsdStagePtr &stage, const SdfPath &path);
114 
115  /// Return a UsdHoudiniHoudiniApexShapeBindingAPI with name \p name holding the
116  /// prim \p prim. Shorthand for UsdHoudiniHoudiniApexShapeBindingAPI(prim, name);
118  Get(const UsdPrim &prim, const TfToken &name);
119 
120  /// Return a vector of all named instances of UsdHoudiniHoudiniApexShapeBindingAPI on the
121  /// given \p prim.
122  static std::vector<UsdHoudiniHoudiniApexShapeBindingAPI>
123  GetAll(const UsdPrim &prim);
124 
125  /// Checks if the given name \p baseName is the base name of a property
126  /// of HoudiniApexShapeBindingAPI.
127  static bool
128  IsSchemaPropertyBaseName(const TfToken &baseName);
129 
130  /// Checks if the given path \p path is of an API schema of type
131  /// HoudiniApexShapeBindingAPI. If so, it stores the instance name of
132  /// the schema in \p name and returns true. Otherwise, it returns false.
133  static bool
134  IsHoudiniApexShapeBindingAPIPath(const SdfPath &path, TfToken *name);
135 
136  /// Returns true if this <b>multiple-apply</b> API schema can be applied,
137  /// with the given instance name, \p name, to the given \p prim. If this
138  /// schema can not be a applied the prim, this returns false and, if
139  /// provided, populates \p whyNot with the reason it can not be applied.
140  ///
141  /// Note that if CanApply returns false, that does not necessarily imply
142  /// that calling Apply will fail. Callers are expected to call CanApply
143  /// before calling Apply if they want to ensure that it is valid to
144  /// apply a schema.
145  ///
146  /// \sa UsdPrim::GetAppliedSchemas()
147  /// \sa UsdPrim::HasAPI()
148  /// \sa UsdPrim::CanApplyAPI()
149  /// \sa UsdPrim::ApplyAPI()
150  /// \sa UsdPrim::RemoveAPI()
151  ///
152  static bool
153  CanApply(const UsdPrim &prim, const TfToken &name,
154  std::string *whyNot=nullptr);
155 
156  /// Applies this <b>multiple-apply</b> API schema to the given \p prim
157  /// along with the given instance name, \p name.
158  ///
159  /// This information is stored by adding "HoudiniApexShapeBindingAPI:<i>name</i>"
160  /// to the token-valued, listOp metadata \em apiSchemas on the prim.
161  /// For example, if \p name is 'instance1', the token
162  /// 'HoudiniApexShapeBindingAPI:instance1' is added to 'apiSchemas'.
163  ///
164  /// \return A valid UsdHoudiniHoudiniApexShapeBindingAPI object is returned upon success.
165  /// An invalid (or empty) UsdHoudiniHoudiniApexShapeBindingAPI object is returned upon
166  /// failure. See \ref UsdPrim::ApplyAPI() for
167  /// conditions resulting in failure.
168  ///
169  /// \sa UsdPrim::GetAppliedSchemas()
170  /// \sa UsdPrim::HasAPI()
171  /// \sa UsdPrim::CanApplyAPI()
172  /// \sa UsdPrim::ApplyAPI()
173  /// \sa UsdPrim::RemoveAPI()
174  ///
176  Apply(const UsdPrim &prim, const TfToken &name);
177 
178 protected:
179  /// Returns the kind of schema this class belongs to.
180  ///
181  /// \sa UsdSchemaKind
182  UsdSchemaKind _GetSchemaKind() const override;
183 
184 private:
185  // needs to invoke _GetStaticTfType.
186  friend class UsdSchemaRegistry;
187  static const TfType &_GetStaticTfType();
188 
189  static bool _IsTypedSchema();
190 
191  // override SchemaBase virtuals.
192  const TfType &_GetTfType() const override;
193 
194 public:
195  // --------------------------------------------------------------------- //
196  // INPUT
197  // --------------------------------------------------------------------- //
198  /// Optional name of a rig input to bind the primitive to.
199  ///
200  /// | ||
201  /// | -- | -- |
202  /// | Declaration | `uniform string input = ""` |
203  /// | C++ Type | std::string |
204  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
205  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
206  UsdAttribute GetInputAttr() const;
207 
208  /// See GetInputAttr(), and also
209  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
210  /// If specified, author \p defaultValue as the attribute's default,
211  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
212  /// the default for \p writeSparsely is \c false.
213  UsdAttribute CreateInputAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
214 
215 public:
216  // --------------------------------------------------------------------- //
217  // OUTPUT
218  // --------------------------------------------------------------------- //
219  /// Optional name of a rig output which deforms the primitive.
220  ///
221  /// | ||
222  /// | -- | -- |
223  /// | Declaration | `uniform string output = ""` |
224  /// | C++ Type | std::string |
225  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
226  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
227  UsdAttribute GetOutputAttr() const;
228 
229  /// See GetOutputAttr(), and also
230  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
231  /// If specified, author \p defaultValue as the attribute's default,
232  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
233  /// the default for \p writeSparsely is \c false.
234  UsdAttribute CreateOutputAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
235 
236 public:
237  // --------------------------------------------------------------------- //
238  // BINDING
239  // --------------------------------------------------------------------- //
240  /// Relationship to a primitive that will be bound to an input or
241  /// output of the character's rig.
242  ///
243  ///
244  UsdRelationship GetBindingRel() const;
245 
246  /// See GetBindingRel(), and also
247  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
248  UsdRelationship CreateBindingRel() const;
249 
250 public:
251  // ===================================================================== //
252  // Feel free to add custom code below this line, it will be preserved by
253  // the code generator.
254  //
255  // Just remember to:
256  // - Close the class declaration with };
257  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
258  // - Close the include guard with #endif
259  // ===================================================================== //
260  // --(BEGIN CUSTOM CODE)--
261 };
262 
264 
265 #endif
#define USDHOUDINI_API
Definition: api.h:23
UsdHoudiniHoudiniApexShapeBindingAPI(const UsdPrim &prim=UsdPrim(), const TfToken &name=TfToken())
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
Definition: token.h:70
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:280
UsdSchemaKind
Definition: common.h:112
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
UsdHoudiniHoudiniApexShapeBindingAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
Definition: type.h:47
TfToken GetName() const
Returns the name of this multiple-apply schema instance.
Definition: value.h:89
Multiple Apply API Schema.