HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
particleFieldKernelBaseAPI.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 USDVOL_GENERATED_PARTICLEFIELDKERNELBASEAPI_H
8 #define USDVOL_GENERATED_PARTICLEFIELDKERNELBASEAPI_H
9 
10 /// \file usdVol/particleFieldKernelBaseAPI.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdVol/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 // PARTICLEFIELDKERNELBASEAPI //
33 // -------------------------------------------------------------------------- //
34 
35 /// \class UsdVolParticleFieldKernelBaseAPI
36 ///
37 /// Defines a base-class type applied schema that all applied schema
38 /// that provide a ParticleField kernel will automatically apply.
39 /// The ParticleField kernel defines the spatial basis function for each
40 /// particle.
41 /// The purpose of this base class is to allow validation to enforce
42 /// that a kernel definition is present for a ParticleField
43 ///
45 {
46 public:
47  /// Compile time constant representing what kind of schema this class is.
48  ///
49  /// \sa UsdSchemaKind
51 
52  /// Construct a UsdVolParticleFieldKernelBaseAPI on UsdPrim \p prim .
53  /// Equivalent to UsdVolParticleFieldKernelBaseAPI::Get(prim.GetStage(), prim.GetPath())
54  /// for a \em valid \p prim, but will not immediately throw an error for
55  /// an invalid \p prim
57  : UsdAPISchemaBase(prim)
58  {
59  }
60 
61  /// Construct a UsdVolParticleFieldKernelBaseAPI on the prim held by \p schemaObj .
62  /// Should be preferred over UsdVolParticleFieldKernelBaseAPI(schemaObj.GetPrim()),
63  /// as it preserves SchemaBase state.
65  : UsdAPISchemaBase(schemaObj)
66  {
67  }
68 
69  /// Destructor.
72 
73  /// Return a vector of names of all pre-declared attributes for this schema
74  /// class and all its ancestor classes. Does not include attributes that
75  /// may be authored by custom/extended methods of the schemas involved.
77  static const TfTokenVector &
78  GetSchemaAttributeNames(bool includeInherited=true);
79 
80  /// Return a UsdVolParticleFieldKernelBaseAPI holding the prim adhering to this
81  /// schema at \p path on \p stage. If no prim exists at \p path on
82  /// \p stage, or if the prim at that path does not adhere to this schema,
83  /// return an invalid schema object. This is shorthand for the following:
84  ///
85  /// \code
86  /// UsdVolParticleFieldKernelBaseAPI(stage->GetPrimAtPath(path));
87  /// \endcode
88  ///
91  Get(const UsdStagePtr &stage, const SdfPath &path);
92 
93 
94  /// Returns true if this <b>single-apply</b> API schema can be applied to
95  /// the given \p prim. If this schema can not be a applied to the prim,
96  /// this returns false and, if provided, populates \p whyNot with the
97  /// reason it can not be applied.
98  ///
99  /// Note that if CanApply returns false, that does not necessarily imply
100  /// that calling Apply will fail. Callers are expected to call CanApply
101  /// before calling Apply if they want to ensure that it is valid to
102  /// apply a schema.
103  ///
104  /// \sa UsdPrim::GetAppliedSchemas()
105  /// \sa UsdPrim::HasAPI()
106  /// \sa UsdPrim::CanApplyAPI()
107  /// \sa UsdPrim::ApplyAPI()
108  /// \sa UsdPrim::RemoveAPI()
109  ///
110  USDVOL_API
111  static bool
112  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
113 
114  /// Applies this <b>single-apply</b> API schema to the given \p prim.
115  /// This information is stored by adding "ParticleFieldKernelBaseAPI" to the
116  /// token-valued, listOp metadata \em apiSchemas on the prim.
117  ///
118  /// \return A valid UsdVolParticleFieldKernelBaseAPI object is returned upon success.
119  /// An invalid (or empty) UsdVolParticleFieldKernelBaseAPI object is returned upon
120  /// failure. See \ref UsdPrim::ApplyAPI() for conditions
121  /// resulting in failure.
122  ///
123  /// \sa UsdPrim::GetAppliedSchemas()
124  /// \sa UsdPrim::HasAPI()
125  /// \sa UsdPrim::CanApplyAPI()
126  /// \sa UsdPrim::ApplyAPI()
127  /// \sa UsdPrim::RemoveAPI()
128  ///
129  USDVOL_API
131  Apply(const UsdPrim &prim);
132 
133 protected:
134  /// Returns the kind of schema this class belongs to.
135  ///
136  /// \sa UsdSchemaKind
137  USDVOL_API
138  UsdSchemaKind _GetSchemaKind() const override;
139 
140 private:
141  // needs to invoke _GetStaticTfType.
142  friend class UsdSchemaRegistry;
143  USDVOL_API
144  static const TfType &_GetStaticTfType();
145 
146  static bool _IsTypedSchema();
147 
148  // override SchemaBase virtuals.
149  USDVOL_API
150  const TfType &_GetTfType() const override;
151 
152 public:
153  // ===================================================================== //
154  // Feel free to add custom code below this line, it will be preserved by
155  // the code generator.
156  //
157  // Just remember to:
158  // - Close the class declaration with };
159  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
160  // - Close the include guard with #endif
161  // ===================================================================== //
162  // --(BEGIN CUSTOM CODE)--
163 };
164 
166 
167 #endif
Single Apply API schema.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static USDVOL_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDVOL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDVOL_API UsdSchemaKind _GetSchemaKind() const override
static USDVOL_API UsdVolParticleFieldKernelBaseAPI Get(const UsdStagePtr &stage, const SdfPath &path)
UsdVolParticleFieldKernelBaseAPI(const UsdPrim &prim=UsdPrim())
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:280
virtual USDVOL_API ~UsdVolParticleFieldKernelBaseAPI()
Destructor.
UsdSchemaKind
Definition: common.h:112
UsdVolParticleFieldKernelBaseAPI(const UsdSchemaBase &schemaObj)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
static USDVOL_API UsdVolParticleFieldKernelBaseAPI Apply(const UsdPrim &prim)
#define USDVOL_API
Definition: api.h:23