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 ///
58 {
59 public:
60  /// Compile time constant representing what kind of schema this class is.
61  ///
62  /// \sa UsdSchemaType
64 
65  /// Construct a UsdVolFieldAsset on UsdPrim \p prim .
66  /// Equivalent to UsdVolFieldAsset::Get(prim.GetStage(), prim.GetPath())
67  /// for a \em valid \p prim, but will not immediately throw an error for
68  /// an invalid \p prim
69  explicit UsdVolFieldAsset(const UsdPrim& prim=UsdPrim())
70  : UsdVolFieldBase(prim)
71  {
72  }
73 
74  /// Construct a UsdVolFieldAsset on the prim held by \p schemaObj .
75  /// Should be preferred over UsdVolFieldAsset(schemaObj.GetPrim()),
76  /// as it preserves SchemaBase state.
77  explicit UsdVolFieldAsset(const UsdSchemaBase& schemaObj)
78  : UsdVolFieldBase(schemaObj)
79  {
80  }
81 
82  /// Destructor.
84  virtual ~UsdVolFieldAsset();
85 
86  /// Return a vector of names of all pre-declared attributes for this schema
87  /// class and all its ancestor classes. Does not include attributes that
88  /// may be authored by custom/extended methods of the schemas involved.
90  static const TfTokenVector &
91  GetSchemaAttributeNames(bool includeInherited=true);
92 
93  /// Return a UsdVolFieldAsset holding the prim adhering to this
94  /// schema at \p path on \p stage. If no prim exists at \p path on
95  /// \p stage, or if the prim at that path does not adhere to this schema,
96  /// return an invalid schema object. This is shorthand for the following:
97  ///
98  /// \code
99  /// UsdVolFieldAsset(stage->GetPrimAtPath(path));
100  /// \endcode
101  ///
102  USDVOL_API
103  static UsdVolFieldAsset
104  Get(const UsdStagePtr &stage, const SdfPath &path);
105 
106 
107 protected:
108  /// Returns the type of schema this class belongs to.
109  ///
110  /// \sa UsdSchemaType
111  USDVOL_API
112  UsdSchemaType _GetSchemaType() const override;
113 
114 private:
115  // needs to invoke _GetStaticTfType.
116  friend class UsdSchemaRegistry;
117  USDVOL_API
118  static const TfType &_GetStaticTfType();
119 
120  static bool _IsTypedSchema();
121 
122  // override SchemaBase virtuals.
123  USDVOL_API
124  const TfType &_GetTfType() const override;
125 
126 public:
127  // --------------------------------------------------------------------- //
128  // FILEPATH
129  // --------------------------------------------------------------------- //
130  /// An asset path attribute that points to a file on disk.
131  /// For each supported file format, a separate FieldAsset
132  /// subclass is required. Any further information required to
133  /// extract the field from the file (such as a name or index to
134  /// choose a single field from a file that can store multiple
135  /// fields) will be defined on the FieldAsset subclass.
136  ///
137  /// This attribute's value can be animated over time, as most
138  /// volume asset formats represent just a single timeSample of
139  /// a volume. However, it does not, at this time, support
140  /// any pattern substitutions like "$F".
141  ///
142  /// | ||
143  /// | -- | -- |
144  /// | Declaration | `asset filePath` |
145  /// | C++ Type | SdfAssetPath |
146  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Asset |
147  USDVOL_API
149 
150  /// See GetFilePathAttr(), and also
151  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
152  /// If specified, author \p defaultValue as the attribute's default,
153  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
154  /// the default for \p writeSparsely is \c false.
155  USDVOL_API
156  UsdAttribute CreateFilePathAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
157 
158 public:
159  // ===================================================================== //
160  // Feel free to add custom code below this line, it will be preserved by
161  // the code generator.
162  //
163  // Just remember to:
164  // - Close the class declaration with };
165  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
166  // - Close the include guard with #endif
167  // ===================================================================== //
168  // --(BEGIN CUSTOM CODE)--
169 };
170 
172 
173 #endif
UsdVolFieldAsset(const UsdPrim &prim=UsdPrim())
Definition: fieldAsset.h:69
virtual USDVOL_API ~UsdVolFieldAsset()
Destructor.
UsdVolFieldAsset(const UsdSchemaBase &schemaObj)
Definition: fieldAsset.h:77
USDVOL_API UsdAttribute CreateFilePathAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDVOL_API UsdVolFieldAsset Get(const UsdStagePtr &stage, const SdfPath &path)
static USDVOL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
UsdSchemaType
Definition: common.h:127
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
Represents a non-concrete typed schema.
static const UsdSchemaType schemaType
Definition: fieldAsset.h:63
Definition: path.h:288
GLsizei const GLchar *const * path
Definition: glew.h:6461
USDVOL_API UsdAttribute GetFilePathAttr() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
USDVOL_API UsdSchemaType _GetSchemaType() const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
#define USDVOL_API
Definition: api.h:40
Definition: value.h:174