All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdCollectionMembershipQuery Class Reference

Represents a flattened view of a collection. More...

Classes

struct  Hash
 Hash functor. More...
 

Public Types

using PathExpansionRuleMap = std::unordered_map< SdfPath, TfToken, SdfPath::Hash >
 Holds an unordered map describing membership of paths in this collection and the associated expansionRule for how the paths are to be expanded. More...
 

Public Member Functions

 UsdCollectionMembershipQuery ()=default
 Default Constructor, creates an empty UsdCollectionMembershipQuery object. More...
 
 UsdCollectionMembershipQuery (const PathExpansionRuleMap &pathExpansionRuleMap, const SdfPathSet &includedCollections)
 Constructor that takes a path expansion rule map. More...
 
 UsdCollectionMembershipQuery (PathExpansionRuleMap &&pathExpansionRuleMap, SdfPathSet &&includedCollections)
 Constructor that takes a path expansion rule map as an rvalue reference. More...
 
USD_API bool IsPathIncluded (const SdfPath &path, TfToken *expansionRule=nullptr) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns whether the given path is included in the collection from which this UsdCollectionMembershipQuery object was computed. More...
 
USD_API bool IsPathIncluded (const SdfPath &path, const TfToken &parentExpansionRule, TfToken *expansionRule=nullptr) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns whether the given path, path is included in the collection from which this UsdCollectionMembershipQuery object was computed, given the parent-path's inherited expansion rule, parentExpansionRule. More...
 
bool HasExcludes () const
 Returns true if the collection excludes one or more paths below an included path. More...
 
bool operator== (UsdCollectionMembershipQuery const &rhs) const
 Equality operator. More...
 
bool operator!= (UsdCollectionMembershipQuery const &rhs) const
 Inequality operator. More...
 
size_t GetHash () const
 Hash function. More...
 
const PathExpansionRuleMapGetAsPathExpansionRuleMap () const
 Returns a raw map of the paths included or excluded in the collection along with the expansion rules for the included paths. More...
 
const SdfPathSet & GetIncludedCollections () const
 Returns a set of paths for all collections that were included in the collection from which this UsdCollectionMembershipQuery object was computed. More...
 

Detailed Description

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.

Definition at line 49 of file collectionMembershipQuery.h.

Member Typedef Documentation

using PathExpansionRuleMap = std::unordered_map<SdfPath, TfToken, SdfPath::Hash>

Holds an unordered map describing membership of paths in this collection and the associated expansionRule for how the paths are to be expanded.

Valid expansionRules are UsdTokens->explicitOnly, UsdTokens->expandPrims, and UsdTokens->expandPrimsAndProperties. For more information on the expansion rules, please see the expansionRule attribute on UsdCollectionAPI. If a collection includes another collection, the included collection's PathExpansionRuleMap is merged into this one. If a path is excluded, its expansion rule is set to UsdTokens->exclude.

Definition at line 62 of file collectionMembershipQuery.h.

Constructor & Destructor Documentation

Default Constructor, creates an empty UsdCollectionMembershipQuery object.

UsdCollectionMembershipQuery ( const PathExpansionRuleMap pathExpansionRuleMap,
const SdfPathSet &  includedCollections 
)

Constructor that takes a path expansion rule map.

The map is scanned for 'excludes' when the UsdCollectionMembershipQuery object is constructed.

UsdCollectionMembershipQuery ( PathExpansionRuleMap &&  pathExpansionRuleMap,
SdfPathSet &&  includedCollections 
)

Constructor that takes a path expansion rule map as an rvalue reference.

Member Function Documentation

const PathExpansionRuleMap& GetAsPathExpansionRuleMap ( ) const
inline

Returns a raw map of the paths included or excluded in the collection along with the expansion rules for the included paths.

Definition at line 156 of file collectionMembershipQuery.h.

size_t GetHash ( ) const
inline

Hash function.

Definition at line 149 of file collectionMembershipQuery.h.

const SdfPathSet& GetIncludedCollections ( ) const
inline

Returns a set of paths for all collections that were included in the collection from which this UsdCollectionMembershipQuery object was computed.

This set is recursive, so collections that were included by other collections will be part of this set. The collection from which this UsdCollectionMembershipQuery object was computed is not part of this set.

Definition at line 166 of file collectionMembershipQuery.h.

bool HasExcludes ( ) const
inline

Returns true if the collection excludes one or more paths below an included path.

Definition at line 126 of file collectionMembershipQuery.h.

USD_API bool IsPathIncluded ( const SdfPath path,
TfToken expansionRule = nullptr 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns whether the given path is included in the collection from which this UsdCollectionMembershipQuery object was computed.

This is the API that clients should use for determining if a given object is a member of the collection. To enumerate all the members of a collection, use UsdComputeIncludedObjectsFromCollection or UsdComputeIncludedPathsFromCollection.

If expansionRule is not nullptr, it is set to the expansion- rule value that caused the path to be included in or excluded from the collection. If path is not included in the collection, expansionRule is set to UsdTokens->exclude.

It is useful to specify this parameter and use this overload of IsPathIncluded(), when you're interested in traversing a subtree and want to know whether the root of the subtree is included in a collection. For evaluating membership of descendants of the root, please use the other overload of IsPathIncluded(), that takes both a path and the parent expansionRule.

The python version of this method only returns the boolean result. It does not return expansionRule.

USD_API bool IsPathIncluded ( const SdfPath path,
const TfToken parentExpansionRule,
TfToken expansionRule = nullptr 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns whether the given path, path is included in the collection from which this UsdCollectionMembershipQuery object was computed, given the parent-path's inherited expansion rule, parentExpansionRule.

If expansionRule is not nullptr, it is set to the expansion- rule value that caused the path to be included in or excluded from the collection. If path is not included in the collection, expansionRule is set to UsdTokens->exclude.

The python version of this method only returns the boolean result. It does not return expansionRule.

bool operator!= ( UsdCollectionMembershipQuery const &  rhs) const
inline

Inequality operator.

Definition at line 138 of file collectionMembershipQuery.h.

bool operator== ( UsdCollectionMembershipQuery const &  rhs) const
inline

Equality operator.

Definition at line 131 of file collectionMembershipQuery.h.


The documentation for this class was generated from the following file: