HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
field3DAsset.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_FIELD3DASSET_H
8 #define USDVOL_GENERATED_FIELD3DASSET_H
9 
10 /// \file usdVol/field3DAsset.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 // FIELD3DASSET //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdVolField3DAsset
37 ///
38 /// Field3D field primitive. The FieldAsset filePath attribute must
39 /// specify a file in the Field3D 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 UsdVolField3DAsset on UsdPrim \p prim .
55  /// Equivalent to UsdVolField3DAsset::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 UsdVolField3DAsset(const UsdPrim& prim=UsdPrim())
59  : UsdVolFieldAsset(prim)
60  {
61  }
62 
63  /// Construct a UsdVolField3DAsset on the prim held by \p schemaObj .
64  /// Should be preferred over UsdVolField3DAsset(schemaObj.GetPrim()),
65  /// as it preserves SchemaBase state.
66  explicit UsdVolField3DAsset(const UsdSchemaBase& schemaObj)
67  : UsdVolFieldAsset(schemaObj)
68  {
69  }
70 
71  /// Destructor.
73  virtual ~UsdVolField3DAsset();
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 UsdVolField3DAsset 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  /// UsdVolField3DAsset(stage->GetPrimAtPath(path));
89  /// \endcode
90  ///
92  static UsdVolField3DAsset
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 UsdVolField3DAsset
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 Field3d
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, half3, float3, double3 |
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  // FIELDPURPOSE
170  // --------------------------------------------------------------------- //
171  /// Optional token which can be used to indicate the purpose or
172  /// grouping of an individual field. Clients which consume Field3D
173  /// files should treat this as the Field3D field \em name.
174  ///
175  /// | ||
176  /// | -- | -- |
177  /// | Declaration | `token fieldPurpose` |
178  /// | C++ Type | TfToken |
179  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
180  USDVOL_API
182 
183  /// See GetFieldPurposeAttr(), 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 CreateFieldPurposeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
190 
191 public:
192  // ===================================================================== //
193  // Feel free to add custom code below this line, it will be preserved by
194  // the code generator.
195  //
196  // Just remember to:
197  // - Close the class declaration with };
198  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
199  // - Close the include guard with #endif
200  // ===================================================================== //
201  // --(BEGIN CUSTOM CODE)--
202 };
203 
205 
206 #endif
virtual USDVOL_API ~UsdVolField3DAsset()
Destructor.
static USDVOL_API UsdVolField3DAsset Define(const UsdStagePtr &stage, const SdfPath &path)
static const UsdSchemaKind schemaKind
Definition: field3DAsset.h:52
UsdVolField3DAsset(const UsdPrim &prim=UsdPrim())
Definition: field3DAsset.h:58
static USDVOL_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDVOL_API UsdAttribute GetFieldDataTypeAttr() const
USDVOL_API UsdAttribute CreateFieldPurposeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDVOL_API UsdAttribute CreateFieldDataTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
UsdVolField3DAsset(const UsdSchemaBase &schemaObj)
Definition: field3DAsset.h:66
static USDVOL_API UsdVolField3DAsset Get(const UsdStagePtr &stage, const SdfPath &path)
Represents a concrete typed schema.
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
USDVOL_API UsdAttribute GetFieldPurposeAttr() const
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#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 UsdSchemaKind _GetSchemaKind() const override