HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openVDBAsset.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_OPENVDBASSET_H
8 #define USDVOL_GENERATED_OPENVDBASSET_H
9 
10 /// \file usdVol/openVDBAsset.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 #include "pxr/usd/usdVol/tokens.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 // OPENVDBASSET //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdVolOpenVDBAsset
37 ///
38 /// OpenVDB field primitive. The FieldAsset filePath attribute must
39 /// specify a file in the OpenVDB format on disk.
40 ///
41 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
42 /// that are text/tokens, the actual token is published and defined in \ref UsdVolTokens.
43 /// So to set an attribute to the value "rightHanded", use UsdVolTokens->rightHanded
44 /// as the value.
45 ///
47 {
48 public:
49  /// Compile time constant representing what kind of schema this class is.
50  ///
51  /// \sa UsdSchemaKind
53 
54  /// Construct a UsdVolOpenVDBAsset on UsdPrim \p prim .
55  /// Equivalent to UsdVolOpenVDBAsset::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 UsdVolOpenVDBAsset(const UsdPrim& prim=UsdPrim())
59  : UsdVolFieldAsset(prim)
60  {
61  }
62 
63  /// Construct a UsdVolOpenVDBAsset on the prim held by \p schemaObj .
64  /// Should be preferred over UsdVolOpenVDBAsset(schemaObj.GetPrim()),
65  /// as it preserves SchemaBase state.
66  explicit UsdVolOpenVDBAsset(const UsdSchemaBase& schemaObj)
67  : UsdVolFieldAsset(schemaObj)
68  {
69  }
70 
71  /// Destructor.
73  virtual ~UsdVolOpenVDBAsset();
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 UsdVolOpenVDBAsset 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  /// UsdVolOpenVDBAsset(stage->GetPrimAtPath(path));
89  /// \endcode
90  ///
92  static UsdVolOpenVDBAsset
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  ///
117  USDVOL_API
118  static UsdVolOpenVDBAsset
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
125  USDVOL_API
126  UsdSchemaKind _GetSchemaKind() const override;
127 
128 private:
129  // needs to invoke _GetStaticTfType.
130  friend class UsdSchemaRegistry;
131  USDVOL_API
132  static const TfType &_GetStaticTfType();
133 
134  static bool _IsTypedSchema();
135 
136  // override SchemaBase virtuals.
137  USDVOL_API
138  const TfType &_GetTfType() const override;
139 
140 public:
141  // --------------------------------------------------------------------- //
142  // FIELDDATATYPE
143  // --------------------------------------------------------------------- //
144  /// Token which is used to indicate the data type of an
145  /// individual field. Authors use this to tell consumers more
146  /// about the field without opening the file on disk. The list of
147  /// allowed tokens reflects the available choices for OpenVDB
148  /// volumes.
149  ///
150  /// | ||
151  /// | -- | -- |
152  /// | Declaration | `token fieldDataType` |
153  /// | C++ Type | TfToken |
154  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
155  /// | \ref UsdVolTokens "Allowed Values" | half, float, double, int, uint, int64, half2, float2, double2, int2, half3, float3, double3, int3, matrix3d, matrix4d, quatd, bool, mask, string |
156  USDVOL_API
158 
159  /// See GetFieldDataTypeAttr(), and also
160  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
161  /// If specified, author \p defaultValue as the attribute's default,
162  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
163  /// the default for \p writeSparsely is \c false.
164  USDVOL_API
165  UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
166 
167 public:
168  // --------------------------------------------------------------------- //
169  // FIELDCLASS
170  // --------------------------------------------------------------------- //
171  /// Optional token which can be used to indicate the class of
172  /// an individual grid. This is a mapping to openvdb::GridClass
173  /// where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME,
174  /// GRID_STAGGERED, and GRID_UNKNOWN.
175  ///
176  /// | ||
177  /// | -- | -- |
178  /// | Declaration | `token fieldClass` |
179  /// | C++ Type | TfToken |
180  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
181  /// | \ref UsdVolTokens "Allowed Values" | levelSet, fogVolume, staggered, unknown |
182  USDVOL_API
184 
185  /// See GetFieldClassAttr(), 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.
190  USDVOL_API
191  UsdAttribute CreateFieldClassAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
192 
193 public:
194  // ===================================================================== //
195  // Feel free to add custom code below this line, it will be preserved by
196  // the code generator.
197  //
198  // Just remember to:
199  // - Close the class declaration with };
200  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
201  // - Close the include guard with #endif
202  // ===================================================================== //
203  // --(BEGIN CUSTOM CODE)--
204 };
205 
207 
208 #endif
virtual USDVOL_API ~UsdVolOpenVDBAsset()
Destructor.
USDVOL_API UsdAttribute GetFieldClassAttr() const
static const UsdSchemaKind schemaKind
Definition: openVDBAsset.h:52
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDVOL_API UsdVolOpenVDBAsset Get(const UsdStagePtr &stage, const SdfPath &path)
UsdVolOpenVDBAsset(const UsdSchemaBase &schemaObj)
Definition: openVDBAsset.h:66
USDVOL_API UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDVOL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USDVOL_API UsdAttribute CreateFieldClassAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Represents a concrete typed schema.
UsdVolOpenVDBAsset(const UsdPrim &prim=UsdPrim())
Definition: openVDBAsset.h:58
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDVOL_API UsdSchemaKind _GetSchemaKind() const override
static USDVOL_API UsdVolOpenVDBAsset Define(const UsdStagePtr &stage, const SdfPath &path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
#define USDVOL_API
Definition: api.h:23
Definition: value.h:146
USDVOL_API UsdAttribute GetFieldDataTypeAttr() const