HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
product.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 USDRENDER_GENERATED_PRODUCT_H
25 #define USDRENDER_GENERATED_PRODUCT_H
26 
27 /// \file usdRender/product.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdRender/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.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 // RENDERPRODUCT //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdRenderProduct
54 ///
55 /// A UsdRenderProduct describes an image or other
56 /// file-like artifact produced by a render. A RenderProduct
57 /// combines one or more RenderVars into a file or interactive
58 /// buffer. It also provides all the controls established in
59 /// UsdRenderSettingsBase as optional overrides to whatever the
60 /// owning UsdRenderSettings prim dictates.
61 ///
62 /// Specific renderers may support additional settings, such
63 /// as a way to configure compression settings, filetype metadata,
64 /// and so forth. Such settings can be encoded using
65 /// renderer-specific API schemas applied to the product prim.
66 ///
67 ///
68 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
69 /// that are text/tokens, the actual token is published and defined in \ref UsdRenderTokens.
70 /// So to set an attribute to the value "rightHanded", use UsdRenderTokens->rightHanded
71 /// as the value.
72 ///
74 {
75 public:
76  /// Compile time constant representing what kind of schema this class is.
77  ///
78  /// \sa UsdSchemaKind
80 
81  /// Construct a UsdRenderProduct on UsdPrim \p prim .
82  /// Equivalent to UsdRenderProduct::Get(prim.GetStage(), prim.GetPath())
83  /// for a \em valid \p prim, but will not immediately throw an error for
84  /// an invalid \p prim
85  explicit UsdRenderProduct(const UsdPrim& prim=UsdPrim())
86  : UsdRenderSettingsBase(prim)
87  {
88  }
89 
90  /// Construct a UsdRenderProduct on the prim held by \p schemaObj .
91  /// Should be preferred over UsdRenderProduct(schemaObj.GetPrim()),
92  /// as it preserves SchemaBase state.
93  explicit UsdRenderProduct(const UsdSchemaBase& schemaObj)
94  : UsdRenderSettingsBase(schemaObj)
95  {
96  }
97 
98  /// Destructor.
100  virtual ~UsdRenderProduct();
101 
102  /// Return a vector of names of all pre-declared attributes for this schema
103  /// class and all its ancestor classes. Does not include attributes that
104  /// may be authored by custom/extended methods of the schemas involved.
106  static const TfTokenVector &
107  GetSchemaAttributeNames(bool includeInherited=true);
108 
109  /// Return a UsdRenderProduct holding the prim adhering to this
110  /// schema at \p path on \p stage. If no prim exists at \p path on
111  /// \p stage, or if the prim at that path does not adhere to this schema,
112  /// return an invalid schema object. This is shorthand for the following:
113  ///
114  /// \code
115  /// UsdRenderProduct(stage->GetPrimAtPath(path));
116  /// \endcode
117  ///
119  static UsdRenderProduct
120  Get(const UsdStagePtr &stage, const SdfPath &path);
121 
122  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
123  /// is defined (according to UsdPrim::IsDefined()) on this stage.
124  ///
125  /// If a prim adhering to this schema at \p path is already defined on this
126  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
127  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
128  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
129  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
130  /// current EditTarget for any nonexistent, or existing but not \a Defined
131  /// ancestors.
132  ///
133  /// The given \a path must be an absolute prim path that does not contain
134  /// any variant selections.
135  ///
136  /// If it is impossible to author any of the necessary PrimSpecs, (for
137  /// example, in case \a path cannot map to the current UsdEditTarget's
138  /// namespace) issue an error and return an invalid \a UsdPrim.
139  ///
140  /// Note that this method may return a defined prim whose typeName does not
141  /// specify this schema class, in case a stronger typeName opinion overrides
142  /// the opinion at the current EditTarget.
143  ///
145  static UsdRenderProduct
146  Define(const UsdStagePtr &stage, const SdfPath &path);
147 
148 protected:
149  /// Returns the kind of schema this class belongs to.
150  ///
151  /// \sa UsdSchemaKind
153  UsdSchemaKind _GetSchemaKind() const override;
154 
155 private:
156  // needs to invoke _GetStaticTfType.
157  friend class UsdSchemaRegistry;
159  static const TfType &_GetStaticTfType();
160 
161  static bool _IsTypedSchema();
162 
163  // override SchemaBase virtuals.
165  const TfType &_GetTfType() const override;
166 
167 public:
168  // --------------------------------------------------------------------- //
169  // PRODUCTTYPE
170  // --------------------------------------------------------------------- //
171  /// The type of output to produce.
172  /// The default, "raster", indicates a 2D image.
173  ///
174  ///
175  /// ote In the future, UsdRender may define additional product
176  /// types.
177  ///
178  /// | ||
179  /// | -- | -- |
180  /// | Declaration | `uniform token productType = "raster"` |
181  /// | C++ Type | TfToken |
182  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
183  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
186 
187  /// See GetProductTypeAttr(), and also
188  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
189  /// If specified, author \p defaultValue as the attribute's default,
190  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
191  /// the default for \p writeSparsely is \c false.
193  UsdAttribute CreateProductTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
194 
195 public:
196  // --------------------------------------------------------------------- //
197  // PRODUCTNAME
198  // --------------------------------------------------------------------- //
199  /// Specifies the name that the output/display driver
200  /// should give the product. This is provided as-authored to the
201  /// driver, whose responsibility it is to situate the product on a
202  /// filesystem or other storage, in the desired location.
203  ///
204  /// | ||
205  /// | -- | -- |
206  /// | Declaration | `token productName = ""` |
207  /// | C++ Type | TfToken |
208  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
211 
212  /// See GetProductNameAttr(), and also
213  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
214  /// If specified, author \p defaultValue as the attribute's default,
215  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
216  /// the default for \p writeSparsely is \c false.
218  UsdAttribute CreateProductNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
219 
220 public:
221  // --------------------------------------------------------------------- //
222  // ORDEREDVARS
223  // --------------------------------------------------------------------- //
224  /// Specifies the RenderVars that should be consumed and
225  /// combined into the final product. If ordering is relevant to the
226  /// output driver, then the ordering of targets in this relationship
227  /// provides the order to use.
228  ///
231 
232  /// See GetOrderedVarsRel(), and also
233  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
236 
237 public:
238  // ===================================================================== //
239  // Feel free to add custom code below this line, it will be preserved by
240  // the code generator.
241  //
242  // Just remember to:
243  // - Close the class declaration with };
244  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
245  // - Close the include guard with #endif
246  // ===================================================================== //
247  // --(BEGIN CUSTOM CODE)--
248 };
249 
251 
252 #endif
USDRENDER_API UsdAttribute CreateProductNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdSchemaKind _GetSchemaKind() const override
static USDRENDER_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
static USDRENDER_API UsdRenderProduct Get(const UsdStagePtr &stage, const SdfPath &path)
#define USDRENDER_API
Definition: api.h:40
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDRENDER_API UsdRenderProduct Define(const UsdStagePtr &stage, const SdfPath &path)
UsdRenderProduct(const UsdSchemaBase &schemaObj)
Definition: product.h:93
UsdSchemaKind
Definition: common.h:127
USDRENDER_API UsdAttribute GetProductNameAttr() const
USDRENDER_API UsdRelationship GetOrderedVarsRel() const
USDRENDER_API UsdAttribute CreateProductTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdRelationship CreateOrderedVarsRel() const
UsdRenderProduct(const UsdPrim &prim=UsdPrim())
Definition: product.h:85
Represents a concrete typed schema.
Definition: prim.h:132
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: path.h:290
virtual USDRENDER_API ~UsdRenderProduct()
Destructor.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
static const UsdSchemaKind schemaKind
Definition: product.h:79
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
USDRENDER_API UsdAttribute GetProductTypeAttr() const
Definition: value.h:166