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 Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef USDVOL_GENERATED_FIELDASSET_H
25 #define USDVOL_GENERATED_FIELDASSET_H
26 
27 /// \file usdVol/fieldAsset.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdVol/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdVol/tokens.h"
35 
36 #include "pxr/base/vt/value.h"
37 
38 #include "pxr/base/gf/vec3d.h"
39 #include "pxr/base/gf/vec3f.h"
40 #include "pxr/base/gf/matrix4d.h"
41 
42 #include "pxr/base/tf/token.h"
43 #include "pxr/base/tf/type.h"
44 
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // FIELDASSET //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdVolFieldAsset
54 ///
55 /// Base class for field primitives defined by an external file.
56 ///
57 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
58 /// that are text/tokens, the actual token is published and defined in \ref UsdVolTokens.
59 /// So to set an attribute to the value "rightHanded", use UsdVolTokens->rightHanded
60 /// as the value.
61 ///
63 {
64 public:
65  /// Compile time constant representing what kind of schema this class is.
66  ///
67  /// \sa UsdSchemaKind
69 
70  /// Construct a UsdVolFieldAsset on UsdPrim \p prim .
71  /// Equivalent to UsdVolFieldAsset::Get(prim.GetStage(), prim.GetPath())
72  /// for a \em valid \p prim, but will not immediately throw an error for
73  /// an invalid \p prim
74  explicit UsdVolFieldAsset(const UsdPrim& prim=UsdPrim())
75  : UsdVolFieldBase(prim)
76  {
77  }
78 
79  /// Construct a UsdVolFieldAsset on the prim held by \p schemaObj .
80  /// Should be preferred over UsdVolFieldAsset(schemaObj.GetPrim()),
81  /// as it preserves SchemaBase state.
82  explicit UsdVolFieldAsset(const UsdSchemaBase& schemaObj)
83  : UsdVolFieldBase(schemaObj)
84  {
85  }
86 
87  /// Destructor.
89  virtual ~UsdVolFieldAsset();
90 
91  /// Return a vector of names of all pre-declared attributes for this schema
92  /// class and all its ancestor classes. Does not include attributes that
93  /// may be authored by custom/extended methods of the schemas involved.
95  static const TfTokenVector &
96  GetSchemaAttributeNames(bool includeInherited=true);
97 
98  /// Return a UsdVolFieldAsset holding the prim adhering to this
99  /// schema at \p path on \p stage. If no prim exists at \p path on
100  /// \p stage, or if the prim at that path does not adhere to this schema,
101  /// return an invalid schema object. This is shorthand for the following:
102  ///
103  /// \code
104  /// UsdVolFieldAsset(stage->GetPrimAtPath(path));
105  /// \endcode
106  ///
107  USDVOL_API
108  static UsdVolFieldAsset
109  Get(const UsdStagePtr &stage, const SdfPath &path);
110 
111 
112 protected:
113  /// Returns the kind of schema this class belongs to.
114  ///
115  /// \sa UsdSchemaKind
116  USDVOL_API
117  UsdSchemaKind _GetSchemaKind() const override;
118 
119 private:
120  // needs to invoke _GetStaticTfType.
121  friend class UsdSchemaRegistry;
122  USDVOL_API
123  static const TfType &_GetStaticTfType();
124 
125  static bool _IsTypedSchema();
126 
127  // override SchemaBase virtuals.
128  USDVOL_API
129  const TfType &_GetTfType() const override;
130 
131 public:
132  // --------------------------------------------------------------------- //
133  // FILEPATH
134  // --------------------------------------------------------------------- //
135  /// An asset path attribute that points to a file on disk.
136  /// For each supported file format, a separate FieldAsset
137  /// subclass is required.
138  ///
139  /// This attribute's value can be animated over time, as most
140  /// volume asset formats represent just a single timeSample of
141  /// a volume. However, it does not, at this time, support
142  /// any pattern substitutions like "$F".
143  ///
144  /// | ||
145  /// | -- | -- |
146  /// | Declaration | `asset filePath` |
147  /// | C++ Type | SdfAssetPath |
148  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Asset |
149  USDVOL_API
151 
152  /// See GetFilePathAttr(), and also
153  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
154  /// If specified, author \p defaultValue as the attribute's default,
155  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
156  /// the default for \p writeSparsely is \c false.
157  USDVOL_API
158  UsdAttribute CreateFilePathAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
159 
160 public:
161  // --------------------------------------------------------------------- //
162  // FIELDNAME
163  // --------------------------------------------------------------------- //
164  /// Name of an individual field within the file specified by
165  /// the filePath attribute.
166  ///
167  /// | ||
168  /// | -- | -- |
169  /// | Declaration | `token fieldName` |
170  /// | C++ Type | TfToken |
171  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
172  USDVOL_API
174 
175  /// See GetFieldNameAttr(), and also
176  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
177  /// If specified, author \p defaultValue as the attribute's default,
178  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
179  /// the default for \p writeSparsely is \c false.
180  USDVOL_API
181  UsdAttribute CreateFieldNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
182 
183 public:
184  // --------------------------------------------------------------------- //
185  // FIELDINDEX
186  // --------------------------------------------------------------------- //
187  /// A file can contain multiple fields with the same
188  /// name. This optional attribute is an index used to
189  /// disambiguate between these multiple fields with the same
190  /// name.
191  ///
192  /// | ||
193  /// | -- | -- |
194  /// | Declaration | `int fieldIndex` |
195  /// | C++ Type | int |
196  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Int |
197  USDVOL_API
199 
200  /// See GetFieldIndexAttr(), and also
201  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
202  /// If specified, author \p defaultValue as the attribute's default,
203  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
204  /// the default for \p writeSparsely is \c false.
205  USDVOL_API
206  UsdAttribute CreateFieldIndexAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
207 
208 public:
209  // --------------------------------------------------------------------- //
210  // FIELDDATATYPE
211  // --------------------------------------------------------------------- //
212  /// Token which is used to indicate the data type of an
213  /// individual field. Authors use this to tell consumers more
214  /// about the field without opening the file on disk. The list of
215  /// allowed tokens is specified with the specific asset type.
216  /// A missing value is considered an error.
217  ///
218  /// | ||
219  /// | -- | -- |
220  /// | Declaration | `token fieldDataType` |
221  /// | C++ Type | TfToken |
222  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
223  USDVOL_API
225 
226  /// See GetFieldDataTypeAttr(), and also
227  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
228  /// If specified, author \p defaultValue as the attribute's default,
229  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
230  /// the default for \p writeSparsely is \c false.
231  USDVOL_API
232  UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
233 
234 public:
235  // --------------------------------------------------------------------- //
236  // VECTORDATAROLEHINT
237  // --------------------------------------------------------------------- //
238  /// Optional token which is used to indicate the role of a vector
239  /// valued field. This can drive the data type in which fields
240  /// are made available in a renderer or whether the vector values
241  /// are to be transformed.
242  ///
243  /// | ||
244  /// | -- | -- |
245  /// | Declaration | `token vectorDataRoleHint = "None"` |
246  /// | C++ Type | TfToken |
247  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
248  /// | \ref UsdVolTokens "Allowed Values" | None, Point, Normal, Vector, Color |
249  USDVOL_API
251 
252  /// See GetVectorDataRoleHintAttr(), and also
253  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
254  /// If specified, author \p defaultValue as the attribute's default,
255  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
256  /// the default for \p writeSparsely is \c false.
257  USDVOL_API
258  UsdAttribute CreateVectorDataRoleHintAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
259 
260 public:
261  // ===================================================================== //
262  // Feel free to add custom code below this line, it will be preserved by
263  // the code generator.
264  //
265  // Just remember to:
266  // - Close the class declaration with };
267  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
268  // - Close the include guard with #endif
269  // ===================================================================== //
270  // --(BEGIN CUSTOM CODE)--
271 };
272 
274 
275 #endif
USDVOL_API UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdVolFieldAsset(const UsdPrim &prim=UsdPrim())
Definition: fieldAsset.h:74
virtual USDVOL_API ~UsdVolFieldAsset()
Destructor.
UsdVolFieldAsset(const UsdSchemaBase &schemaObj)
Definition: fieldAsset.h:82
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:68
Definition: prim.h:133
USDVOL_API UsdAttribute GetFieldDataTypeAttr() const
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457
Definition: path.h:290
USDVOL_API UsdAttribute CreateFieldIndexAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdSchemaKind
Definition: common.h:129
USDVOL_API UsdAttribute GetFieldIndexAttr() const
USDVOL_API UsdAttribute GetFilePathAttr() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
USDVOL_API UsdAttribute CreateVectorDataRoleHintAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
USDVOL_API UsdAttribute CreateFieldNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: type.h:64
#define USDVOL_API
Definition: api.h:40
Definition: value.h:164
USDVOL_API UsdAttribute GetVectorDataRoleHintAttr() const
USDVOL_API UsdAttribute GetFieldNameAttr() const