HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
collectionAPI.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 USD_GENERATED_COLLECTIONAPI_H
25 #define USD_GENERATED_COLLECTIONAPI_H
26 
27 /// \file usd/collectionAPI.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usd/api.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usd/tokens.h"
35 
37 #include "pxr/usd/usd/primFlags.h"
38 #include "pxr/usd/usd/tokens.h"
39 
40 
41 #include "pxr/base/vt/value.h"
42 
43 #include "pxr/base/gf/vec3d.h"
44 #include "pxr/base/gf/vec3f.h"
45 #include "pxr/base/gf/matrix4d.h"
46 
47 #include "pxr/base/tf/token.h"
48 #include "pxr/base/tf/type.h"
49 
51 
52 class SdfAssetPath;
53 
54 // -------------------------------------------------------------------------- //
55 // COLLECTIONAPI //
56 // -------------------------------------------------------------------------- //
57 
58 /// \class UsdCollectionAPI
59 ///
60 /// This is a general purpose API schema, used to describe a
61 /// collection of heterogeneous objects within the scene. "Objects" here may be
62 /// prims or properties belonging to prims or other collections. It's an add-on
63 /// schema that can be applied many times to a prim with different collection
64 /// names.
65 ///
66 /// A collection allows an enumeration of a set of paths to include and a
67 /// set of paths to exclude. Whether the descendants of an included
68 /// path are members of a collection are decided by its expansion rule
69 /// (see below). If the collection excludes paths that are not descendents
70 /// of included paths, the collection implicitly includes the root path
71 /// </>. If such a collection also includes paths that are not
72 /// descendants of the excluded paths, it is considered invalid, since
73 /// the intention is ambiguous.
74 ///
75 /// All the properties authored by the schema are namespaced under
76 /// "collection:". The given name of the collection provides additional
77 /// namespacing for the various per-collection properties, which include the
78 /// following:
79 ///
80 /// <ul><li><b>uniform token collection:<i>collectionName</i>:expansionRule</b> -
81 /// specified how the paths that are included in the collection must be expanded
82 /// to determine its members. Possible values include:
83 /// <ul>
84 /// <li><b>explicitOnly</b> - only paths in the includes rel targets and not
85 /// in the excludes rel targets belong to the collection.
86 /// </li>
87 /// <li><b>expandPrims</b> - all the prims at or below the includes rel-
88 /// targets (and not under the excludes rel-targets) belong to the
89 /// collection. Any property paths included in the collection would, of
90 /// course, also be honored. This is the default behavior as it satisfies
91 /// most use cases.
92 /// </li>
93 /// <li><b>expandPrimsAndProperties</b> - like expandPrims, but also
94 /// includes all properties on all matched prims. We're still not quite
95 /// sure what the use cases are for this, but you can use it to capture a
96 /// whole lot of UsdObjects very concisely.
97 /// </li>
98 /// </ul>
99 /// </li>
100 /// <li><b>bool collection:<i>collectionName</i>:includeRoot</b> - boolean
101 /// attribute indicating whether the pseudo-root path &lt;/&gt; should
102 /// be counted as one of the included target paths. The fallback is false.
103 /// This separate attribute is required because relationships cannot
104 /// directly target the root. When expansionRule is explicitOnly, this
105 /// attribute is ignored.
106 /// <li><b>rel collection:<i>collectionName</i>:includes</b> - specifies a list
107 /// of targets that are included in the collection. This can target prims or
108 /// properties directly. A collection can insert the rules of another
109 /// collection by making its <i>includes</i> relationship target the
110 /// <b>collection:{collectionName}</b> property on the owning prim of the
111 /// collection to be included (see UsdCollectionAPI::GetCollectionAttr).
112 /// It is important to note that including another collection does not
113 /// guarantee the contents of that collection will be in the final collection;
114 /// instead, the rules are merged. This means, for example, an exclude
115 /// entry may exclude a portion of the included collection.
116 /// When a collection includes one or more collections, the order in which
117 /// targets are added to the includes relationship may become significant, if
118 /// there are conflicting opinions about the same path. Targets that are added
119 /// later are considered to be stronger than earlier targets for the same path.
120 /// </li>
121 /// <li><b>rel collection:<i>collectionName</i>:excludes</b> - specifies a list
122 /// of targets that are excluded below the <b>included</b> paths in this
123 /// collection. This can target prims or properties directly, but <b>cannot
124 /// target another collection</b>. This is to keep the membership determining
125 /// logic simple, efficient and easier to reason about. Finally, it is invalid
126 /// for a collection to exclude paths that are not included in it. The presence
127 /// of such "orphaned" excluded paths will not affect the set of paths included
128 /// in the collection, but may affect the performance of querying membership of
129 /// a path in the collection (see UsdCollectionAPI::MembershipQuery::IsPathIncluded)
130 /// or of enumerating the objects belonging to the collection (see
131 /// UsdCollectionAPI::GetIncludedObjects).
132 /// </li>
133 /// <li><b>uniform opaque collection:<i>collectionName</i></b> - opaque
134 /// attribute (meaning it can never have a value) that represents the collection
135 /// for the purpose of allowing another collection to include it. When this
136 /// property is targeted by another collection's <i>includes</i> relationship,
137 /// the rules of this collection will be inserted into the rules of the collection
138 /// that includes it.
139 /// </li></ul>
140 ///
141 /// <b>Implicit inclusion</b>
142 ///
143 /// In some scenarios it is useful to express a collection that includes
144 /// everything except certain paths. To support this, a collection
145 /// that has an exclude that is not a descendent of any include
146 /// will include the root path &lt;/&gt;.
147 ///
148 /// <b>Creating collections in C++</b>
149 ///
150 /// \snippet examples.cpp ApplyCollections
151 ///
152 ///
153 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
154 /// that are text/tokens, the actual token is published and defined in \ref UsdTokens.
155 /// So to set an attribute to the value "rightHanded", use UsdTokens->rightHanded
156 /// as the value.
157 ///
159 {
160 public:
161  /// Compile time constant representing what kind of schema this class is.
162  ///
163  /// \sa UsdSchemaKind
165 
166  /// Construct a UsdCollectionAPI on UsdPrim \p prim with
167  /// name \p name . Equivalent to
168  /// UsdCollectionAPI::Get(
169  /// prim.GetStage(),
170  /// prim.GetPath().AppendProperty(
171  /// "collection:name"));
172  ///
173  /// for a \em valid \p prim, but will not immediately throw an error for
174  /// an invalid \p prim
176  const UsdPrim& prim=UsdPrim(), const TfToken &name=TfToken())
177  : UsdAPISchemaBase(prim, /*instanceName*/ name)
178  { }
179 
180  /// Construct a UsdCollectionAPI on the prim held by \p schemaObj with
181  /// name \p name. Should be preferred over
182  /// UsdCollectionAPI(schemaObj.GetPrim(), name), as it preserves
183  /// SchemaBase state.
185  const UsdSchemaBase& schemaObj, const TfToken &name)
186  : UsdAPISchemaBase(schemaObj, /*instanceName*/ name)
187  { }
188 
189  /// Destructor.
190  USD_API
191  virtual ~UsdCollectionAPI();
192 
193  /// Return a vector of names of all pre-declared attributes for this schema
194  /// class and all its ancestor classes. Does not include attributes that
195  /// may be authored by custom/extended methods of the schemas involved.
196  USD_API
197  static const TfTokenVector &
198  GetSchemaAttributeNames(bool includeInherited=true);
199 
200  /// Return a vector of names of all pre-declared attributes for this schema
201  /// class and all its ancestor classes for a given instance name. Does not
202  /// include attributes that may be authored by custom/extended methods of
203  /// the schemas involved. The names returned will have the proper namespace
204  /// prefix.
205  USD_API
206  static TfTokenVector
207  GetSchemaAttributeNames(bool includeInherited, const TfToken &instanceName);
208 
209  /// Returns the name of this multiple-apply schema instance
210  TfToken GetName() const {
211  return _GetInstanceName();
212  }
213 
214  /// Return a UsdCollectionAPI holding the prim adhering to this
215  /// schema at \p path on \p stage. If no prim exists at \p path on
216  /// \p stage, or if the prim at that path does not adhere to this schema,
217  /// return an invalid schema object. \p path must be of the format
218  /// <path>.collection:name .
219  ///
220  /// This is shorthand for the following:
221  ///
222  /// \code
223  /// TfToken name = SdfPath::StripNamespace(path.GetToken());
224  /// UsdCollectionAPI(
225  /// stage->GetPrimAtPath(path.GetPrimPath()), name);
226  /// \endcode
227  ///
228  USD_API
229  static UsdCollectionAPI
230  Get(const UsdStagePtr &stage, const SdfPath &path);
231 
232  /// Return a UsdCollectionAPI with name \p name holding the
233  /// prim \p prim. Shorthand for UsdCollectionAPI(prim, name);
234  USD_API
235  static UsdCollectionAPI
236  Get(const UsdPrim &prim, const TfToken &name);
237 
238  /// Return a vector of all named instances of UsdCollectionAPI on the
239  /// given \p prim.
240  USD_API
241  static std::vector<UsdCollectionAPI>
242  GetAll(const UsdPrim &prim);
243 
244  /// Checks if the given name \p baseName is the base name of a property
245  /// of CollectionAPI.
246  USD_API
247  static bool
248  IsSchemaPropertyBaseName(const TfToken &baseName);
249 
250  /// Checks if the given path \p path is of an API schema of type
251  /// CollectionAPI. If so, it stores the instance name of
252  /// the schema in \p name and returns true. Otherwise, it returns false.
253  USD_API
254  static bool
256 
257  /// Returns true if this <b>multiple-apply</b> API schema can be applied,
258  /// with the given instance name, \p name, to the given \p prim. If this
259  /// schema can not be a applied the prim, this returns false and, if
260  /// provided, populates \p whyNot with the reason it can not be applied.
261  ///
262  /// Note that if CanApply returns false, that does not necessarily imply
263  /// that calling Apply will fail. Callers are expected to call CanApply
264  /// before calling Apply if they want to ensure that it is valid to
265  /// apply a schema.
266  ///
267  /// \sa UsdPrim::GetAppliedSchemas()
268  /// \sa UsdPrim::HasAPI()
269  /// \sa UsdPrim::CanApplyAPI()
270  /// \sa UsdPrim::ApplyAPI()
271  /// \sa UsdPrim::RemoveAPI()
272  ///
273  USD_API
274  static bool
275  CanApply(const UsdPrim &prim, const TfToken &name,
276  std::string *whyNot=nullptr);
277 
278  /// Applies this <b>multiple-apply</b> API schema to the given \p prim
279  /// along with the given instance name, \p name.
280  ///
281  /// This information is stored by adding "CollectionAPI:<i>name</i>"
282  /// to the token-valued, listOp metadata \em apiSchemas on the prim.
283  /// For example, if \p name is 'instance1', the token
284  /// 'CollectionAPI:instance1' is added to 'apiSchemas'.
285  ///
286  /// \return A valid UsdCollectionAPI object is returned upon success.
287  /// An invalid (or empty) UsdCollectionAPI object is returned upon
288  /// failure. See \ref UsdPrim::ApplyAPI() for
289  /// conditions resulting in failure.
290  ///
291  /// \sa UsdPrim::GetAppliedSchemas()
292  /// \sa UsdPrim::HasAPI()
293  /// \sa UsdPrim::CanApplyAPI()
294  /// \sa UsdPrim::ApplyAPI()
295  /// \sa UsdPrim::RemoveAPI()
296  ///
297  USD_API
298  static UsdCollectionAPI
299  Apply(const UsdPrim &prim, const TfToken &name);
300 
301 protected:
302  /// Returns the kind of schema this class belongs to.
303  ///
304  /// \sa UsdSchemaKind
305  USD_API
306  UsdSchemaKind _GetSchemaKind() const override;
307 
308 private:
309  // needs to invoke _GetStaticTfType.
310  friend class UsdSchemaRegistry;
311  USD_API
312  static const TfType &_GetStaticTfType();
313 
314  static bool _IsTypedSchema();
315 
316  // override SchemaBase virtuals.
317  USD_API
318  const TfType &_GetTfType() const override;
319 
320 public:
321  // --------------------------------------------------------------------- //
322  // EXPANSIONRULE
323  // --------------------------------------------------------------------- //
324  /// Specifies how the paths that are included in
325  /// the collection must be expanded to determine its members.
326  ///
327  /// | ||
328  /// | -- | -- |
329  /// | Declaration | `uniform token expansionRule = "expandPrims"` |
330  /// | C++ Type | TfToken |
331  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
332  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
333  /// | \ref UsdTokens "Allowed Values" | explicitOnly, expandPrims, expandPrimsAndProperties |
334  USD_API
336 
337  /// See GetExpansionRuleAttr(), and also
338  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
339  /// If specified, author \p defaultValue as the attribute's default,
340  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
341  /// the default for \p writeSparsely is \c false.
342  USD_API
343  UsdAttribute CreateExpansionRuleAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
344 
345 public:
346  // --------------------------------------------------------------------- //
347  // INCLUDEROOT
348  // --------------------------------------------------------------------- //
349  /// Boolean attribute indicating whether the pseudo-root
350  /// path &lt;/&gt; should be counted as one of the included target
351  /// paths. The fallback is false. This separate attribute is
352  /// required because relationships cannot directly target the root.
353  ///
354  /// | ||
355  /// | -- | -- |
356  /// | Declaration | `uniform bool includeRoot` |
357  /// | C++ Type | bool |
358  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Bool |
359  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
360  USD_API
362 
363  /// See GetIncludeRootAttr(), and also
364  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
365  /// If specified, author \p defaultValue as the attribute's default,
366  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
367  /// the default for \p writeSparsely is \c false.
368  USD_API
369  UsdAttribute CreateIncludeRootAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
370 
371 public:
372  // --------------------------------------------------------------------- //
373  // COLLECTION
374  // --------------------------------------------------------------------- //
375  /// This property represents the collection for the purpose of
376  /// allowing another collection to include it. When this property is
377  /// targeted by another collection's <i>includes</i> relationship, the rules
378  /// of this collection will be inserted into the rules of the collection
379  /// that includes it.
380  ///
381  ///
382  /// | ||
383  /// | -- | -- |
384  /// | Declaration | `uniform opaque __INSTANCE_NAME__` |
385  /// | C++ Type | SdfOpaqueValue |
386  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Opaque |
387  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
388  USD_API
390 
391  /// See GetCollectionAttr(), and also
392  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
393  /// If specified, author \p defaultValue as the attribute's default,
394  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
395  /// the default for \p writeSparsely is \c false.
396  USD_API
397  UsdAttribute CreateCollectionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
398 
399 public:
400  // --------------------------------------------------------------------- //
401  // INCLUDES
402  // --------------------------------------------------------------------- //
403  /// Specifies a list of targets that are included in the collection.
404  /// This can target prims or properties directly. A collection can insert
405  /// the rules of another collection by making its <i>includes</i>
406  /// relationship target the <b>collection:{collectionName}</b> property on
407  /// the owning prim of the collection to be included
408  ///
409  USD_API
411 
412  /// See GetIncludesRel(), and also
413  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
414  USD_API
416 
417 public:
418  // --------------------------------------------------------------------- //
419  // EXCLUDES
420  // --------------------------------------------------------------------- //
421  /// Specifies a list of targets that are excluded below
422  /// the included paths in this collection. This can target prims or
423  /// properties directly, but cannot target another collection. This is to
424  /// keep the membership determining logic simple, efficient and easier to
425  /// reason about. Finally, it is invalid for a collection to exclude
426  /// paths that are not included in it. The presence of such "orphaned"
427  /// excluded paths will not affect the set of paths included in the
428  /// collection, but may affect the performance of querying membership of
429  /// a path in the collection (see
430  /// UsdCollectionAPI::MembershipQuery::IsPathIncluded)
431  /// or of enumerating the objects belonging to the collection (see
432  /// UsdCollectionAPI::GetIncludedObjects).
433  ///
434  USD_API
436 
437  /// See GetExcludesRel(), and also
438  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create
439  USD_API
441 
442 public:
443  // ===================================================================== //
444  // Feel free to add custom code below this line, it will be preserved by
445  // the code generator.
446  //
447  // Just remember to:
448  // - Close the class declaration with };
449  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
450  // - Close the include guard with #endif
451  // ===================================================================== //
452  // --(BEGIN CUSTOM CODE)--
453 
454 public:
455  /// Returns the collection represented by the given collection path,
456  /// \p collectionPath on the given USD stage.
457  USD_API
458  static UsdCollectionAPI GetCollection(const UsdStagePtr &stage,
459  const SdfPath &collectionPath);
460 
461  /// Returns the schema object representing a collection named \p name on
462  /// the given \p prim.
463  USD_API
464  static UsdCollectionAPI GetCollection(const UsdPrim &prim,
465  const TfToken &name);
466 
467  /// Returns all the named collections on the given USD prim.
468  /// \deprecated Use GetAll(prim) instead.
469  USD_API
470  static std::vector<UsdCollectionAPI> GetAllCollections(const UsdPrim &prim);
471 
472  /// Returns the canonical path that represents this collection.
473  /// This points to the property named "collection:{collectionName}" on the
474  /// prim defining the collection. This is the path to be used to "include"
475  /// this collection in another collection.
476  ///
477  /// \sa GetCollectionAttr()
478  USD_API
479  SdfPath GetCollectionPath() const;
480 
481  /// Returns the canonical path to the collection named, \p name on the given
482  /// prim, \p prim.
483  ///
484  /// \sa GetCollectionPath()
485  USD_API
487  const UsdPrim &prim,
488  const TfToken &collectionName);
489 
490  // Convenient alias for UsdCollectionMembershipQuery object
492 
493  /// Computes and returns a UsdCollectionMembershipQuery object which can
494  /// be used to query inclusion or exclusion of paths in the collection.
495  USD_API
497 
498  /// Populates the UsdCollectionMembershipQuery object with data from this
499  /// collection, so it can be used to query inclusion or exclusion of paths.
500  USD_API
502 
503  /// Returns true if the collection has nothing included in it.
504  /// This requires both that the includes relationship have no
505  /// target paths, and that the includeRoot attribute be false.
506  /// Note that there may be cases where the collection has no objects
507  /// included in it even when HasNoIncludedPaths() returns false.
508  /// For example, if the included objects are unloaded or if the
509  /// included objects are also excluded.
510  USD_API
511  bool HasNoIncludedPaths() const;
512 
513  /// Returns all the usd objects that satisfy the predicate, \p pred in the
514  /// collection represented by the UsdCollectionMembershipQuery object, \p
515  /// query.
516  ///
517  /// The results depends on the load state of the UsdStage, \p stage.
518  USD_API
519  static std::set<UsdObject> ComputeIncludedObjects(
521  const UsdStageWeakPtr &stage,
523 
524  /// Returns all the paths that satisfy the predicate, \p pred in the
525  /// collection represented by the UsdCollectionMembershipQuery object, \p
526  /// query.
527  ///
528  /// The result depends on the load state of the UsdStage, \p stage.
529  USD_API
532  const UsdStageWeakPtr &stage,
534 
535  /// @}
536 
537  /// \anchor UsdCollectionAPI_AuthoringAPI
538  /// \name Collection Authoring API
539  ///
540  /// Convenience API for adding or removing prims and properties to (or
541  /// from) a collection..
542  ///
543  /// @{
544 
545  /// Includes or adds the given path, \p pathToInclude in the collection.
546  ///
547  /// This does nothing if the path is already included in the collection.
548  ///
549  /// This does not modify the expansion-rule of the collection. Hence, if the
550  /// expansionRule is <i>expandPrims</i> or <i>expandPrimsAndProperties</i>,
551  /// then the descendants of \p pathToInclude will be also included in the
552  /// collection unless explicitly excluded.
553  ///
554  /// \sa UsdCollectionAPI::ExcludePath()
555  USD_API
556  bool IncludePath(const SdfPath &pathToInclude) const;
557 
558  /// Excludes or removes the given path, \p pathToExclude from the collection.
559  ///
560  /// If the collection is empty, the collection becomes one that
561  /// includes all paths except the givne path. Otherwise, this does
562  /// nothing if the path is not included in the collection.
563  ///
564  /// This does not modify the expansion-rule of the collection. Hence, if the
565  /// expansionRule is <i>expandPrims</i> or <i>expandPrimsAndProperties</i>,
566  /// then the descendants of \p pathToExclude will also be excluded from the
567  /// collection, unless explicitly included.
568  ///
569  /// \sa UsdCollectionAPI::IncludePath()
570  USD_API
571  bool ExcludePath(const SdfPath &pathToExclude) const;
572 
573  /// @}
574 
575  /// Validates the collection by checking the following rules:
576  /// * a collection's expansionRule should be one of "explicitOnly",
577  /// "expandPrims" or "expandPrimsAndProperties".
578  /// * a collection should not have have a circular dependency on
579  /// another collection.
580  /// * a collection should not have both includes and excludes
581  /// among its top-level rules
582  USD_API
583  bool Validate(std::string *reason) const;
584 
585  /// Resets the collection by clearing both the includes and excludes
586  /// targets of the collection in the current UsdEditTarget.
587  ///
588  /// \note This does not modify the "includeRoot" attribute which is used
589  /// to include or exclude everything (i.e. the pseudoRoot) in the USD stage.
590  USD_API
591  bool ResetCollection() const;
592 
593  /// Blocks the targets of the includes and excludes relationships of the
594  /// collection, making it
595  /// <* <i>empty</i> if "includeRoot" is false (or unset) or
596  /// * <i>include everything</i> if "includeRoot" is true.
597  /// (assuming there are no opinions in stronger edit targets).
598  USD_API
599  bool BlockCollection() const;
600 
601  /// Test whether a given \p name contains the "collection:" prefix
602  ///
603  USD_API
604  static bool CanContainPropertyName(const TfToken &name);
605 
606 private:
607 
608  // Helper method for computing the UsdCollectionMembershipQuery object for
609  // a collection.
610  // This makes recursive calls if the collection includes other collections.
611  // \p chainedCollectionPaths is used to pass in the set of all seen and
612  // included collections in the dependency chain and is used to detect
613  // circular dependencies.
614  // If \p foundCircularDependency is not nullptr, it is set to true if a
615  // circular dependency is detected amongst the included collections.
616  // If it is nullptr, a warning is issued when a circular dependency is
617  // detected.
618  void _ComputeMembershipQueryImpl(
620  const SdfPathSet &chainedCollectionPaths,
621  bool *foundCircularDependency=nullptr) const;
622 };
623 
625 
626 #endif
static USD_API UsdCollectionAPI Apply(const UsdPrim &prim, const TfToken &name)
USD_API UsdCollectionMembershipQuery ComputeMembershipQuery() const
GLenum query
Definition: glad.h:2772
USD_API bool BlockCollection() const
static USD_API SdfPath GetNamedCollectionPath(const UsdPrim &prim, const TfToken &collectionName)
static USD_API std::vector< UsdCollectionAPI > GetAllCollections(const UsdPrim &prim)
#define USD_API
Definition: api.h:40
USD_API UsdRelationship GetExcludesRel() const
USD_API bool HasNoIncludedPaths() const
USD_API UsdAttribute GetIncludeRootAttr() const
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
USD_API bool IncludePath(const SdfPath &pathToInclude) const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USD_API UsdRelationship CreateExcludesRel() const
Represents a flattened view of a collection. For more information about collections, please see UsdCollectionAPI as a way to encode and retrieve a collection from scene description. A UsdCollectionMembershipQuery object can be used to answer queries about membership of paths in the collection efficiently.
static USD_API bool CanApply(const UsdPrim &prim, const TfToken &name, std::string *whyNot=nullptr)
UsdStagePtr UsdStageWeakPtr
Definition: common.h:55
USD_API bool ResetCollection() const
USD_API UsdRelationship CreateIncludesRel() const
static USD_API UsdCollectionAPI Get(const UsdStagePtr &stage, const SdfPath &path)
USD_API UsdAttribute CreateExpansionRuleAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
const TfToken & _GetInstanceName() const
TfToken GetName() const
Returns the name of this multiple-apply schema instance.
Definition: token.h:87
static USD_API bool IsCollectionAPIPath(const SdfPath &path, TfToken *name)
USD_API SdfPath GetCollectionPath() const
static USD_API UsdCollectionAPI GetCollection(const UsdStagePtr &stage, const SdfPath &collectionPath)
USD_API bool Validate(std::string *reason) const
USD_API UsdAttribute GetExpansionRuleAttr() const
Definition: prim.h:135
static USD_API bool IsSchemaPropertyBaseName(const TfToken &baseName)
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: path.h:291
USD_API UsdAttribute GetCollectionAttr() const
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
Definition: path.h:210
UsdSchemaKind
Definition: common.h:127
USD_API UsdAttribute CreateCollectionAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
static const UsdSchemaKind schemaKind
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
USD_API UsdAttribute CreateIncludeRootAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: type.h:64
virtual USD_API ~UsdCollectionAPI()
Destructor.
static USD_API SdfPathSet ComputeIncludedPaths(const UsdCollectionMembershipQuery &query, const UsdStageWeakPtr &stage, const Usd_PrimFlagsPredicate &pred=UsdPrimDefaultPredicate)
static USD_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
USD_API UsdSchemaKind _GetSchemaKind() const override
UsdCollectionAPI(const UsdPrim &prim=UsdPrim(), const TfToken &name=TfToken())
static USD_API std::vector< UsdCollectionAPI > GetAll(const UsdPrim &prim)
Definition: value.h:167
Multiple Apply API Schema.
static USD_API std::set< UsdObject > ComputeIncludedObjects(const UsdCollectionMembershipQuery &query, const UsdStageWeakPtr &stage, const Usd_PrimFlagsPredicate &pred=UsdPrimDefaultPredicate)
USD_API UsdRelationship GetIncludesRel() const
USD_API bool ExcludePath(const SdfPath &pathToExclude) const
UsdCollectionAPI(const UsdSchemaBase &schemaObj, const TfToken &name)
static USD_API bool CanContainPropertyName(const TfToken &name)