HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
composeSite.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 PXR_USD_PCP_COMPOSE_SITE_H
25 #define PXR_USD_PCP_COMPOSE_SITE_H
26 
27 /// \file pcp/composeSite.h
28 ///
29 /// Single-site composition.
30 ///
31 /// These are helpers that compose specific fields at single sites.
32 /// They compose the field for a given path across a layer stack,
33 /// using field-specific rules to combine the values.
34 ///
35 /// These helpers are low-level utilities used by the rest of the
36 /// Pcp algorithms, to discover composition arcs in scene description.
37 /// These arcs are what guide the algorithm to pull additional
38 /// sites of scene description into the PcpPrimIndex.
39 ///
40 /// Some of these field types support list-editing. (See SdListOp.)
41 /// List-editing for these fields is applied across the fixed domain
42 /// of a single site; you cannot apply list-ops across sites.
43 /// The intention is to avoid subtle ordering issues in composition
44 /// semantics.
45 ///
46 /// Note that these helpers do not take PcpSite as a literal parameter;
47 /// instead, they require the actual computed layer stack that a site
48 /// identified. Rather than tying these helpers to PcpCache and its
49 /// process of computing layer stacks, they just employ the result.
50 /// Conceptually, though, they are operating on the scene description
51 /// identified by a PcpSite.
52 
53 #include "pxr/pxr.h"
54 #include "pxr/usd/pcp/api.h"
55 #include "pxr/usd/pcp/node.h"
57 #include "pxr/usd/sdf/path.h"
58 #include "pxr/usd/sdf/payload.h"
59 #include "pxr/usd/sdf/reference.h"
60 #include "pxr/usd/sdf/types.h"
61 #include "pxr/usd/sdf/site.h"
62 
63 #include <set>
64 #include <vector>
65 
67 
69 
70 class PcpLayerStackSite;
71 
72 /// \struct PcpSourceArcInfo
73 ///
74 /// Information about the source of the target of an arc.
75 /// All arcs have a layer that the arc comes from. References and payloads
76 /// have a resolved layer offset and authored asset path as well.
77 ///
79  SdfLayerHandle layer;
82 };
83 
84 /// A vector of reference or payload arc information.
85 typedef std::vector<PcpSourceArcInfo> PcpSourceArcInfoVector;
86 
87 /// References
88 PCP_API
89 void
90 PcpComposeSiteReferences(PcpLayerStackRefPtr const &layerStack,
91  SdfPath const &path,
94 inline void
98 {
99  return PcpComposeSiteReferences(node.GetLayerStack(), node.GetPath(),
100  result, info);
101 }
102 
103 /// Payloads
104 PCP_API
105 void
106 PcpComposeSitePayloads(PcpLayerStackRefPtr const &layerStack,
107  SdfPath const &path,
109  PcpSourceArcInfoVector *info);
110 inline void
114 {
115  return PcpComposeSitePayloads(node.GetLayerStack(), node.GetPath(),
116  result, info);
117 }
118 
119 /// Permission
120 PCP_API
122 PcpComposeSitePermission(PcpLayerStackRefPtr const &layerStack,
123  SdfPath const &path);
124 
125 inline SdfPermission
127 {
128  return PcpComposeSitePermission(node.GetLayerStack(), node.GetPath());
129 }
130 
131 /// Prim sites
132 PCP_API
133 void
134 PcpComposeSitePrimSites(PcpLayerStackRefPtr const &layerStack,
135  SdfPath const &path,
137 
138 inline void
140 {
142  node.GetLayerStack(), node.GetPath(), result);
143 }
144 
145 /// Relocates
146 PCP_API
147 void
148 PcpComposeSiteRelocates(PcpLayerStackRefPtr const &layerStack,
149  SdfPath const &path,
151 
152 inline void
154 {
156  node.GetLayerStack(), node.GetPath(), result);
157 }
158 
159 /// Has prim specs.
160 PCP_API
161 bool
162 PcpComposeSiteHasPrimSpecs(PcpLayerStackRefPtr const &layerStack,
163  SdfPath const &path);
164 inline bool
166 {
167  return PcpComposeSiteHasPrimSpecs(node.GetLayerStack(), node.GetPath());
168 }
169 
170 /// Symmetry
171 PCP_API
172 bool
173 PcpComposeSiteHasSymmetry(PcpLayerStackRefPtr const &layerStack,
174  SdfPath const &path);
175 inline bool
177 {
178  return PcpComposeSiteHasSymmetry(node.GetLayerStack(), node.GetPath());
179 }
180 
181 /// Inherits
182 PCP_API
183 void
184 PcpComposeSiteInherits(PcpLayerStackRefPtr const &layerStack,
185  SdfPath const &path, SdfPathVector *result,
186  PcpSourceArcInfoVector *info);
187 
188 PCP_API
189 void
190 PcpComposeSiteInherits(PcpLayerStackRefPtr const &layerStack,
191  SdfPath const &path, SdfPathVector *result);
192 
193 inline void
195 {
196  return PcpComposeSiteInherits(node.GetLayerStack(), node.GetPath(), result);
197 }
198 
199 /// Specializes
200 PCP_API
201 void
202 PcpComposeSiteSpecializes(PcpLayerStackRefPtr const &layerStack,
203  SdfPath const &path, SdfPathVector *result,
204  PcpSourceArcInfoVector *info);
205 
206 PCP_API
207 void
208 PcpComposeSiteSpecializes(PcpLayerStackRefPtr const &layerStack,
209  SdfPath const &path, SdfPathVector *result);
210 
211 inline void
213 {
215  node.GetLayerStack(), node.GetPath(), result);
216 }
217 
218 /// VariantSets
219 PCP_API
220 void
221 PcpComposeSiteVariantSets(PcpLayerStackRefPtr const &layerStack,
222  SdfPath const &path,
223  std::vector<std::string> *result,
224  PcpSourceArcInfoVector *info);
225 
226 PCP_API
227 void
228 PcpComposeSiteVariantSets(PcpLayerStackRefPtr const &layerStack,
229  SdfPath const &path,
230  std::vector<std::string> *result);
231 inline void
233  std::vector<std::string> *result) {
235  node.GetLayerStack(), node.GetPath(), result);
236 }
237 
238 /// VariantSetOptions
239 PCP_API
240 void
241 PcpComposeSiteVariantSetOptions(PcpLayerStackRefPtr const &layerStack,
242  SdfPath const &path,
243  std::string const &vsetName,
244  std::set<std::string> *result);
245 inline void
247  std::string const &vsetName,
248  std::set<std::string> *result)
249 {
251  node.GetLayerStack(), node.GetPath(), vsetName, result);
252 }
253 
254 /// VariantSelection
255 PCP_API
256 bool
257 PcpComposeSiteVariantSelection(PcpLayerStackRefPtr const &layerStack,
258  SdfPath const &path,
259  std::string const &vsetName,
261 inline bool
263  std::string const &vsetName,
265 {
267  vsetName, result);
268 }
269 
270 /// VariantSelections
271 PCP_API
272 void
273 PcpComposeSiteVariantSelections(PcpLayerStackRefPtr const &layerStack,
274  SdfPath const &path,
276 inline void
279 {
281  result);
282 }
283 
284 /// Compose child names.
285 /// If the optional \p orderField is provided, its order will be applied.
286 PCP_API
287 void
289  SdfPath const &path,
290  const TfToken & namesField,
291  TfTokenVector *nameOrder,
292  PcpTokenSet *nameSet,
293  const TfToken *orderField = nullptr);
294 
296 
297 #endif // PXR_USD_PCP_COMPOSE_SITE_H
PCP_API bool PcpComposeSiteVariantSelection(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, std::string const &vsetName, std::string *result)
VariantSelection.
std::vector< SdfPayload > SdfPayloadVector
Definition: payload.h:43
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.
Definition: types.h:273
std::string authoredAssetPath
Definition: composeSite.h:81
std::vector< SdfSite > SdfSiteVector
Definition: site.h:79
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.
Definition: types.h:264
PCP_API void PcpComposeSiteChildNames(SdfLayerRefPtrVector const &layers, SdfPath const &path, const TfToken &namesField, TfTokenVector *nameOrder, PcpTokenSet *nameSet, const TfToken *orderField=nullptr)
PCP_API void PcpComposeSiteReferences(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfReferenceVector *result, PcpSourceArcInfoVector *info)
References.
GLenum GLsizei GLsizei GLsizei GLsizei layers
Definition: glew.h:2864
PCP_API bool PcpComposeSiteHasSymmetry(PcpLayerStackRefPtr const &layerStack, SdfPath const &path)
Symmetry.
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(PcpLayerStack)
PCP_API void PcpComposeSiteInherits(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfPathVector *result, PcpSourceArcInfoVector *info)
Inherits.
PCP_API void PcpComposeSiteSpecializes(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfPathVector *result, PcpSourceArcInfoVector *info)
Specializes.
Definition: token.h:87
std::vector< TfRefPtr< SdfLayer > > SdfLayerRefPtrVector
PCP_API void PcpComposeSitePrimSites(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfSiteVector *result)
Prim sites.
PCP_API void PcpComposeSiteVariantSelections(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfVariantSelectionMap *result)
VariantSelections.
PCP_API const SdfPath & GetPath() const
Returns the path for the site this node represents.
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:446
SdfLayerHandle layer
Definition: composeSite.h:79
std::vector< PcpSourceArcInfo > PcpSourceArcInfoVector
A vector of reference or payload arc information.
Definition: composeSite.h:85
PCP_API void PcpComposeSiteVariantSetOptions(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, std::string const &vsetName, std::set< std::string > *result)
VariantSetOptions.
Definition: path.h:288
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:209
GLsizei const GLchar *const * path
Definition: glew.h:6461
PCP_API const PcpLayerStackRefPtr & GetLayerStack() const
Returns the layer stack for the site this node represents.
GLsizei const GLchar *const * string
Definition: glew.h:1844
std::vector< SdfReference > SdfReferenceVector
Definition: reference.h:44
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
PCP_API void PcpComposeSitePayloads(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfPayloadVector *result, PcpSourceArcInfoVector *info)
Payloads.
PCP_API void PcpComposeSiteVariantSets(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, std::vector< std::string > *result, PcpSourceArcInfoVector *info)
VariantSets.
PCP_API bool PcpComposeSiteHasPrimSpecs(PcpLayerStackRefPtr const &layerStack, SdfPath const &path)
Has prim specs.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
GLuint64EXT * result
Definition: glew.h:14007
PCP_API void PcpComposeSiteRelocates(PcpLayerStackRefPtr const &layerStack, SdfPath const &path, SdfRelocatesMap *result)
Relocates.
SdfLayerOffset layerOffset
Definition: composeSite.h:80
PCP_API SdfPermission PcpComposeSitePermission(PcpLayerStackRefPtr const &layerStack, SdfPath const &path)
Permission.
SdfPermission
Definition: types.h:155
#define PCP_API
Definition: api.h:40