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 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_SETTINGS_H
25 #define USDRENDER_GENERATED_SETTINGS_H
26 
27 /// \file usdRender/settings.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 // RENDERSETTINGS //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdRenderSettings
54 ///
55 /// A UsdRenderSettings prim specifies global settings for
56 /// a render process, including an enumeration of the RenderProducts
57 /// that should result, and the UsdGeomImageable purposes that should
58 /// be rendered. \ref UsdRenderHowSettingsAffectRendering
59 ///
60 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
61 /// that are text/tokens, the actual token is published and defined in \ref UsdRenderTokens.
62 /// So to set an attribute to the value "rightHanded", use UsdRenderTokens->rightHanded
63 /// as the value.
64 ///
66 {
67 public:
68  /// Compile time constant representing what kind of schema this class is.
69  ///
70  /// \sa UsdSchemaKind
72 
73  /// Construct a UsdRenderSettings on UsdPrim \p prim .
74  /// Equivalent to UsdRenderSettings::Get(prim.GetStage(), prim.GetPath())
75  /// for a \em valid \p prim, but will not immediately throw an error for
76  /// an invalid \p prim
77  explicit UsdRenderSettings(const UsdPrim& prim=UsdPrim())
78  : UsdRenderSettingsBase(prim)
79  {
80  }
81 
82  /// Construct a UsdRenderSettings on the prim held by \p schemaObj .
83  /// Should be preferred over UsdRenderSettings(schemaObj.GetPrim()),
84  /// as it preserves SchemaBase state.
85  explicit UsdRenderSettings(const UsdSchemaBase& schemaObj)
86  : UsdRenderSettingsBase(schemaObj)
87  {
88  }
89 
90  /// Destructor.
92  virtual ~UsdRenderSettings();
93 
94  /// Return a vector of names of all pre-declared attributes for this schema
95  /// class and all its ancestor classes. Does not include attributes that
96  /// may be authored by custom/extended methods of the schemas involved.
98  static const TfTokenVector &
99  GetSchemaAttributeNames(bool includeInherited=true);
100 
101  /// Return a UsdRenderSettings holding the prim adhering to this
102  /// schema at \p path on \p stage. If no prim exists at \p path on
103  /// \p stage, or if the prim at that path does not adhere to this schema,
104  /// return an invalid schema object. This is shorthand for the following:
105  ///
106  /// \code
107  /// UsdRenderSettings(stage->GetPrimAtPath(path));
108  /// \endcode
109  ///
111  static UsdRenderSettings
112  Get(const UsdStagePtr &stage, const SdfPath &path);
113 
114  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
115  /// is defined (according to UsdPrim::IsDefined()) on this stage.
116  ///
117  /// If a prim adhering to this schema at \p path is already defined on this
118  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
119  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
120  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
121  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
122  /// current EditTarget for any nonexistent, or existing but not \a Defined
123  /// ancestors.
124  ///
125  /// The given \a path must be an absolute prim path that does not contain
126  /// any variant selections.
127  ///
128  /// If it is impossible to author any of the necessary PrimSpecs, (for
129  /// example, in case \a path cannot map to the current UsdEditTarget's
130  /// namespace) issue an error and return an invalid \a UsdPrim.
131  ///
132  /// Note that this method may return a defined prim whose typeName does not
133  /// specify this schema class, in case a stronger typeName opinion overrides
134  /// the opinion at the current EditTarget.
135  ///
137  static UsdRenderSettings
138  Define(const UsdStagePtr &stage, const SdfPath &path);
139 
140 protected:
141  /// Returns the kind of schema this class belongs to.
142  ///
143  /// \sa UsdSchemaKind
145  UsdSchemaKind _GetSchemaKind() const override;
146 
147 private:
148  // needs to invoke _GetStaticTfType.
149  friend class UsdSchemaRegistry;
151  static const TfType &_GetStaticTfType();
152 
153  static bool _IsTypedSchema();
154 
155  // override SchemaBase virtuals.
157  const TfType &_GetTfType() const override;
158 
159 public:
160  // --------------------------------------------------------------------- //
161  // INCLUDEDPURPOSES
162  // --------------------------------------------------------------------- //
163  /// The list of UsdGeomImageable _purpose_ values that
164  /// should be included in the render. Note this cannot be
165  /// specified per-RenderProduct because it is a statement of
166  /// which geometry is present.
167  ///
168  /// | ||
169  /// | -- | -- |
170  /// | Declaration | `uniform token[] includedPurposes = ["default", "render"]` |
171  /// | C++ Type | VtArray<TfToken> |
172  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
173  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
176 
177  /// See GetIncludedPurposesAttr(), and also
178  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
179  /// If specified, author \p defaultValue as the attribute's default,
180  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
181  /// the default for \p writeSparsely is \c false.
183  UsdAttribute CreateIncludedPurposesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
184 
185 public:
186  // --------------------------------------------------------------------- //
187  // MATERIALBINDINGPURPOSES
188  // --------------------------------------------------------------------- //
189  /// Ordered list of material purposes to consider when
190  /// resolving material bindings in the scene. The empty string
191  /// indicates the "allPurpose" binding.
192  ///
193  /// | ||
194  /// | -- | -- |
195  /// | Declaration | `uniform token[] materialBindingPurposes = ["full", ""]` |
196  /// | C++ Type | VtArray<TfToken> |
197  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->TokenArray |
198  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
199  /// | \ref UsdRenderTokens "Allowed Values" | full, preview, "" |
202 
203  /// See GetMaterialBindingPurposesAttr(), and also
204  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
205  /// If specified, author \p defaultValue as the attribute's default,
206  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
207  /// the default for \p writeSparsely is \c false.
209  UsdAttribute CreateMaterialBindingPurposesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
210 
211 public:
212  // --------------------------------------------------------------------- //
213  // RENDERINGCOLORSPACE
214  // --------------------------------------------------------------------- //
215  /// Describes a renderer's working (linear) colorSpace where all
216  /// the renderer/shader math is expected to happen. When no
217  /// renderingColorSpace is provided, renderer should use its own default.
218  ///
219  /// | ||
220  /// | -- | -- |
221  /// | Declaration | `uniform token renderingColorSpace` |
222  /// | C++ Type | TfToken |
223  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
224  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
227 
228  /// See GetRenderingColorSpaceAttr(), and also
229  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
230  /// If specified, author \p defaultValue as the attribute's default,
231  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
232  /// the default for \p writeSparsely is \c false.
234  UsdAttribute CreateRenderingColorSpaceAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
235 
236 public:
237  // --------------------------------------------------------------------- //
238  // PRODUCTS
239  // --------------------------------------------------------------------- //
240  /// The set of RenderProducts the render should produce.
241  /// This relationship should target UsdRenderProduct prims.
242  /// If no _products_ are specified, an application should produce
243  /// an rgb image according to the RenderSettings configuration,
244  /// to a default display or image name.
245  ///
248 
249  /// See GetProductsRel(), and also
250  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
253 
254 public:
255  // ===================================================================== //
256  // Feel free to add custom code below this line, it will be preserved by
257  // the code generator.
258  //
259  // Just remember to:
260  // - Close the class declaration with };
261  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
262  // - Close the include guard with #endif
263  // ===================================================================== //
264  // --(BEGIN CUSTOM CODE)--
265 
266  /// Fetch and return \p stage 's render settings, as indicated by root
267  /// layer metadata. If unauthored, or the metadata does not refer to
268  /// a valid UsdRenderSettings prim, this will return an invalid
269  /// UsdRenderSettings prim.
271  static UsdRenderSettings
273 };
274 
276 
277 #endif
static USDRENDER_API UsdRenderSettings Get(const UsdStagePtr &stage, const SdfPath &path)
#define USDRENDER_API
Definition: api.h:40
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:85
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:55
Represents a concrete typed schema.
USDRENDER_API UsdAttribute CreateMaterialBindingPurposesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: prim.h:135
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
USDRENDER_API UsdRelationship CreateProductsRel() const
Definition: path.h:291
USDRENDER_API UsdAttribute GetMaterialBindingPurposesAttr() const
UsdSchemaKind
Definition: common.h:127
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
UsdRenderSettings(const UsdPrim &prim=UsdPrim())
Definition: settings.h:77
static const UsdSchemaKind schemaKind
Definition: settings.h:71
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
Definition: type.h:64
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:167
static USDRENDER_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)