HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
root.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_ROOT_H
8 #define USDSKEL_GENERATED_ROOT_H
9 
10 /// \file usdSkel/root.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 
18 #include "pxr/base/vt/value.h"
19 
20 #include "pxr/base/gf/vec3d.h"
21 #include "pxr/base/gf/vec3f.h"
22 #include "pxr/base/gf/matrix4d.h"
23 
24 #include "pxr/base/tf/token.h"
25 #include "pxr/base/tf/type.h"
26 
28 
29 class SdfAssetPath;
30 
31 // -------------------------------------------------------------------------- //
32 // SKELROOT //
33 // -------------------------------------------------------------------------- //
34 
35 /// \class UsdSkelRoot
36 ///
37 /// Boundable prim type used to identify a scope beneath which
38 /// skeletally-posed primitives are defined.
39 ///
40 /// A SkelRoot must be defined at or above a skinned primitive for any skinning
41 /// behaviors in UsdSkel.
42 ///
43 /// See the extended \ref UsdSkel_SkelRoot "Skel Root Schema" documentation for
44 /// more information.
45 ///
47 {
48 public:
49  /// Compile time constant representing what kind of schema this class is.
50  ///
51  /// \sa UsdSchemaKind
53 
54  /// Construct a UsdSkelRoot on UsdPrim \p prim .
55  /// Equivalent to UsdSkelRoot::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 UsdSkelRoot(const UsdPrim& prim=UsdPrim())
59  : UsdGeomBoundable(prim)
60  {
61  }
62 
63  /// Construct a UsdSkelRoot on the prim held by \p schemaObj .
64  /// Should be preferred over UsdSkelRoot(schemaObj.GetPrim()),
65  /// as it preserves SchemaBase state.
66  explicit UsdSkelRoot(const UsdSchemaBase& schemaObj)
67  : UsdGeomBoundable(schemaObj)
68  {
69  }
70 
71  /// Destructor.
73  virtual ~UsdSkelRoot();
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 UsdSkelRoot 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  /// UsdSkelRoot(stage->GetPrimAtPath(path));
89  /// \endcode
90  ///
92  static UsdSkelRoot
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 UsdSkelRoot
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  // Feel free to add custom code below this line, it will be preserved by
143  // the code generator.
144  //
145  // Just remember to:
146  // - Close the class declaration with };
147  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
148  // - Close the include guard with #endif
149  // ===================================================================== //
150  // --(BEGIN CUSTOM CODE)--
151 
152  /// Returns the skel root at or above \p prim, or an invalid schema object
153  /// if no ancestor prim is defined as a skel root.
155  static UsdSkelRoot Find(const UsdPrim& prim);
156 };
157 
159 
160 #endif
static USDSKEL_API UsdSkelRoot Find(const UsdPrim &prim)
USDSKEL_API UsdSchemaKind _GetSchemaKind() const override
static USDSKEL_API UsdSkelRoot Define(const UsdStagePtr &stage, const SdfPath &path)
static USDSKEL_API UsdSkelRoot Get(const UsdStagePtr &stage, const SdfPath &path)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdSkelRoot(const UsdSchemaBase &schemaObj)
Definition: root.h:66
static const UsdSchemaKind schemaKind
Definition: root.h:52
Represents a concrete typed schema.
static USDSKEL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
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
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual USDSKEL_API ~UsdSkelRoot()
Destructor.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
UsdSkelRoot(const UsdPrim &prim=UsdPrim())
Definition: root.h:58