HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
settings.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 USDRENDER_GENERATED_SETTINGS_H
8 #define USDRENDER_GENERATED_SETTINGS_H
9 
10 /// \file usdRender/settings.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdRender/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.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 // RENDERSETTINGS //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdRenderSettings
37 ///
38 /// A UsdRenderSettings prim specifies global settings for
39 /// a render process, including an enumeration of the RenderProducts
40 /// that should result, and the UsdGeomImageable purposes that should
41 /// be rendered. \ref UsdRenderHowSettingsAffectRendering
42 ///
43 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
44 /// that are text/tokens, the actual token is published and defined in \ref UsdRenderTokens.
45 /// So to set an attribute to the value "rightHanded", use UsdRenderTokens->rightHanded
46 /// as the value.
47 ///
49 {
50 public:
51  /// Compile time constant representing what kind of schema this class is.
52  ///
53  /// \sa UsdSchemaKind
55 
56  /// Construct a UsdRenderSettings on UsdPrim \p prim .
57  /// Equivalent to UsdRenderSettings::Get(prim.GetStage(), prim.GetPath())
58  /// for a \em valid \p prim, but will not immediately throw an error for
59  /// an invalid \p prim
60  explicit UsdRenderSettings(const UsdPrim& prim=UsdPrim())
61  : UsdRenderSettingsBase(prim)
62  {
63  }
64 
65  /// Construct a UsdRenderSettings on the prim held by \p schemaObj .
66  /// Should be preferred over UsdRenderSettings(schemaObj.GetPrim()),
67  /// as it preserves SchemaBase state.
68  explicit UsdRenderSettings(const UsdSchemaBase& schemaObj)
69  : UsdRenderSettingsBase(schemaObj)
70  {
71  }
72 
73  /// Destructor.
75  virtual ~UsdRenderSettings();
76 
77  /// Return a vector of names of all pre-declared attributes for this schema
78  /// class and all its ancestor classes. Does not include attributes that
79  /// may be authored by custom/extended methods of the schemas involved.
81  static const TfTokenVector &
82  GetSchemaAttributeNames(bool includeInherited=true);
83 
84  /// Return a UsdRenderSettings holding the prim adhering to this
85  /// schema at \p path on \p stage. If no prim exists at \p path on
86  /// \p stage, or if the prim at that path does not adhere to this schema,
87  /// return an invalid schema object. This is shorthand for the following:
88  ///
89  /// \code
90  /// UsdRenderSettings(stage->GetPrimAtPath(path));
91  /// \endcode
92  ///
94  static UsdRenderSettings
95  Get(const UsdStagePtr &stage, const SdfPath &path);
96 
97  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
98  /// is defined (according to UsdPrim::IsDefined()) on this stage.
99  ///
100  /// If a prim adhering to this schema at \p path is already defined on this
101  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
102  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
103  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
104  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
105  /// current EditTarget for any nonexistent, or existing but not \a Defined
106  /// ancestors.
107  ///
108  /// The given \a path must be an absolute prim path that does not contain
109  /// any variant selections.
110  ///
111  /// If it is impossible to author any of the necessary PrimSpecs, (for
112  /// example, in case \a path cannot map to the current UsdEditTarget's
113  /// namespace) issue an error and return an invalid \a UsdPrim.
114  ///
115  /// Note that this method may return a defined prim whose typeName does not
116  /// specify this schema class, in case a stronger typeName opinion overrides
117  /// the opinion at the current EditTarget.
118  ///
120  static UsdRenderSettings
121  Define(const UsdStagePtr &stage, const SdfPath &path);
122 
123 protected:
124  /// Returns the kind of schema this class belongs to.
125  ///
126  /// \sa UsdSchemaKind
128  UsdSchemaKind _GetSchemaKind() const override;
129 
130 private:
131  // needs to invoke _GetStaticTfType.
132  friend class UsdSchemaRegistry;
134  static const TfType &_GetStaticTfType();
135 
136  static bool _IsTypedSchema();
137 
138  // override SchemaBase virtuals.
140  const TfType &_GetTfType() const override;
141 
142 public:
143  // --------------------------------------------------------------------- //
144  // INCLUDEDPURPOSES
145  // --------------------------------------------------------------------- //
146  /// The list of UsdGeomImageable _purpose_ values that
147  /// should be included in the render. Note this cannot be
148  /// specified per-RenderProduct because it is a statement of
149  /// which geometry is present.
150  ///
151  /// | ||
152  /// | -- | -- |
153  /// | Declaration | `uniform token[] includedPurposes = ["default", "render"]` |
154  /// | C++ Type | VtArray<TfToken> |
155  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
156  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
159 
160  /// See GetIncludedPurposesAttr(), and also
161  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
162  /// If specified, author \p defaultValue as the attribute's default,
163  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
164  /// the default for \p writeSparsely is \c false.
166  UsdAttribute CreateIncludedPurposesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
167 
168 public:
169  // --------------------------------------------------------------------- //
170  // MATERIALBINDINGPURPOSES
171  // --------------------------------------------------------------------- //
172  /// Ordered list of material purposes to consider when
173  /// resolving material bindings in the scene. The empty string
174  /// indicates the "allPurpose" binding.
175  ///
176  /// | ||
177  /// | -- | -- |
178  /// | Declaration | `uniform token[] materialBindingPurposes = ["full", ""]` |
179  /// | C++ Type | VtArray<TfToken> |
180  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
181  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
182  /// | \ref UsdRenderTokens "Allowed Values" | full, preview, "" |
185 
186  /// See GetMaterialBindingPurposesAttr(), 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 CreateMaterialBindingPurposesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
193 
194 public:
195  // --------------------------------------------------------------------- //
196  // RENDERINGCOLORSPACE
197  // --------------------------------------------------------------------- //
198  /// Describes a renderer's working (linear) colorSpace where all
199  /// the renderer/shader math is expected to happen. When no
200  /// renderingColorSpace is provided, renderer should use its own default.
201  ///
202  /// | ||
203  /// | -- | -- |
204  /// | Declaration | `uniform token renderingColorSpace` |
205  /// | C++ Type | TfToken |
206  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
207  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
210 
211  /// See GetRenderingColorSpaceAttr(), 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 CreateRenderingColorSpaceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
218 
219 public:
220  // --------------------------------------------------------------------- //
221  // PRODUCTS
222  // --------------------------------------------------------------------- //
223  /// The set of RenderProducts the render should produce.
224  /// This relationship should target UsdRenderProduct prims.
225  /// If no _products_ are specified, an application should produce
226  /// an rgb image according to the RenderSettings configuration,
227  /// to a default display or image name.
228  ///
231 
232  /// See GetProductsRel(), 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  /// Fetch and return \p stage 's render settings, as indicated by root
250  /// layer metadata. If unauthored, or the metadata does not refer to
251  /// a valid UsdRenderSettings prim, this will return an invalid
252  /// UsdRenderSettings prim.
254  static UsdRenderSettings
256 };
257 
259 
260 #endif
static USDRENDER_API UsdRenderSettings Get(const UsdStagePtr &stage, const SdfPath &path)
#define USDRENDER_API
Definition: api.h:23
USDRENDER_API UsdRelationship GetProductsRel() const
static USDRENDER_API UsdRenderSettings GetStageRenderSettings(const UsdStageWeakPtr &stage)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UsdRenderSettings(const UsdSchemaBase &schemaObj)
Definition: settings.h:68
USDRENDER_API UsdAttribute CreateIncludedPurposesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDRENDER_API UsdAttribute GetRenderingColorSpaceAttr() const
USDRENDER_API UsdSchemaKind _GetSchemaKind() const override
USDRENDER_API UsdAttribute GetIncludedPurposesAttr() const
UsdStagePtr UsdStageWeakPtr
Definition: common.h:38
Represents a concrete typed schema.
USDRENDER_API UsdAttribute CreateMaterialBindingPurposesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
USDRENDER_API UsdRelationship CreateProductsRel() const
Definition: path.h:273
USDRENDER_API UsdAttribute GetMaterialBindingPurposesAttr() const
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
UsdRenderSettings(const UsdPrim &prim=UsdPrim())
Definition: settings.h:60
static const UsdSchemaKind schemaKind
Definition: settings.h:54
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
USDRENDER_API UsdAttribute CreateRenderingColorSpaceAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
virtual USDRENDER_API ~UsdRenderSettings()
Destructor.
static USDRENDER_API UsdRenderSettings Define(const UsdStagePtr &stage, const SdfPath &path)
Definition: value.h:146
static USDRENDER_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)