HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
articulationRootAPI.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 USDPHYSICS_GENERATED_ARTICULATIONROOTAPI_H
8 #define USDPHYSICS_GENERATED_ARTICULATIONROOTAPI_H
9 
10 /// \file usdPhysics/articulationRootAPI.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdPhysics/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 // PHYSICSARTICULATIONROOTAPI //
33 // -------------------------------------------------------------------------- //
34 
35 /// \class UsdPhysicsArticulationRootAPI
36 ///
37 /// PhysicsArticulationRootAPI can be applied to a scene graph node,
38 /// and marks the subtree rooted here for inclusion in one or more reduced
39 /// coordinate articulations. For floating articulations, this should be on
40 /// the root body. For fixed articulations (robotics jargon for e.g. a robot
41 /// arm for welding that is bolted to the floor), this API can be on a direct
42 /// or indirect parent of the root joint which is connected to the world, or
43 /// on the joint itself..
44 ///
46 {
47 public:
48  /// Compile time constant representing what kind of schema this class is.
49  ///
50  /// \sa UsdSchemaKind
52 
53  /// Construct a UsdPhysicsArticulationRootAPI on UsdPrim \p prim .
54  /// Equivalent to UsdPhysicsArticulationRootAPI::Get(prim.GetStage(), prim.GetPath())
55  /// for a \em valid \p prim, but will not immediately throw an error for
56  /// an invalid \p prim
58  : UsdAPISchemaBase(prim)
59  {
60  }
61 
62  /// Construct a UsdPhysicsArticulationRootAPI on the prim held by \p schemaObj .
63  /// Should be preferred over UsdPhysicsArticulationRootAPI(schemaObj.GetPrim()),
64  /// as it preserves SchemaBase state.
65  explicit UsdPhysicsArticulationRootAPI(const UsdSchemaBase& schemaObj)
66  : UsdAPISchemaBase(schemaObj)
67  {
68  }
69 
70  /// Destructor.
73 
74  /// Return a vector of names of all pre-declared attributes for this schema
75  /// class and all its ancestor classes. Does not include attributes that
76  /// may be authored by custom/extended methods of the schemas involved.
78  static const TfTokenVector &
79  GetSchemaAttributeNames(bool includeInherited=true);
80 
81  /// Return a UsdPhysicsArticulationRootAPI 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  /// UsdPhysicsArticulationRootAPI(stage->GetPrimAtPath(path));
88  /// \endcode
89  ///
92  Get(const UsdStagePtr &stage, const SdfPath &path);
93 
94 
95  /// Returns true if this <b>single-apply</b> API schema can be applied to
96  /// the given \p prim. If this schema can not be a applied to the prim,
97  /// this returns false and, if provided, populates \p whyNot with the
98  /// reason it can not be applied.
99  ///
100  /// Note that if CanApply returns false, that does not necessarily imply
101  /// that calling Apply will fail. Callers are expected to call CanApply
102  /// before calling Apply if they want to ensure that it is valid to
103  /// apply a schema.
104  ///
105  /// \sa UsdPrim::GetAppliedSchemas()
106  /// \sa UsdPrim::HasAPI()
107  /// \sa UsdPrim::CanApplyAPI()
108  /// \sa UsdPrim::ApplyAPI()
109  /// \sa UsdPrim::RemoveAPI()
110  ///
112  static bool
113  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
114 
115  /// Applies this <b>single-apply</b> API schema to the given \p prim.
116  /// This information is stored by adding "PhysicsArticulationRootAPI" to the
117  /// token-valued, listOp metadata \em apiSchemas on the prim.
118  ///
119  /// \return A valid UsdPhysicsArticulationRootAPI object is returned upon success.
120  /// An invalid (or empty) UsdPhysicsArticulationRootAPI object is returned upon
121  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
122  /// resulting in failure.
123  ///
124  /// \sa UsdPrim::GetAppliedSchemas()
125  /// \sa UsdPrim::HasAPI()
126  /// \sa UsdPrim::CanApplyAPI()
127  /// \sa UsdPrim::ApplyAPI()
128  /// \sa UsdPrim::RemoveAPI()
129  ///
132  Apply(const UsdPrim &prim);
133 
134 protected:
135  /// Returns the kind of schema this class belongs to.
136  ///
137  /// \sa UsdSchemaKind
139  UsdSchemaKind _GetSchemaKind() const override;
140 
141 private:
142  // needs to invoke _GetStaticTfType.
143  friend class UsdSchemaRegistry;
145  static const TfType &_GetStaticTfType();
146 
147  static bool _IsTypedSchema();
148 
149  // override SchemaBase virtuals.
151  const TfType &_GetTfType() const override;
152 
153 public:
154  // ===================================================================== //
155  // Feel free to add custom code below this line, it will be preserved by
156  // the code generator.
157  //
158  // Just remember to:
159  // - Close the class declaration with };
160  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
161  // - Close the include guard with #endif
162  // ===================================================================== //
163  // --(BEGIN CUSTOM CODE)--
164 };
165 
167 
168 #endif
Single Apply API schema.
USDPHYSICS_API UsdSchemaKind _GetSchemaKind() const override
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDPHYSICS_API UsdPhysicsArticulationRootAPI Get(const UsdStagePtr &stage, const SdfPath &path)
UsdPhysicsArticulationRootAPI(const UsdPrim &prim=UsdPrim())
static USDPHYSICS_API UsdPhysicsArticulationRootAPI Apply(const UsdPrim &prim)
virtual USDPHYSICS_API ~UsdPhysicsArticulationRootAPI()
Destructor.
static const UsdSchemaKind schemaKind
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
#define USDPHYSICS_API
Definition: api.h:23
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static USDPHYSICS_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
UsdPhysicsArticulationRootAPI(const UsdSchemaBase &schemaObj)
static USDPHYSICS_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)