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

#include <stageLoadRules.h>

Public Types

enum  Rule { AllRule, OnlyRule, NoneRule }
 

Public Member Functions

 UsdStageLoadRules ()=default
 Construct rules that load all payloads. More...
 
 UsdStageLoadRules (UsdStageLoadRules const &)=default
 
 UsdStageLoadRules (UsdStageLoadRules &&)=default
 
UsdStageLoadRulesoperator= (UsdStageLoadRules const &)=default
 
UsdStageLoadRulesoperator= (UsdStageLoadRules &&)=default
 
USD_API void LoadWithDescendants (SdfPath const &path)
 
USD_API void LoadWithoutDescendants (SdfPath const &path)
 
USD_API void Unload (SdfPath const &path)
 
USD_API void LoadAndUnload (const SdfPathSet &loadSet, const SdfPathSet &unloadSet, UsdLoadPolicy policy)
 
USD_API void AddRule (SdfPath const &path, Rule rule)
 Add a literal rule. If there's already a rule for path, replace it. More...
 
USD_API void SetRules (std::vector< std::pair< SdfPath, Rule >> const &rules)
 Set literal rules, must be sorted by SdfPath::operator<. More...
 
void SetRules (std::vector< std::pair< SdfPath, Rule >> &&rules)
 Set literal rules, must be sorted by SdfPath::operator<. More...
 
USD_API void Minimize ()
 
USD_API bool IsLoaded (SdfPath const &path) const
 
USD_API bool IsLoadedWithAllDescendants (SdfPath const &path) const
 
USD_API bool IsLoadedWithNoDescendants (SdfPath const &path) const
 
USD_API Rule GetEffectiveRuleForPath (SdfPath const &path) const
 
std::vector< std::pair
< SdfPath, Rule > > const & 
GetRules () const
 Return all the rules as a vector. More...
 
USD_API bool operator== (UsdStageLoadRules const &other) const
 
bool operator!= (UsdStageLoadRules const &other) const
 
void swap (UsdStageLoadRules &other)
 Swap the contents of these rules with other. More...
 

Static Public Member Functions

static UsdStageLoadRules LoadAll ()
 
static USD_API UsdStageLoadRules LoadNone ()
 Return rules that load no payloads. More...
 

Friends

USD_API std::ostream & operator<< (std::ostream &, std::pair< SdfPath, Rule > const &)
 
USD_API std::ostream & operator<< (std::ostream &, UsdStageLoadRules const &)
 Stream a text representation of a UsdStageLoadRules object. More...
 
USD_API size_t hash_value (UsdStageLoadRules const &)
 Return the hash code for a UsdStageLoadRules object. More...
 

Detailed Description

This class represents rules that govern payload inclusion on UsdStages.

Rules are represented as pairs of SdfPath and a Rule enum value, one of AllRule, OnlyRule, and NoneRule. To understand how rules apply to particular paths, see UsdStageLoadRules::GetEffectiveRuleForPath().

Convenience methods for manipulating rules by typical 'Load' and 'Unload' operations are provided in UsdStageLoadRules::LoadWithoutDescendants(), UsdStageLoadRules::LoadWithDescendants(), UsdStageLoadRules::Unload().

For finer-grained rule crafting, see AddRule().

Remove redundant rules that do not change the effective load state with UsdStageLoadRules::Minimize().

Definition at line 56 of file stageLoadRules.h.

Member Enumeration Documentation

These values are paired with paths to govern payload inclusion on UsdStages.

Enumerator
AllRule 

Include payloads on the specified prim and all descendants.

OnlyRule 

Include payloads on the specified prim but no descendants.

NoneRule 

Exclude payloads on the specified prim and all descendants.

Definition at line 63 of file stageLoadRules.h.

Constructor & Destructor Documentation

UsdStageLoadRules::UsdStageLoadRules ( )
default

Construct rules that load all payloads.

UsdStageLoadRules::UsdStageLoadRules ( UsdStageLoadRules const &  )
default
UsdStageLoadRules::UsdStageLoadRules ( UsdStageLoadRules &&  )
default

Member Function Documentation

USD_API void UsdStageLoadRules::AddRule ( SdfPath const &  path,
Rule  rule 
)

Add a literal rule. If there's already a rule for path, replace it.

USD_API Rule UsdStageLoadRules::GetEffectiveRuleForPath ( SdfPath const &  path) const

Return the "effective" rule for the given path. For example, if the closest ancestral rule of path is an AllRule, return AllRule. If the closest ancestral rule of path is for path itself and it is an OnlyRule, return OnlyRule. Otherwise if there is a closest descendant rule to path this is an OnlyRule or an AllRule, return OnlyRule. Otherwise return NoneRule.

std::vector<std::pair<SdfPath, Rule> > const& UsdStageLoadRules::GetRules ( ) const
inline

Return all the rules as a vector.

Definition at line 179 of file stageLoadRules.h.

