HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniApexCharacterAPI.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_HOUDINIAPEXCHARACTERAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINIAPEXCHARACTERAPI_H
9 
10 /// \file usdHoudini/houdiniApexCharacterAPI.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 // HOUDINIAPEXCHARACTERAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniApexCharacterAPI
37 ///
38 /// Houdini API schema for a character that can be bound to an APEX
39 /// animation scene.
40 ///
41 /// USD primitives can be bound to the rig's geometry inputs and outputs via
42 /// the HoudiniApexShapeBindingAPI multiple-apply API schema.
43 ///
44 ///
45 class
48 {
49 public:
50  /// Compile time constant representing what kind of schema this class is.
51  ///
52  /// \sa UsdSchemaKind
53  static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
54 
55  /// Construct a UsdHoudiniHoudiniApexCharacterAPI on UsdPrim \p prim .
56  /// Equivalent to UsdHoudiniHoudiniApexCharacterAPI::Get(prim.GetStage(), prim.GetPath())
57  /// for a \em valid \p prim, but will not immediately throw an error for
58  /// an invalid \p prim
60  : UsdAPISchemaBase(prim)
61  {
62  }
63 
64  /// Construct a UsdHoudiniHoudiniApexCharacterAPI on the prim held by \p schemaObj .
65  /// Should be preferred over UsdHoudiniHoudiniApexCharacterAPI(schemaObj.GetPrim()),
66  /// as it preserves SchemaBase state.
68  : UsdAPISchemaBase(schemaObj)
69  {
70  }
71 
72  /// Destructor.
73  virtual ~UsdHoudiniHoudiniApexCharacterAPI() override;
74 
75  /// Return a vector of names of all pre-declared attributes for this schema
76  /// class and all its ancestor classes. Does not include attributes that
77  /// may be authored by custom/extended methods of the schemas involved.
78  static const TfTokenVector &
79  GetSchemaAttributeNames(bool includeInherited=true);
80 
81  /// Return a UsdHoudiniHoudiniApexCharacterAPI holding the prim adhering to this
82  /// schema at \p path on \p stage. If no prim exists at \p path on
83  /// \p stage, or if the prim at that path does not adhere to this schema,
84  /// return an invalid schema object. This is shorthand for the following:
85  ///
86  /// \code
87  /// UsdHoudiniHoudiniApexCharacterAPI(stage->GetPrimAtPath(path));
88  /// \endcode
89  ///
91  Get(const UsdStagePtr &stage, const SdfPath &path);
92 
93 
94  /// Returns true if this <b>single-apply</b> API schema can be applied to
95  /// the given \p prim. If this schema can not be a applied to the prim,
96  /// this returns false and, if provided, populates \p whyNot with the
97  /// reason it can not be applied.
98  ///
99  /// Note that if CanApply returns false, that does not necessarily imply
100  /// that calling Apply will fail. Callers are expected to call CanApply
101  /// before calling Apply if they want to ensure that it is valid to
102  /// apply a schema.
103  ///
104  /// \sa UsdPrim::GetAppliedSchemas()
105  /// \sa UsdPrim::HasAPI()
106  /// \sa UsdPrim::CanApplyAPI()
107  /// \sa UsdPrim::ApplyAPI()
108  /// \sa UsdPrim::RemoveAPI()
109  ///
110  static bool
111  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
112 
113  /// Applies this <b>single-apply</b> API schema to the given \p prim.
114  /// This information is stored by adding "HoudiniApexCharacterAPI" to the
115  /// token-valued, listOp metadata \em apiSchemas on the prim.
116  ///
117  /// \return A valid UsdHoudiniHoudiniApexCharacterAPI object is returned upon success.
118  /// An invalid (or empty) UsdHoudiniHoudiniApexCharacterAPI object is returned upon
119  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
120  /// resulting in failure.
121  ///
122  /// \sa UsdPrim::GetAppliedSchemas()
123  /// \sa UsdPrim::HasAPI()
124  /// \sa UsdPrim::CanApplyAPI()
125  /// \sa UsdPrim::ApplyAPI()
126  /// \sa UsdPrim::RemoveAPI()
127  ///
129  Apply(const UsdPrim &prim);
130 
131 protected:
132  /// Returns the kind of schema this class belongs to.
133  ///
134  /// \sa UsdSchemaKind
135  UsdSchemaKind _GetSchemaKind() const override;
136 
137 private:
138  // needs to invoke _GetStaticTfType.
139  friend class UsdSchemaRegistry;
140  static const TfType &_GetStaticTfType();
141 
142  static bool _IsTypedSchema();
143 
144  // override SchemaBase virtuals.
145  const TfType &_GetTfType() const override;
146 
147 public:
148  // --------------------------------------------------------------------- //
149  // FILES
150  // --------------------------------------------------------------------- //
151  /// List of geometry files to merge into the APEX scene under the
152  /// character's path. These typically contain the rig, skeleton,
153  /// controls, etc for the character.
154  ///
155  /// | ||
156  /// | -- | -- |
157  /// | Declaration | `uniform asset[] houdini:apex:character:files = []` |
158  /// | C++ Type | VtArray<SdfAssetPath> |
159  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->AssetArray |
160  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
161  UsdAttribute GetFilesAttr() const;
162 
163  /// See GetFilesAttr(), and also
164  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
165  /// If specified, author \p defaultValue as the attribute's default,
166  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
167  /// the default for \p writeSparsely is \c false.
168  UsdAttribute CreateFilesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
169 
170 public:
171  // --------------------------------------------------------------------- //
172  // RIG
173  // --------------------------------------------------------------------- //
174  /// Specifies which rig to use for the character (for example,
175  /// "Base.rig"). If not specified, the first character element matching
176  /// '*.rig' is used.
177  ///
178  ///
179  /// | ||
180  /// | -- | -- |
181  /// | Declaration | `uniform string houdini:apex:character:rig = ""` |
182  /// | C++ Type | std::string |
183  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
184  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
185  UsdAttribute GetRigAttr() const;
186 
187  /// See GetRigAttr(), and also
188  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
189  /// If specified, author \p defaultValue as the attribute's default,
190  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
191  /// the default for \p writeSparsely is \c false.
192  UsdAttribute CreateRigAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
193 
194 public:
195  // ===================================================================== //
196  // Feel free to add custom code below this line, it will be preserved by
197  // the code generator.
198  //
199  // Just remember to:
200  // - Close the class declaration with };
201  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
202  // - Close the include guard with #endif
203  // ===================================================================== //
204  // --(BEGIN CUSTOM CODE)--
205 };
206 
208 
209 #endif
#define USDHOUDINI_API
Definition: api.h:23
UsdHoudiniHoudiniApexCharacterAPI(const UsdSchemaBase &schemaObj)
Single Apply API schema.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdHoudiniHoudiniApexCharacterAPI(const UsdPrim &prim=UsdPrim())
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:280
UsdSchemaKind
Definition: common.h:112
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
Definition: value.h:89