HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
filteredPairsAPI.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_FILTEREDPAIRSAPI_H
8 #define USDPHYSICS_GENERATED_FILTEREDPAIRSAPI_H
9 
10 /// \file usdPhysics/filteredPairsAPI.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"
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 // PHYSICSFILTEREDPAIRSAPI //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdPhysicsFilteredPairsAPI
37 ///
38 /// API to describe fine-grained filtering. If a collision between
39 /// two objects occurs, this pair might be filtered if the pair is defined
40 /// through this API. This API can be applied either to a body or collision
41 /// or even articulation. The "filteredPairs" defines what objects it should
42 /// not collide against. Note that FilteredPairsAPI filtering has precedence
43 /// over CollisionGroup filtering.
44 ///
46 {
47 public:
48  /// Compile time constant representing what kind of schema this class is.
49  ///
50  /// \sa UsdSchemaKind
52 
53  /// Construct a UsdPhysicsFilteredPairsAPI on UsdPrim \p prim .
54  /// Equivalent to UsdPhysicsFilteredPairsAPI::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
57  explicit UsdPhysicsFilteredPairsAPI(const UsdPrim& prim=UsdPrim())
58  : UsdAPISchemaBase(prim)
59  {
60  }
61 
62  /// Construct a UsdPhysicsFilteredPairsAPI on the prim held by \p schemaObj .
63  /// Should be preferred over UsdPhysicsFilteredPairsAPI(schemaObj.GetPrim()),
64  /// as it preserves SchemaBase state.
65  explicit UsdPhysicsFilteredPairsAPI(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 UsdPhysicsFilteredPairsAPI 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  /// UsdPhysicsFilteredPairsAPI(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 "PhysicsFilteredPairsAPI" to the
117  /// token-valued, listOp metadata \em apiSchemas on the prim.
118  ///
119  /// \return A valid UsdPhysicsFilteredPairsAPI object is returned upon success.
120  /// An invalid (or empty) UsdPhysicsFilteredPairsAPI 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  // FILTEREDPAIRS
156  // --------------------------------------------------------------------- //
157  /// Relationship to objects that should be filtered.
158  ///
161 
162  /// See GetFilteredPairsRel(), and also
163  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
166 
167 public:
168  // ===================================================================== //
169  // Feel free to add custom code below this line, it will be preserved by
170  // the code generator.
171  //
172  // Just remember to:
173  // - Close the class declaration with };
174  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
175  // - Close the include guard with #endif
176  // ===================================================================== //
177  // --(BEGIN CUSTOM CODE)--
178 };
179 
181 
182 #endif
Single Apply API schema.
static USDPHYSICS_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdPhysicsFilteredPairsAPI(const UsdPrim &prim=UsdPrim())
static const UsdSchemaKind schemaKind
USDPHYSICS_API UsdRelationship CreateFilteredPairsRel() const
static USDPHYSICS_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
static USDPHYSICS_API UsdPhysicsFilteredPairsAPI Apply(const UsdPrim &prim)
#define USDPHYSICS_API
Definition: api.h:23
UsdSchemaKind
Definition: common.h:112
USDPHYSICS_API UsdSchemaKind _GetSchemaKind() const override
UsdPhysicsFilteredPairsAPI(const UsdSchemaBase &schemaObj)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static USDPHYSICS_API UsdPhysicsFilteredPairsAPI Get(const UsdStagePtr &stage, const SdfPath &path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
USDPHYSICS_API UsdRelationship GetFilteredPairsRel() const
virtual USDPHYSICS_API ~UsdPhysicsFilteredPairsAPI()
Destructor.