USD_API bool UsdStageLoadRules::IsLoaded ( SdfPath const &  path) const

Return true if the given path is considered loaded by these rules, or false if it is considered unloaded. This is equivalent to GetEffectiveRuleForPath(path) != NoneRule.

USD_API bool UsdStageLoadRules::IsLoadedWithAllDescendants ( SdfPath const &  path) const

Return true if the given path and all descendants are considered loaded by these rules; false otherwise.

USD_API bool UsdStageLoadRules::IsLoadedWithNoDescendants ( SdfPath const &  path) const

Return true if the given path and is considered loaded, but none of its descendants are considered loaded by these rules; false otherwise.

static UsdStageLoadRules UsdStageLoadRules::LoadAll ( )
inlinestatic

Return rules that load all payloads. This is equivalent to default-constructed UsdStageLoadRules.

Definition at line 77 of file stageLoadRules.h.

USD_API void UsdStageLoadRules::LoadAndUnload ( const SdfPathSet loadSet,
const SdfPathSet unloadSet,
UsdLoadPolicy  policy 
)

Add rules as if Unload() was called for each element of unloadSet followed by calls to either LoadWithDescendants() (if policy is UsdLoadPolicy::LoadWithDescendants) or LoadWithoutDescendants() (if policy is UsdLoadPolicy::LoadWithoutDescendants) for each element of loadSet.

static USD_API UsdStageLoadRules UsdStageLoadRules::LoadNone ( )
static

Return rules that load no payloads.

USD_API void UsdStageLoadRules::LoadWithDescendants ( SdfPath const &  path)

Add a rule indicating that path, all its ancestors, and all its descendants shall be loaded.

Any previous rules created by calling LoadWithoutDescendants() or Unload() on this path or descendant paths are replaced by this rule. For example, calling LoadWithoutDescendants('/World/sets/kitchen') followed by LoadWithDescendants('/World/sets') will effectively remove the rule created in the first call. See AddRule() for more direct manipulation.

USD_API void UsdStageLoadRules::LoadWithoutDescendants ( SdfPath const &  path)

Add a rule indicating that path and all its ancestors but none of its descendants shall be loaded.

Any previous rules created by calling LoadWithDescendants() or Unload() on this path or descendant paths are replaced or restricted by this rule. For example, calling LoadWithDescendants('/World/sets') followed by LoadWithoutDescendants('/World/sets/kitchen') will cause everything under '/World/sets' to load except for those things under '/World/sets/kitchen'. See AddRule() for more direct manipulation.

USD_API void UsdStageLoadRules::Minimize ( )

Remove any redundant rules to make the set of rules as small as possible without changing behavior.

bool UsdStageLoadRules::operator!= ( UsdStageLoadRules const &  other) const
inline

Return false if other has exactly the same set of rules as this. See operator==().

Definition at line 192 of file stageLoadRules.h.

UsdStageLoadRules& UsdStageLoadRules::operator= ( UsdStageLoadRules const &  )
default
UsdStageLoadRules& UsdStageLoadRules::operator= ( UsdStageLoadRules &&  )
default
USD_API bool UsdStageLoadRules::operator== ( UsdStageLoadRules const &  other) const

Return true if other has exactly the same set of rules as this. Note that this means rules that are functionally equivalent may compare inequal. If this is not desired, ensure both sets of rules are reduced by Minimize() first.

USD_API void UsdStageLoadRules::SetRules ( std::vector< std::pair< SdfPath, Rule >> const &  rules)

Set literal rules, must be sorted by SdfPath::operator<.

void UsdStageLoadRules::SetRules ( std::vector< std::pair< SdfPath, Rule >> &&  rules)
inline

Set literal rules, must be sorted by SdfPath::operator<.

Definition at line 144 of file stageLoadRules.h.

void UsdStageLoadRules::swap ( UsdStageLoadRules other)
inline

Swap the contents of these rules with other.

Definition at line 197 of file stageLoadRules.h.

USD_API void UsdStageLoadRules::Unload ( SdfPath const &  path)

Add a rule indicating that path and all its descendants shall be unloaded.

Any previous rules created by calling LoadWithDescendants() or LoadWithoutDescendants() on this path or descendant paths are replaced or restricted by this rule. For example, calling LoadWithDescendants('/World/sets') followed by Unload('/World/sets/kitchen') will cause everything under '/World/sets' to load, except for '/World/sets/kitchen' and everything under it.

Friends And Related Function Documentation

USD_API size_t hash_value ( UsdStageLoadRules const &  )
friend

Return the hash code for a UsdStageLoadRules object.

USD_API std::ostream& operator<< ( std::ostream &  ,
std::pair< SdfPath, Rule > const &   
)
friend

Stream a text representation of a pair of SdfPath and UsdStageLoadRules::Rule.

USD_API std::ostream& operator<< ( std::ostream &  ,
UsdStageLoadRules const &   
)
friend

Stream a text representation of a UsdStageLoadRules object.


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