Loading...
Searching...
No Matches
UsdStageLoadRules Class Reference

This class represents rules that govern payload inclusion on UsdStages. More...

#include <stageLoadRules.h>

Public Types

enum  Rule { AllRule , OnlyRule , NoneRule }
 These values are paired with paths to govern payload inclusion on UsdStages. More...
 

Public Member Functions

 UsdStageLoadRules ()=default
 Construct rules that load all payloads.
 
 UsdStageLoadRules (UsdStageLoadRules const &)=default
 
 UsdStageLoadRules (UsdStageLoadRules &&)=default
 
UsdStageLoadRulesoperator= (UsdStageLoadRules const &)=default
 
UsdStageLoadRulesoperator= (UsdStageLoadRules &&)=default
 
USD_API void LoadWithDescendants (SdfPath const &path)
 Add a rule indicating that path, all its ancestors, and all its descendants shall be loaded.
 
USD_API void LoadWithoutDescendants (SdfPath const &path)
 Add a rule indicating that path and all its ancestors but none of its descendants shall be loaded.
 
USD_API void Unload (SdfPath const &path)
 Add a rule indicating that path and all its descendants shall be unloaded.
 
USD_API void 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.
 
USD_API void AddRule (SdfPath const &path, Rule rule)
 Add a literal rule. If there's already a rule for path, replace it.
 
USD_API void SetRules (std::vector< std::pair< SdfPath, Rule > > const &rules)
 Set literal rules, must be sorted by SdfPath::operator<.
 
void SetRules (std::vector< std::pair< SdfPath, Rule > > &&rules)
 Set literal rules, must be sorted by SdfPath::operator<.
 
USD_API void Minimize ()
 Remove any redundant rules to make the set of rules as small as possible without changing behavior.
 
USD_API bool IsLoaded (SdfPath const &path) const
 Return true if the given path is considered loaded by these rules, or false if it is considered unloaded.
 
USD_API bool 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 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.
 
USD_API Rule GetEffectiveRuleForPath (SdfPath const &path) const
 Return the "effective" rule for the given path.
 
std::vector< std::pair< SdfPath, Rule > > const & GetRules () const
 Return all the rules as a vector.
 
USD_API bool operator== (UsdStageLoadRules const &other) const
 Return true if other has exactly the same set of rules as this.
 
bool operator!= (UsdStageLoadRules const &other) const
 Return false if other has exactly the same set of rules as this.
 
void swap (UsdStageLoadRules &other)
 Swap the contents of these rules with other.
 

Static Public Member Functions

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

Friends

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

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

◆ Rule

enum Rule

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.

Member Function Documentation

◆ AddRule()

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

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

◆ GetEffectiveRuleForPath()

USD_API Rule 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.

◆ GetRules()

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

Return all the rules as a vector.

Definition at line 179 of file stageLoadRules.h.

◆ IsLoaded()

USD_API bool 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.

◆ IsLoadedWithAllDescendants()

USD_API bool IsLoadedWithAllDescendants ( SdfPath const &  path) const

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

◆ IsLoadedWithNoDescendants()

USD_API bool 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.

◆ LoadAll()

static UsdStageLoadRules LoadAll ( )
inlinestatic

Return rules that load all payloads.

This is equivalent to default-constructed UsdStageLoadRules.

Definition at line 77 of file stageLoadRules.h.

◆ LoadAndUnload()

USD_API void 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.

◆ LoadNone()

static USD_API UsdStageLoadRules LoadNone ( )
static

Return rules that load no payloads.

◆ LoadWithDescendants()

USD_API void 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.

◆ LoadWithoutDescendants()

USD_API void 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.

◆ Minimize()

USD_API void Minimize ( )

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

◆ operator!=()

bool 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.

◆ operator==()

USD_API bool 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.

◆ SetRules() [1/2]

void 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.

◆ SetRules() [2/2]

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

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

◆ swap()

void swap ( UsdStageLoadRules other)
inline

Swap the contents of these rules with other.

Definition at line 197 of file stageLoadRules.h.

◆ Unload()

USD_API void 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

◆ hash_value

USD_API size_t hash_value ( UsdStageLoadRules const &  )
friend

Return the hash code for a UsdStageLoadRules object.

◆ operator<< [1/2]

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.

◆ operator<< [2/2]

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: