HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
skeleton.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 USDSKEL_GENERATED_SKELETON_H
8 #define USDSKEL_GENERATED_SKELETON_H
9 
10 /// \file usdSkel/skeleton.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdSkel/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "pxr/usd/usdSkel/tokens.h"
18 
20 
21 #include "pxr/base/vt/value.h"
22 
23 #include "pxr/base/gf/vec3d.h"
24 #include "pxr/base/gf/vec3f.h"
25 #include "pxr/base/gf/matrix4d.h"
26 
27 #include "pxr/base/tf/token.h"
28 #include "pxr/base/tf/type.h"
29 
31 
32 class SdfAssetPath;
33 
34 // -------------------------------------------------------------------------- //
35 // SKELETON //
36 // -------------------------------------------------------------------------- //
37 
38 /// \class UsdSkelSkeleton
39 ///
40 /// Describes a skeleton.
41 ///
42 /// See the extended \ref UsdSkel_Skeleton "Skeleton Schema" documentation for
43 /// more information.
44 ///
45 ///
47 {
48 public:
49  /// Compile time constant representing what kind of schema this class is.
50  ///
51  /// \sa UsdSchemaKind
53 
54  /// Construct a UsdSkelSkeleton on UsdPrim \p prim .
55  /// Equivalent to UsdSkelSkeleton::Get(prim.GetStage(), prim.GetPath())
56  /// for a \em valid \p prim, but will not immediately throw an error for
57  /// an invalid \p prim
58  explicit UsdSkelSkeleton(const UsdPrim& prim=UsdPrim())
59  : UsdGeomBoundable(prim)
60  {
61  }
62 
63  /// Construct a UsdSkelSkeleton on the prim held by \p schemaObj .
64  /// Should be preferred over UsdSkelSkeleton(schemaObj.GetPrim()),
65  /// as it preserves SchemaBase state.
66  explicit UsdSkelSkeleton(const UsdSchemaBase& schemaObj)
67  : UsdGeomBoundable(schemaObj)
68  {
69  }
70 
71  /// Destructor.
73  virtual ~UsdSkelSkeleton();
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.
79  static const TfTokenVector &
80  GetSchemaAttributeNames(bool includeInherited=true);
81 
82  /// Return a UsdSkelSkeleton holding the prim adhering to this
83  /// schema at \p path on \p stage. If no prim exists at \p path on
84  /// \p stage, or if the prim at that path does not adhere to this schema,
85  /// return an invalid schema object. This is shorthand for the following:
86  ///
87  /// \code
88  /// UsdSkelSkeleton(stage->GetPrimAtPath(path));
89  /// \endcode
90  ///
92  static UsdSkelSkeleton
93  Get(const UsdStagePtr &stage, const SdfPath &path);
94 
95  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
96  /// is defined (according to UsdPrim::IsDefined()) on this stage.
97  ///
98  /// If a prim adhering to this schema at \p path is already defined on this
99  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
100  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
101  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
102  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
103  /// current EditTarget for any nonexistent, or existing but not \a Defined
104  /// ancestors.
105  ///
106  /// The given \a path must be an absolute prim path that does not contain
107  /// any variant selections.
108  ///
109  /// If it is impossible to author any of the necessary PrimSpecs, (for
110  /// example, in case \a path cannot map to the current UsdEditTarget's
111  /// namespace) issue an error and return an invalid \a UsdPrim.
112  ///
113  /// Note that this method may return a defined prim whose typeName does not
114  /// specify this schema class, in case a stronger typeName opinion overrides
115  /// the opinion at the current EditTarget.
116  ///
118  static UsdSkelSkeleton
119  Define(const UsdStagePtr &stage, const SdfPath &path);
120 
121 protected:
122  /// Returns the kind of schema this class belongs to.
123  ///
124  /// \sa UsdSchemaKind
126  UsdSchemaKind _GetSchemaKind() const override;
127 
128 private:
129  // needs to invoke _GetStaticTfType.
130  friend class UsdSchemaRegistry;
132  static const TfType &_GetStaticTfType();
133 
134  static bool _IsTypedSchema();
135 
136  // override SchemaBase virtuals.
138  const TfType &_GetTfType() const override;
139 
140 public:
141  // --------------------------------------------------------------------- //
142  // JOINTS
143  // --------------------------------------------------------------------- //
144  /// An array of path tokens identifying the set of joints that make
145  /// up the skeleton, and their order. Each token in the array must be valid
146  /// when parsed as an SdfPath. The parent-child relationships of the
147  /// corresponding paths determine the parent-child relationships of each
148  /// joint. It is not required that the name at the end of each path be
149  /// unique, but rather only that the paths themselves be unique.
150  ///
151  /// | ||
152  /// | -- | -- |
153  /// | Declaration | `uniform token[] joints` |
154  /// | C++ Type | VtArray<TfToken> |
155  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
156  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
158  UsdAttribute GetJointsAttr() const;
159 
160  /// See GetJointsAttr(), and also
161  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
162  /// If specified, author \p defaultValue as the attribute's default,
163  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
164  /// the default for \p writeSparsely is \c false.
166  UsdAttribute CreateJointsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
167 
168 public:
169  // --------------------------------------------------------------------- //
170  // JOINTNAMES
171  // --------------------------------------------------------------------- //
172  /// If authored, provides a unique name per joint. This may be
173  /// optionally set to provide better names when translating to DCC apps
174  /// that require unique joint names.
175  ///
176  /// | ||
177  /// | -- | -- |
178  /// | Declaration | `uniform token[] jointNames` |
179  /// | C++ Type | VtArray<TfToken> |
180  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
181  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
184 
185  /// See GetJointNamesAttr(), and also
186  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
187  /// If specified, author \p defaultValue as the attribute's default,
188  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
189  /// the default for \p writeSparsely is \c false.
191  UsdAttribute CreateJointNamesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
192 
193 public:
194  // --------------------------------------------------------------------- //
195  // BINDTRANSFORMS
196  // --------------------------------------------------------------------- //
197  /// Specifies the bind-pose transforms of each joint in
198  /// **world space**, in the ordering imposed by *joints*.
199  ///
200  /// | ||
201  /// | -- | -- |
202  /// | Declaration | `uniform matrix4d[] bindTransforms` |
203  /// | C++ Type | VtArray<GfMatrix4d> |
204  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Matrix4dArray |
205  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
208 
209  /// See GetBindTransformsAttr(), and also
210  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
211  /// If specified, author \p defaultValue as the attribute's default,
212  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
213  /// the default for \p writeSparsely is \c false.
215  UsdAttribute CreateBindTransformsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
216 
217 public:
218  // --------------------------------------------------------------------- //
219  // RESTTRANSFORMS
220  // --------------------------------------------------------------------- //
221  /// Specifies the rest-pose transforms of each joint in
222  /// **local space**, in the ordering imposed by *joints*. This provides
223  /// fallback values for joint transforms when a Skeleton either has no
224  /// bound animation source, or when that animation source only contains
225  /// animation for a subset of a Skeleton's joints.
226  ///
227  /// | ||
228  /// | -- | -- |
229  /// | Declaration | `uniform matrix4d[] restTransforms` |
230  /// | C++ Type | VtArray<GfMatrix4d> |
231  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Matrix4dArray |
232  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
235 
236  /// See GetRestTransformsAttr(), and also
237  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
238  /// If specified, author \p defaultValue as the attribute's default,
239  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
240  /// the default for \p writeSparsely is \c false.
242  UsdAttribute CreateRestTransformsAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
243 
244 public:
245  // ===================================================================== //
246  // Feel free to add custom code below this line, it will be preserved by
247  // the code generator.
248  //
249  // Just remember to:
250  // - Close the class declaration with };
251  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
252  // - Close the include guard with #endif
253  // ===================================================================== //
254  // --(BEGIN CUSTOM CODE)--
255 };
256 
258 
259 #endif
UsdSkelSkeleton(const UsdSchemaBase &schemaObj)
Definition: skeleton.h:66
USDSKEL_API UsdAttribute CreateJointsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDSKEL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDSKEL_API UsdAttribute GetJointsAttr() const
static USDSKEL_API UsdSkelSkeleton Get(const UsdStagePtr &stage, const SdfPath &path)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDSKEL_API UsdAttribute CreateJointNamesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDSKEL_API UsdAttribute CreateBindTransformsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual USDSKEL_API ~UsdSkelSkeleton()
Destructor.
USDSKEL_API UsdAttribute GetJointNamesAttr() const
Represents a concrete typed schema.
USDSKEL_API UsdAttribute CreateRestTransformsAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
#define USDSKEL_API
Definition: api.h:23
Definition: path.h:273
static USDSKEL_API UsdSkelSkeleton Define(const UsdStagePtr &stage, const SdfPath &path)
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDSKEL_API UsdSchemaKind _GetSchemaKind() const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
UsdSkelSkeleton(const UsdPrim &prim=UsdPrim())
Definition: skeleton.h:58
static const UsdSchemaKind schemaKind
Definition: skeleton.h:52
USDSKEL_API UsdAttribute GetRestTransformsAttr() const
Definition: value.h:146
USDSKEL_API UsdAttribute GetBindTransformsAttr() const