HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
materialBindingSchema.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 ////////////////////////////////////////////////////////////////////////
8 
9 /* ************************************************************************** */
10 /* ** ** */
11 /* ** This file is generated by a script. ** */
12 /* ** ** */
13 /* ** Do not edit it directly (unless it is within a CUSTOM CODE section)! ** */
14 /* ** Edit hdSchemaDefs.py instead to make changes. ** */
15 /* ** ** */
16 /* ************************************************************************** */
17 
18 #ifndef PXR_USD_IMAGING_USD_IMAGING_MATERIAL_BINDING_SCHEMA_H
19 #define PXR_USD_IMAGING_USD_IMAGING_MATERIAL_BINDING_SCHEMA_H
20 
21 /// \file
22 
25 
26 #include "pxr/imaging/hd/schema.h"
27 
28 // --(BEGIN CUSTOM CODE: Includes)--
30 // --(END CUSTOM CODE: Includes)--
31 
33 
34 // --(BEGIN CUSTOM CODE: Declares)--
37 // --(END CUSTOM CODE: Declares)--
38 
39 #define USD_IMAGING_MATERIAL_BINDING_SCHEMA_TOKENS \
40  (usdMaterialBinding) \
41  (directMaterialBinding) \
42  (collectionMaterialBindings) \
43 
44 TF_DECLARE_PUBLIC_TOKENS(UsdImagingMaterialBindingSchemaTokens, USDIMAGING_API,
46 
47 //-----------------------------------------------------------------------------
48 
49 // The UsdImagingMaterialBindingSchema specifies a container for a prim's
50 // material bindings for a particular purpose. Note that only one direct
51 // binding but any number of collection-based bindings may be declared for a
52 // given purpose. See UsdImagingMaterialBindingsSchema which specifies the
53 // purposes and their associated bindings.
54 //
55 
57 {
58 public:
59  /// \name Schema retrieval
60  /// @{
61 
62  UsdImagingMaterialBindingSchema(HdContainerDataSourceHandle container)
63  : HdSchema(container) {}
64 
65  /// Retrieves a container data source with the schema's default name token
66  /// "usdMaterialBinding" from the parent container and constructs a
67  /// UsdImagingMaterialBindingSchema instance.
68  /// Because the requested container data source may not exist, the result
69  /// should be checked with IsDefined() or a bool comparison before use.
72  const HdContainerDataSourceHandle &fromParentContainer);
73 
74  /// @}
75 
76 // --(BEGIN CUSTOM CODE: Schema Methods)--
77 // --(END CUSTOM CODE: Schema Methods)--
78 
79  /// \name Member accessor
80  /// @{
81 
84 
87 
88  /// @}
89 
90  /// \name Schema location
91  /// @{
92 
93  /// Returns a token where the container representing this schema is found in
94  /// a container by default.
96  static const TfToken &GetSchemaToken();
97 
98  /// Returns an HdDataSourceLocator (relative to the prim-level data source)
99  /// where the container representing this schema is found by default.
101  static const HdDataSourceLocator &GetDefaultLocator();
102 
103  /// @}
104 
105  /// \name Schema construction
106  /// @{
107 
108  /// \deprecated Use Builder instead.
109  ///
110  /// Builds a container data source which includes the provided child data
111  /// sources. Parameters with nullptr values are excluded. This is a
112  /// low-level interface. For cases in which it's desired to define
113  /// the container with a sparse set of child fields, the Builder class
114  /// is often more convenient and readable.
116  static HdContainerDataSourceHandle
118  const HdContainerDataSourceHandle &directMaterialBinding,
119  const HdVectorDataSourceHandle &collectionMaterialBindings
120  );
121 
122  /// \class UsdImagingMaterialBindingSchema::Builder
123  ///
124  /// Utility class for setting sparse sets of child data source fields to be
125  /// filled as arguments into BuildRetained. Because all setter methods
126  /// return a reference to the instance, this can be used in the "builder
127  /// pattern" form.
128  class Builder
129  {
130  public:
133  const HdContainerDataSourceHandle &directMaterialBinding);
136  const HdVectorDataSourceHandle &collectionMaterialBindings);
137 
138  /// Returns a container data source containing the members set thus far.
140  HdContainerDataSourceHandle Build();
141 
142  private:
143  HdContainerDataSourceHandle _directMaterialBinding;
144  HdVectorDataSourceHandle _collectionMaterialBindings;
145 
146  };
147 
148  /// @}
149 };
150 
152 
153 #endif
#define USDIMAGING_API
Definition: api.h:23
USDIMAGING_API HdContainerDataSourceHandle Build()
Returns a container data source containing the members set thus far.
USDIMAGING_API Builder & SetCollectionMaterialBindings(const HdVectorDataSourceHandle &collectionMaterialBindings)
static USDIMAGING_API const TfToken & GetSchemaToken()
#define USD_IMAGING_MATERIAL_BINDING_SCHEMA_TOKENS
UsdImagingMaterialBindingSchema(HdContainerDataSourceHandle container)
Definition: token.h:70
TF_DECLARE_PUBLIC_TOKENS(HdMaterialBindingSchemaTokens, HD_API, HD_MATERIAL_BINDING_SCHEMA_TOKENS)
static USDIMAGING_API UsdImagingMaterialBindingSchema GetFromParent(const HdContainerDataSourceHandle &fromParentContainer)
USDIMAGING_API UsdImagingCollectionMaterialBindingVectorSchema GetCollectionMaterialBindings() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDIMAGING_API UsdImagingDirectMaterialBindingSchema GetDirectMaterialBinding() const
static USDIMAGING_API const HdDataSourceLocator & GetDefaultLocator()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
USDIMAGING_API Builder & SetDirectMaterialBinding(const HdContainerDataSourceHandle &directMaterialBinding)
static USDIMAGING_API HdContainerDataSourceHandle BuildRetained(const HdContainerDataSourceHandle &directMaterialBinding, const HdVectorDataSourceHandle &collectionMaterialBindings)