HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
houdiniApexCharacterBindingAPI.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_HOUDINIAPEXCHARACTERBINDINGAPI_H
8 #define USDHOUDINI_GENERATED_HOUDINIAPEXCHARACTERBINDINGAPI_H
9 
10 /// \file usdHoudini/houdiniApexCharacterBindingAPI.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 // HOUDINIAPEXCHARACTERBINDINGAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdHoudiniHoudiniApexCharacterBindingAPI
37 ///
38 /// Houdini API schema for adding a character to an APEX animation
39 /// scene. This is intended for use with HoudiniApexScene prims.
40 ///
41 /// The schema's instance name (e.g. 'electra') is used as the character's
42 /// name in the APEX scene (e.g. '/electra.char')
43 ///
44 ///
45 class
48 {
49 public:
50  /// Compile time constant representing what kind of schema this class is.
51  ///
52  /// \sa UsdSchemaKind
54 
55  /// Construct a UsdHoudiniHoudiniApexCharacterBindingAPI on UsdPrim \p prim with
56  /// name \p name . Equivalent to
57  /// UsdHoudiniHoudiniApexCharacterBindingAPI::Get(
58  /// prim.GetStage(),
59  /// prim.GetPath().AppendProperty(
60  /// "character:name"));
61  ///
62  /// for a \em valid \p prim, but will not immediately throw an error for
63  /// an invalid \p prim
65  const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken())
66  : UsdAPISchemaBase(prim, /*instanceName*/ name)
67  { }
68 
69  /// Construct a UsdHoudiniHoudiniApexCharacterBindingAPI on the prim held by \p schemaObj with
70  /// name \p name. Should be preferred over
71  /// UsdHoudiniHoudiniApexCharacterBindingAPI(schemaObj.GetPrim(), name), as it preserves
72  /// SchemaBase state.
74  const UsdSchemaBase& schemaObj, const TfToken &name)
75  : UsdAPISchemaBase(schemaObj, /*instanceName*/ name)
76  { }
77 
78  /// Destructor.
79  virtual ~UsdHoudiniHoudiniApexCharacterBindingAPI() override;
80 
81  /// Return a vector of names of all pre-declared attributes for this schema
82  /// class and all its ancestor classes. Does not include attributes that
83  /// may be authored by custom/extended methods of the schemas involved.
84  static const TfTokenVector &
85  GetSchemaAttributeNames(bool includeInherited=true);
86 
87  /// Return a vector of names of all pre-declared attributes for this schema
88  /// class and all its ancestor classes for a given instance name. Does not
89  /// include attributes that may be authored by custom/extended methods of
90  /// the schemas involved. The names returned will have the proper namespace
91  /// prefix.
92  static TfTokenVector
93  GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName);
94 
95  /// Returns the name of this multiple-apply schema instance
96  TfToken GetName() const {
97  return _GetInstanceName();
98  }
99 
100  /// Return a UsdHoudiniHoudiniApexCharacterBindingAPI holding the prim adhering to this
101  /// schema at \p path on \p stage. If no prim exists at \p path on
102  /// \p stage, or if the prim at that path does not adhere to this schema,
103  /// return an invalid schema object. \p path must be of the format
104  /// <path>.character:name .
105  ///
106  /// This is shorthand for the following:
107  ///
108  /// \code
109  /// TfToken name = SdfPath::StripNamespace(path.GetToken());
110  /// UsdHoudiniHoudiniApexCharacterBindingAPI(
111  /// stage->GetPrimAtPath(path.GetPrimPath()), name);
112  /// \endcode
113  ///
115  Get(const UsdStagePtr &stage, const SdfPath &path);
116 
117  /// Return a UsdHoudiniHoudiniApexCharacterBindingAPI with name \p name holding the
118  /// prim \p prim. Shorthand for UsdHoudiniHoudiniApexCharacterBindingAPI(prim, name);
120  Get(const UsdPrim &prim, const TfToken &name);
121 
122  /// Return a vector of all named instances of UsdHoudiniHoudiniApexCharacterBindingAPI on the
123  /// given \p prim.
124  static std::vector<UsdHoudiniHoudiniApexCharacterBindingAPI>
125  GetAll(const UsdPrim &prim);
126 
127  /// Checks if the given name \p baseName is the base name of a property
128  /// of HoudiniApexCharacterBindingAPI.
129  static bool
130  IsSchemaPropertyBaseName(const TfToken &baseName);
131 
132  /// Checks if the given path \p path is of an API schema of type
133  /// HoudiniApexCharacterBindingAPI. If so, it stores the instance name of
134  /// the schema in \p name and returns true. Otherwise, it returns false.
135  static bool
136  IsHoudiniApexCharacterBindingAPIPath(const SdfPath &path, TfToken *name);
137 
138  /// Returns true if this <b>multiple-apply</b> API schema can be applied,
139  /// with the given instance name, \p name, to the given \p prim. If this
140  /// schema can not be a applied the prim, this returns false and, if
141  /// provided, populates \p whyNot with the reason it can not be applied.
142  ///
143  /// Note that if CanApply returns false, that does not necessarily imply
144  /// that calling Apply will fail. Callers are expected to call CanApply
145  /// before calling Apply if they want to ensure that it is valid to
146  /// apply a schema.
147  ///
148  /// \sa UsdPrim::GetAppliedSchemas()
149  /// \sa UsdPrim::HasAPI()
150  /// \sa UsdPrim::CanApplyAPI()
151  /// \sa UsdPrim::ApplyAPI()
152  /// \sa UsdPrim::RemoveAPI()
153  ///
154  static bool
155  CanApply(const UsdPrim &prim, const TfToken &name,
156  std::string *whyNot=nullptr);
157 
158  /// Applies this <b>multiple-apply</b> API schema to the given \p prim
159  /// along with the given instance name, \p name.
160  ///
161  /// This information is stored by adding "HoudiniApexCharacterBindingAPI:<i>name</i>"
162  /// to the token-valued, listOp metadata \em apiSchemas on the prim.
163  /// For example, if \p name is 'instance1', the token
164  /// 'HoudiniApexCharacterBindingAPI:instance1' is added to 'apiSchemas'.
165  ///
166  /// \return A valid UsdHoudiniHoudiniApexCharacterBindingAPI object is returned upon success.
167  /// An invalid (or empty) UsdHoudiniHoudiniApexCharacterBindingAPI object is returned upon
168  /// failure. See \ref UsdPrim::ApplyAPI() for
169  /// conditions resulting in failure.
170  ///
171  /// \sa UsdPrim::GetAppliedSchemas()
172  /// \sa UsdPrim::HasAPI()
173  /// \sa UsdPrim::CanApplyAPI()
174  /// \sa UsdPrim::ApplyAPI()
175  /// \sa UsdPrim::RemoveAPI()
176  ///
178  Apply(const UsdPrim &prim, const TfToken &name);
179 
180 protected:
181  /// Returns the kind of schema this class belongs to.
182  ///
183  /// \sa UsdSchemaKind
184  UsdSchemaKind _GetSchemaKind() const override;
185 
186 private:
187  // needs to invoke _GetStaticTfType.
188  friend class UsdSchemaRegistry;
189  static const TfType &_GetStaticTfType();
190 
191  static bool _IsTypedSchema();
192 
193  // override SchemaBase virtuals.
194  const TfType &_GetTfType() const override;
195 
196 public:
197  // --------------------------------------------------------------------- //
198  // RIG
199  // --------------------------------------------------------------------- //
200  /// Specifies which rig to use for the character (for example,
201  /// "Base.rig"). If authored, this value takes precedence over the
202  /// 'houdini:apex:character:rig' attribute from HoudiniApexCharacterAPI.
203  ///
204  ///
205  /// | ||
206  /// | -- | -- |
207  /// | Declaration | `uniform string rig = ""` |
208  /// | C++ Type | std::string |
209  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->String |
210  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
211  UsdAttribute GetRigAttr() const;
212 
213  /// See GetRigAttr(), and also
214  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
215  /// If specified, author \p defaultValue as the attribute's default,
216  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
217  /// the default for \p writeSparsely is \c false.
218  UsdAttribute CreateRigAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
219 
220 public:
221  // --------------------------------------------------------------------- //
222  // BINDING
223  // --------------------------------------------------------------------- //
224  /// Relationship specifying the character to bind to the scene (a
225  /// primitive with the HoudiniApexCharacterAPI schema).
226  ///
227  ///
228  UsdRelationship GetBindingRel() const;
229 
230  /// See GetBindingRel(), and also
231  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
232  UsdRelationship CreateBindingRel() const;
233 
234 public:
235  // ===================================================================== //
236  // Feel free to add custom code below this line, it will be preserved by
237  // the code generator.
238  //
239  // Just remember to:
240  // - Close the class declaration with };
241  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
242  // - Close the include guard with #endif
243  // ===================================================================== //
244  // --(BEGIN CUSTOM CODE)--
245 };
246 
248 
249 #endif
#define USDHOUDINI_API
Definition: api.h:23
TfToken GetName() const
Returns the name of this multiple-apply schema instance.
#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
UsdHoudiniHoudiniApexCharacterBindingAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
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
Definition: type.h:47
UsdHoudiniHoudiniApexCharacterBindingAPI(const UsdPrim &prim=UsdPrim(), const TfToken &name=TfToken())
Definition: value.h:89
Multiple Apply API Schema.