HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
primFlags.h File Reference
#include "pxr/pxr.h"
#include "pxr/usd/usd/api.h"
#include "pxr/base/arch/hints.h"
#include "pxr/base/tf/bitUtils.h"
#include <hboost/functional/hash.hpp>
#include <bitset>
+ Include dependency graph for primFlags.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Usd_Term
 
class  Usd_PrimFlagsPredicate
 
class  Usd_PrimFlagsConjunction
 
class  Usd_PrimFlagsDisjunction
 

Typedefs

typedef std::bitset
< Usd_PrimNumFlags
Usd_PrimFlagBits
 

Enumerations

enum  Usd_PrimFlags {
  Usd_PrimActiveFlag, Usd_PrimLoadedFlag, Usd_PrimModelFlag, Usd_PrimGroupFlag,
  Usd_PrimAbstractFlag, Usd_PrimDefinedFlag, Usd_PrimHasDefiningSpecifierFlag, Usd_PrimInstanceFlag,
  Usd_PrimHasPayloadFlag, Usd_PrimClipsFlag, Usd_PrimDeadFlag, Usd_PrimMasterFlag,
  Usd_PrimInstanceProxyFlag, Usd_PrimPseudoRootFlag, Usd_PrimNumFlags
}
 

Functions

Usd_Term operator! (Usd_PrimFlags flag)
 
Usd_PrimFlagsConjunction operator&& (Usd_Term lhs, Usd_Term rhs)
 
Usd_PrimFlagsConjunction operator&& (const Usd_PrimFlagsConjunction &conjunction, Usd_Term rhs)
 
Usd_PrimFlagsConjunction operator&& (Usd_Term lhs, const Usd_PrimFlagsConjunction &conjunction)
 
Usd_PrimFlagsConjunction operator&& (Usd_PrimFlags lhs, Usd_PrimFlags rhs)
 
Usd_PrimFlagsDisjunction operator|| (Usd_Term lhs, Usd_Term rhs)
 
Usd_PrimFlagsDisjunction operator|| (const Usd_PrimFlagsDisjunction &disjunction, Usd_Term rhs)
 
Usd_PrimFlagsDisjunction operator|| (Usd_Term lhs, const Usd_PrimFlagsDisjunction &disjunction)
 
Usd_PrimFlagsDisjunction operator|| (Usd_PrimFlags lhs, Usd_PrimFlags rhs)
 
Usd_PrimFlagsPredicate UsdTraverseInstanceProxies (Usd_PrimFlagsPredicate predicate)
 
Usd_PrimFlagsPredicate UsdTraverseInstanceProxies ()
 

Variables

USD_API const
Usd_PrimFlagsConjunction 
UsdPrimDefaultPredicate
 
USD_API const
Usd_PrimFlagsPredicate 
UsdPrimAllPrimsPredicate
 

Detailed Description

Provides terms for UsdPrim flags that can be combined to form either a conjunction (via &&) or a disjunction (via ||). The result is a predicate functor object that tests those flags on the passed prim. Currently UsdPrim::GetFilteredChildren(), UsdPrim::GetNextFilteredSibling(), UsdPrim::GetFilteredDescendants(), and UsdPrimRange() accept these predicates to filter out unwanted prims.

For example:

// Get only loaded model children.
prim.GetFilteredChildren(UsdPrimIsModel && UsdPrimIsLoaded)

