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  /// \note In the future, UsdRender may define additional product
175  /// types.
176  ///
177  /// | ||
178  /// | -- | -- |
179  /// | Declaration | `uniform token productType = "raster"` |
180  /// | C++ Type | TfToken |
181  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
182  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
185 
186  /// See GetProductTypeAttr(), and also
187  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
188  /// If specified, author \p defaultValue as the attribute's default,
189  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
190  /// the default for \p writeSparsely is \c false.
192  UsdAttribute CreateProductTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
193 
194 public:
195  // --------------------------------------------------------------------- //
196  // PRODUCTNAME
197  // --------------------------------------------------------------------- //
198  /// Specifies the name that the output/display driver
199  /// should give the product. This is provided as-authored to the
200  /// driver, whose responsibility it is to situate the product on a
201  /// filesystem or other storage, in the desired location.
202  ///
203  /// | ||
204  /// | -- | -- |
205  /// | Declaration | `token productName = ""` |
206  /// | C++ Type | TfToken |
207  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
210 
211  /// See GetProductNameAttr(), and also
212  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
213  /// If specified, author \p defaultValue as the attribute's default,
214  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
215  /// the default for \p writeSparsely is \c false.
217  UsdAttribute CreateProductNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
218 
219 public:
220  // --------------------------------------------------------------------- //
221  // ORDEREDVARS
222  // --------------------------------------------------------------------- //
223  /// Specifies the RenderVars that should be consumed and
224  /// combined into the final product. If ordering is relevant to the
225  /// output driver, then the ordering of targets in this relationship
226  /// provides the order to use.
227  ///
230 
231  /// See GetOrderedVarsRel(), and also
232  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
235 
236 public:
237  // ===================================================================== //
238  // Feel free to add custom code below this line, it will be preserved by
239  // the code generator.
240  //
241  // Just remember to:
242  // - Close the class declaration with };
243  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
244  // - Close the include guard with #endif
245  // ===================================================================== //
246  // --(BEGIN CUSTOM CODE)--
247 };
248 
250 
251 #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
USDRENDER_API UsdAttribute GetProductNameAttr() const
USDRENDER_API UsdRelationship GetOrderedVarsRel() const
Represents a concrete typed schema.
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
Definition: prim.h:135
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
Definition: path.h:291
UsdSchemaKind
Definition: common.h:127
virtual USDRENDER_API ~UsdRenderProduct()
Destructor.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
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:167