HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fieldAsset.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_FIELDASSET_H
8 #define USDVOL_GENERATED_FIELDASSET_H
9 
10 /// \file usdVol/fieldAsset.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 // FIELDASSET //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdVolFieldAsset
37 ///
38 /// Base class for field primitives defined by an external file.
39 ///
40 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
41 /// that are text/tokens, the actual token is published and defined in \ref UsdVolTokens.
42 /// So to set an attribute to the value "rightHanded", use UsdVolTokens->rightHanded
43 /// as the value.
44 ///
46 {
47 public:
48  /// Compile time constant representing what kind of schema this class is.
49  ///
50  /// \sa UsdSchemaKind
52 
53  /// Construct a UsdVolFieldAsset on UsdPrim \p prim .
54  /// Equivalent to UsdVolFieldAsset::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 UsdVolFieldAsset(const UsdPrim& prim=UsdPrim())
58  : UsdVolFieldBase(prim)
59  {
60  }
61 
62  /// Construct a UsdVolFieldAsset on the prim held by \p schemaObj .
63  /// Should be preferred over UsdVolFieldAsset(schemaObj.GetPrim()),
64  /// as it preserves SchemaBase state.
65  explicit UsdVolFieldAsset(const UsdSchemaBase& schemaObj)
66  : UsdVolFieldBase(schemaObj)
67  {
68  }
69 
70  /// Destructor.
72  virtual ~UsdVolFieldAsset();
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 UsdVolFieldAsset 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  /// UsdVolFieldAsset(stage->GetPrimAtPath(path));
88  /// \endcode
89  ///
91  static UsdVolFieldAsset
92  Get(const UsdStagePtr &stage, const SdfPath &path);
93 
94 
95 protected:
96  /// Returns the kind of schema this class belongs to.
97  ///
98  /// \sa UsdSchemaKind
100  UsdSchemaKind _GetSchemaKind() const override;
101 
102 private:
103  // needs to invoke _GetStaticTfType.
104  friend class UsdSchemaRegistry;
105  USDVOL_API
106  static const TfType &_GetStaticTfType();
107 
108  static bool _IsTypedSchema();
109 
110  // override SchemaBase virtuals.
111  USDVOL_API
112  const TfType &_GetTfType() const override;
113 
114 public:
115  // --------------------------------------------------------------------- //
116  // FILEPATH
117  // --------------------------------------------------------------------- //
118  /// An asset path attribute that points to a file on disk.
119  /// For each supported file format, a separate FieldAsset
120  /// subclass is required.
121  ///
122  /// This attribute's value can be animated over time, as most
123  /// volume asset formats represent just a single timeSample of
124  /// a volume. However, it does not, at this time, support
125  /// any pattern substitutions like "$F".
126  ///
127  /// | ||
128  /// | -- | -- |
129  /// | Declaration | `asset filePath` |
130  /// | C++ Type | SdfAssetPath |
131  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Asset |
132  USDVOL_API
134 
135  /// See GetFilePathAttr(), and also
136  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
137  /// If specified, author \p defaultValue as the attribute's default,
138  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
139  /// the default for \p writeSparsely is \c false.
140  USDVOL_API
141  UsdAttribute CreateFilePathAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
142 
143 public:
144  // --------------------------------------------------------------------- //
145  // FIELDNAME
146  // --------------------------------------------------------------------- //
147  /// Name of an individual field within the file specified by
148  /// the filePath attribute.
149  ///
150  /// | ||
151  /// | -- | -- |
152  /// | Declaration | `token fieldName` |
153  /// | C++ Type | TfToken |
154  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
155  USDVOL_API
157 
158  /// See GetFieldNameAttr(), and also
159  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
160  /// If specified, author \p defaultValue as the attribute's default,
161  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
162  /// the default for \p writeSparsely is \c false.
163  USDVOL_API
164  UsdAttribute CreateFieldNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
165 
166 public:
167  // --------------------------------------------------------------------- //
168  // FIELDINDEX
169  // --------------------------------------------------------------------- //
170  /// A file can contain multiple fields with the same
171  /// name. This optional attribute is an index used to
172  /// disambiguate between these multiple fields with the same
173  /// name.
174  ///
175  /// | ||
176  /// | -- | -- |
177  /// | Declaration | `int fieldIndex` |
178  /// | C++ Type | int |
179  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
180  USDVOL_API
182 
183  /// See GetFieldIndexAttr(), and also
184  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
185  /// If specified, author \p defaultValue as the attribute's default,
186  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
187  /// the default for \p writeSparsely is \c false.
188  USDVOL_API
189  UsdAttribute CreateFieldIndexAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
190 
191 public:
192  // --------------------------------------------------------------------- //
193  // FIELDDATATYPE
194  // --------------------------------------------------------------------- //
195  /// Token which is used to indicate the data type of an
196  /// individual field. Authors use this to tell consumers more
197  /// about the field without opening the file on disk. The list of
198  /// allowed tokens is specified with the specific asset type.
199  /// A missing value is considered an error.
200  ///
201  /// | ||
202  /// | -- | -- |
203  /// | Declaration | `token fieldDataType` |
204  /// | C++ Type | TfToken |
205  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
206  USDVOL_API
208 
209  /// See GetFieldDataTypeAttr(), and also
210  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
211  /// If specified, author \p defaultValue as the attribute's default,
212  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
213  /// the default for \p writeSparsely is \c false.
214  USDVOL_API
215  UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
216 
217 public:
218  // --------------------------------------------------------------------- //
219  // VECTORDATAROLEHINT
220  // --------------------------------------------------------------------- //
221  /// Optional token which is used to indicate the role of a vector
222  /// valued field. This can drive the data type in which fields
223  /// are made available in a renderer or whether the vector values
224  /// are to be transformed.
225  ///
226  /// | ||
227  /// | -- | -- |
228  /// | Declaration | `token vectorDataRoleHint = "None"` |
229  /// | C++ Type | TfToken |
230  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
231  /// | \ref UsdVolTokens "Allowed Values" | None, Point, Normal, Vector, Color |
232  USDVOL_API
234 
235  /// See GetVectorDataRoleHintAttr(), and also
236  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
237  /// If specified, author \p defaultValue as the attribute's default,
238  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
239  /// the default for \p writeSparsely is \c false.
240  USDVOL_API
241  UsdAttribute CreateVectorDataRoleHintAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
242 
243 public:
244  // ===================================================================== //
245  // Feel free to add custom code below this line, it will be preserved by
246  // the code generator.
247  //
248  // Just remember to:
249  // - Close the class declaration with };
250  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
251  // - Close the include guard with #endif
252  // ===================================================================== //
253  // --(BEGIN CUSTOM CODE)--
254 };
255 
257 
258 #endif
USDVOL_API UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdVolFieldAsset(const UsdPrim &prim=UsdPrim())
Definition: fieldAsset.h:57
virtual USDVOL_API ~UsdVolFieldAsset()
Destructor.
UsdVolFieldAsset(const UsdSchemaBase &schemaObj)
Definition: fieldAsset.h:65
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDVOL_API UsdAttribute CreateFilePathAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDVOL_API UsdSchemaKind _GetSchemaKind() const override
static USDVOL_API UsdVolFieldAsset Get(const UsdStagePtr &stage, const SdfPath &path)
static USDVOL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Represents a non-concrete typed schema.
static const UsdSchemaKind schemaKind
Definition: fieldAsset.h:51
Definition: prim.h:116
USDVOL_API UsdAttribute GetFieldDataTypeAttr() const
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
USDVOL_API UsdAttribute CreateFieldIndexAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdSchemaKind
Definition: common.h:112
USDVOL_API UsdAttribute GetFieldIndexAttr() const
USDVOL_API UsdAttribute GetFilePathAttr() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDVOL_API UsdAttribute CreateVectorDataRoleHintAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDVOL_API UsdAttribute CreateFieldNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: type.h:47
#define USDVOL_API
Definition: api.h:23
Definition: value.h:146
USDVOL_API UsdAttribute GetVectorDataRoleHintAttr() const
USDVOL_API UsdAttribute GetFieldNameAttr() const