For performance, these predicates are implemented by a bitwise test, so arbitrary boolean expressions cannot be represented. The set of boolean expressions that can be represented are conjunctions with possibly negated terms (or disjunctions, by De Morgan's law). Here are some examples of valid expressions:

// simple conjunction.
(UsdPrimIsLoaded && UsdPrimIsGroup)
// conjunction with negated term.
(UsdPrimIsDefined && !UsdPrimIsAbstract)
// disjunction with negated term.
(!UsdPrimIsDefined || !UsdPrimIsActive)
// negated conjunction gives a disjunction.
!(UsdPrimIsLoaded && UsdPrimIsModel)
// negated conjunction gives a disjunction, which is further extended.
(!(UsdPrimIsLoaded && UsdPrimIsModel) || UsdPrimIsAbstract)
// equivalent to above.
(!UsdPrimIsLoaded || !UsdPrimIsModel || UsdPrimIsAbstract)

Here are some examples of invalid expressions:

// error: cannot || a term with a conjunction.
(UsdPrimIsLoaded && UsdPrimIsModel) || UsdPrimIsAbstract
// error: cannot && disjunctions.
(!UsdPrimIsDefined || UsdPrimIsAbstract) && (UsdPrimIsModel || !UsdPrimIsActive)

The following variables provide the clauses that can be combined and negated to produce predicates:

Definition in file primFlags.h.

Typedef Documentation

typedef std::bitset<Usd_PrimNumFlags> Usd_PrimFlagBits

Definition at line 111 of file primFlags.h.

Enumeration Type Documentation

Enumerator
Usd_PrimActiveFlag 
Usd_PrimLoadedFlag 
Usd_PrimModelFlag 
Usd_PrimGroupFlag 
Usd_PrimAbstractFlag 
Usd_PrimDefinedFlag 
Usd_PrimHasDefiningSpecifierFlag 
Usd_PrimInstanceFlag 
Usd_PrimHasPayloadFlag 
Usd_PrimClipsFlag 
Usd_PrimDeadFlag 
Usd_PrimMasterFlag 
Usd_PrimInstanceProxyFlag 
Usd_PrimPseudoRootFlag 
Usd_PrimNumFlags 

Definition at line 89 of file primFlags.h.

Function Documentation

Usd_Term operator! ( Usd_PrimFlags  flag)
inline

Definition at line 131 of file primFlags.h.

Usd_PrimFlagsConjunction operator&& ( Usd_Term  lhs,
Usd_Term  rhs 
)
inline

Definition at line 370 of file primFlags.h.

Usd_PrimFlagsConjunction operator&& ( const Usd_PrimFlagsConjunction conjunction,
Usd_Term  rhs 
)
inline

Definition at line 378 of file primFlags.h.

Usd_PrimFlagsConjunction operator&& ( Usd_Term  lhs,
const Usd_PrimFlagsConjunction conjunction 
)
inline

Definition at line 383 of file primFlags.h.

Usd_PrimFlagsConjunction operator&& ( Usd_PrimFlags  lhs,
Usd_PrimFlags  rhs 
)
inline

Definition at line 388 of file primFlags.h.

Usd_PrimFlagsDisjunction operator|| ( Usd_Term  lhs,
Usd_Term  rhs 
)
inline

Definition at line 473 of file primFlags.h.

Usd_PrimFlagsDisjunction operator|| ( const Usd_PrimFlagsDisjunction disjunction,
Usd_Term  rhs 
)
inline

Definition at line 478 of file primFlags.h.

Usd_PrimFlagsDisjunction operator|| ( Usd_Term  lhs,
const Usd_PrimFlagsDisjunction disjunction 
)
inline

Definition at line 483 of file primFlags.h.

Usd_PrimFlagsDisjunction operator|| ( Usd_PrimFlags  lhs,
Usd_PrimFlags  rhs 
)
inline

Definition at line 488 of file primFlags.h.

Usd_PrimFlagsPredicate UsdTraverseInstanceProxies ( Usd_PrimFlagsPredicate  predicate)
inline

This function is used to allow the prim traversal functions listed under Prim predicate flags to traverse beneath instance prims and return descendants that pass the specified predicate as instance proxy prims. For example:

// Return all children of the specified prim.
// If prim is an instance, return all children as instance proxy prims.
prim.GetFilteredChildren(
// Return children of the specified prim that pass the default predicate.
// If prim is an instance, return the children that pass this predicate
// as instance proxy prims.
prim.GetFilteredChildren(UsdTraverseInstanceProxies());
// Return all model or group children of the specified prim.
// If prim is an instance, return the children that pass this predicate
// as instance proxy prims.
prim.GetFilteredChildren(UsdTraverseInstanceProxies(UsdPrimIsModel || UsdPrimIsGroup));

Users may also call Usd_PrimFlagsPredicate::TraverseInstanceProxies to enable traversal beneath instance prims. This function is equivalent to:

predicate.TraverseInstanceProxies(true);

However, this function may be more convenient, especially when calling a prim traversal function with a default-constructed tautology predicate.

Definition at line 578 of file primFlags.h.

Usd_PrimFlagsPredicate UsdTraverseInstanceProxies ( )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Convenience method equivalent to calling UsdTraverseInstanceProxies with the UsdPrimDefaultPredicate that is used by default for prim traversals.

Definition at line 588 of file primFlags.h.

Variable Documentation

USD_API const Usd_PrimFlagsPredicate UsdPrimAllPrimsPredicate
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate