|
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 | |
UsdStageLoadRules & | operator= (UsdStageLoadRules const &)=default |
UsdStageLoadRules & | operator= (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. | |
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 39 of file stageLoadRules.h.
enum Rule |
These values are paired with paths to govern payload inclusion on UsdStages.
Definition at line 46 of file stageLoadRules.h.
|
default |
Construct rules that load all payloads.
Add a literal rule. If there's already a rule for path
, replace it.
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
.
Return all the rules as a vector.
Definition at line 162 of file stageLoadRules.h.
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.
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.
|
inlinestatic |
Return rules that load all payloads.
This is equivalent to default-constructed UsdStageLoadRules.
Definition at line 60 of file stageLoadRules.h.
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
.
|
static |
Return rules that load no payloads.
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.
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.
USD_API void Minimize | ( | ) |
Remove any redundant rules to make the set of rules as small as possible without changing behavior.
|
inline |
Return false if other
has exactly the same set of rules as this.
See operator==().
Definition at line 175 of file stageLoadRules.h.
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.
Set literal rules, must be sorted by SdfPath::operator<.
Definition at line 127 of file stageLoadRules.h.
Set literal rules, must be sorted by SdfPath::operator<.
|
inline |
Swap the contents of these rules with other
.
Definition at line 180 of file stageLoadRules.h.
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.
|
friend |
Return the hash code for a UsdStageLoadRules object.
Stream a text representation of a pair of SdfPath and UsdStageLoadRules::Rule.
|
friend |
Stream a text representation of a UsdStageLoadRules object.