1 //
2 // Copyright 2021 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 ////////////////////////////////////////////////////////////////////////
25 // This file is generated by a script.  Do not edit directly.  Edit the
26 // schema.template.cpp file to make changes.
27 
28 #include "pxr/imaging/hd/legacyDisplayStyleSchema.h"
29 #include "pxr/imaging/hd/retainedDataSource.h"
30 
31 #include "pxr/base/trace/trace.h"
32 
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 TF_DEFINE_PUBLIC_TOKENS(HdLegacyDisplayStyleSchemaTokens,
37     HDLEGACYDISPLAYSTYLE_SCHEMA_TOKENS);
38 
39 
40 
41 HdIntDataSourceHandle
GetRefineLevel()42 HdLegacyDisplayStyleSchema::GetRefineLevel()
43 {
44     return _GetTypedDataSource<HdIntDataSource>(
45         HdLegacyDisplayStyleSchemaTokens->refineLevel);
46 }
47 
48 HdBoolDataSourceHandle
GetFlatShadingEnabled()49 HdLegacyDisplayStyleSchema::GetFlatShadingEnabled()
50 {
51     return _GetTypedDataSource<HdBoolDataSource>(
52         HdLegacyDisplayStyleSchemaTokens->flatShadingEnabled);
53 }
54 
55 HdBoolDataSourceHandle
GetDisplacementEnabled()56 HdLegacyDisplayStyleSchema::GetDisplacementEnabled()
57 {
58     return _GetTypedDataSource<HdBoolDataSource>(
59         HdLegacyDisplayStyleSchemaTokens->displacementEnabled);
60 }
61 
62 HdBoolDataSourceHandle
GetOccludedSelectionShowsThrough()63 HdLegacyDisplayStyleSchema::GetOccludedSelectionShowsThrough()
64 {
65     return _GetTypedDataSource<HdBoolDataSource>(
66         HdLegacyDisplayStyleSchemaTokens->occludedSelectionShowsThrough);
67 }
68 
69 HdTokenDataSourceHandle
GetShadingStyle()70 HdLegacyDisplayStyleSchema::GetShadingStyle()
71 {
72     return _GetTypedDataSource<HdTokenDataSource>(
73         HdLegacyDisplayStyleSchemaTokens->shadingStyle);
74 }
75 
76 HdTokenArrayDataSourceHandle
GetReprSelector()77 HdLegacyDisplayStyleSchema::GetReprSelector()
78 {
79     return _GetTypedDataSource<HdTokenArrayDataSource>(
80         HdLegacyDisplayStyleSchemaTokens->reprSelector);
81 }
82 
83 HdTokenDataSourceHandle
GetCullStyle()84 HdLegacyDisplayStyleSchema::GetCullStyle()
85 {
86     return _GetTypedDataSource<HdTokenDataSource>(
87         HdLegacyDisplayStyleSchemaTokens->cullStyle);
88 }
89 
90 /*static*/
91 HdContainerDataSourceHandle
BuildRetained(const HdIntDataSourceHandle & refineLevel,const HdBoolDataSourceHandle & flatShadingEnabled,const HdBoolDataSourceHandle & displacementEnabled,const HdBoolDataSourceHandle & occludedSelectionShowsThrough,const HdTokenDataSourceHandle & shadingStyle,const HdTokenArrayDataSourceHandle & reprSelector,const HdTokenDataSourceHandle & cullStyle)92 HdLegacyDisplayStyleSchema::BuildRetained(
93         const HdIntDataSourceHandle &refineLevel,
94         const HdBoolDataSourceHandle &flatShadingEnabled,
95         const HdBoolDataSourceHandle &displacementEnabled,
96         const HdBoolDataSourceHandle &occludedSelectionShowsThrough,
97         const HdTokenDataSourceHandle &shadingStyle,
98         const HdTokenArrayDataSourceHandle &reprSelector,
99         const HdTokenDataSourceHandle &cullStyle
100 )
101 {
102     TfToken names[7];
103     HdDataSourceBaseHandle values[7];
104 
105     size_t count = 0;
106     if (refineLevel) {
107         names[count] = HdLegacyDisplayStyleSchemaTokens->refineLevel;
108         values[count++] = refineLevel;
109     }
110 
111     if (flatShadingEnabled) {
112         names[count] = HdLegacyDisplayStyleSchemaTokens->flatShadingEnabled;
113         values[count++] = flatShadingEnabled;
114     }
115 
116     if (displacementEnabled) {
117         names[count] = HdLegacyDisplayStyleSchemaTokens->displacementEnabled;
118         values[count++] = displacementEnabled;
119     }
120 
121     if (occludedSelectionShowsThrough) {
122         names[count] = HdLegacyDisplayStyleSchemaTokens->occludedSelectionShowsThrough;
123         values[count++] = occludedSelectionShowsThrough;
124     }
125 
126     if (shadingStyle) {
127         names[count] = HdLegacyDisplayStyleSchemaTokens->shadingStyle;
128         values[count++] = shadingStyle;
129     }
130 
131     if (reprSelector) {
132         names[count] = HdLegacyDisplayStyleSchemaTokens->reprSelector;
133         values[count++] = reprSelector;
134     }
135 
136     if (cullStyle) {
137         names[count] = HdLegacyDisplayStyleSchemaTokens->cullStyle;
138         values[count++] = cullStyle;
139     }
140 
141     return HdRetainedContainerDataSource::New(count, names, values);
142 }
143 
144 /*static*/
145 HdLegacyDisplayStyleSchema
GetFromParent(const HdContainerDataSourceHandle & fromParentContainer)146 HdLegacyDisplayStyleSchema::GetFromParent(
147         const HdContainerDataSourceHandle &fromParentContainer)
148 {
149     return HdLegacyDisplayStyleSchema(
150         fromParentContainer
151         ? HdContainerDataSource::Cast(fromParentContainer->Get(
152                 HdLegacyDisplayStyleSchemaTokens->displayStyle))
153         : nullptr);
154 }
155 
156 /*static*/
157 const HdDataSourceLocator &
GetDefaultLocator()158 HdLegacyDisplayStyleSchema::GetDefaultLocator()
159 {
160     static const HdDataSourceLocator locator(
161         HdLegacyDisplayStyleSchemaTokens->displayStyle
162     );
163     return locator;
164 }
165 /*static*/
166 const HdDataSourceLocator &
GetReprSelectorLocator()167 HdLegacyDisplayStyleSchema::GetReprSelectorLocator()
168 {
169     static const HdDataSourceLocator locator(
170         HdLegacyDisplayStyleSchemaTokens->displayStyle,
171         HdLegacyDisplayStyleSchemaTokens->reprSelector
172     );
173     return locator;
174 }
175 
176 /*static*/
177 const HdDataSourceLocator &
GetCullStyleLocator()178 HdLegacyDisplayStyleSchema::GetCullStyleLocator()
179 {
180     static const HdDataSourceLocator locator(
181         HdLegacyDisplayStyleSchemaTokens->displayStyle,
182         HdLegacyDisplayStyleSchemaTokens->cullStyle
183     );
184     return locator;
185 }
186 
187 
188 HdLegacyDisplayStyleSchema::Builder &
SetRefineLevel(const HdIntDataSourceHandle & refineLevel)189 HdLegacyDisplayStyleSchema::Builder::SetRefineLevel(
190     const HdIntDataSourceHandle &refineLevel)
191 {
192     _refineLevel = refineLevel;
193     return *this;
194 }
195 
196 HdLegacyDisplayStyleSchema::Builder &
SetFlatShadingEnabled(const HdBoolDataSourceHandle & flatShadingEnabled)197 HdLegacyDisplayStyleSchema::Builder::SetFlatShadingEnabled(
198     const HdBoolDataSourceHandle &flatShadingEnabled)
199 {
200     _flatShadingEnabled = flatShadingEnabled;
201     return *this;
202 }
203 
204 HdLegacyDisplayStyleSchema::Builder &
SetDisplacementEnabled(const HdBoolDataSourceHandle & displacementEnabled)205 HdLegacyDisplayStyleSchema::Builder::SetDisplacementEnabled(
206     const HdBoolDataSourceHandle &displacementEnabled)
207 {
208     _displacementEnabled = displacementEnabled;
209     return *this;
210 }
211 
212 HdLegacyDisplayStyleSchema::Builder &
SetOccludedSelectionShowsThrough(const HdBoolDataSourceHandle & occludedSelectionShowsThrough)213 HdLegacyDisplayStyleSchema::Builder::SetOccludedSelectionShowsThrough(
214     const HdBoolDataSourceHandle &occludedSelectionShowsThrough)
215 {
216     _occludedSelectionShowsThrough = occludedSelectionShowsThrough;
217     return *this;
218 }
219 
220 HdLegacyDisplayStyleSchema::Builder &
SetShadingStyle(const HdTokenDataSourceHandle & shadingStyle)221 HdLegacyDisplayStyleSchema::Builder::SetShadingStyle(
222     const HdTokenDataSourceHandle &shadingStyle)
223 {
224     _shadingStyle = shadingStyle;
225     return *this;
226 }
227 
228 HdLegacyDisplayStyleSchema::Builder &
SetReprSelector(const HdTokenArrayDataSourceHandle & reprSelector)229 HdLegacyDisplayStyleSchema::Builder::SetReprSelector(
230     const HdTokenArrayDataSourceHandle &reprSelector)
231 {
232     _reprSelector = reprSelector;
233     return *this;
234 }
235 
236 HdLegacyDisplayStyleSchema::Builder &
SetCullStyle(const HdTokenDataSourceHandle & cullStyle)237 HdLegacyDisplayStyleSchema::Builder::SetCullStyle(
238     const HdTokenDataSourceHandle &cullStyle)
239 {
240     _cullStyle = cullStyle;
241     return *this;
242 }
243 
244 HdContainerDataSourceHandle
Build()245 HdLegacyDisplayStyleSchema::Builder::Build()
246 {
247     return HdLegacyDisplayStyleSchema::BuildRetained(
248         _refineLevel,
249         _flatShadingEnabled,
250         _displacementEnabled,
251         _occludedSelectionShowsThrough,
252         _shadingStyle,
253         _reprSelector,
254         _cullStyle
255     );
256 }
257 
258 
259 PXR_NAMESPACE_CLOSE_SCOPE