8#ifndef PXR_USD_USD_STAGE_LOAD_RULES_H
9#define PXR_USD_USD_STAGE_LOAD_RULES_H
14#include "pxr/usd/usd/api.h"
16#include "pxr/usd/sdf/path.h"
21PXR_NAMESPACE_OPEN_SCOPE
124 void SetRules(std::vector<std::pair<SdfPath, Rule>>
const &rules);
127 inline void SetRules(std::vector<std::pair<SdfPath, Rule>> &&rules) {
128 _rules = std::move(rules);
162 inline std::vector<std::pair<SdfPath, Rule>>
const &
GetRules()
const {
176 return !(*
this == other);
181 _rules.swap(other._rules);
185 friend USD_API std::ostream &
186 operator<<(std::ostream &, std::pair<SdfPath, Rule>
const &);
188 friend USD_API std::ostream &
195 std::vector<std::pair<SdfPath, Rule> >::const_iterator
196 _LowerBound(
SdfPath const &path)
const;
199 std::vector<std::pair<SdfPath, Rule> >::iterator
200 _LowerBound(
SdfPath const &path);
202 std::vector<std::pair<SdfPath, Rule>> _rules;
220 std::pair<SdfPath, UsdStageLoadRules::Rule>
const &);
227PXR_NAMESPACE_CLOSE_SCOPE
A path value used to locate objects in layers or scenegraphs.
This class represents rules that govern payload inclusion on UsdStages.
friend USD_API size_t hash_value(UsdStageLoadRules const &)
Return the hash code for a UsdStageLoadRules object.
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 unloa...
void SetRules(std::vector< std::pair< SdfPath, Rule > > &&rules)
Set literal rules, must be sorted by SdfPath::operator<.
Rule
These values are paired with paths to govern payload inclusion on UsdStages.
@ AllRule
Include payloads on the specified prim and all descendants.
@ NoneRule
Exclude payloads on the specified prim and all descendants.
@ OnlyRule
Include payloads on the specified prim but no descendants.
std::vector< std::pair< SdfPath, Rule > > const & GetRules() const
Return all the rules as a vector.
friend USD_API std::ostream & operator<<(std::ostream &, std::pair< SdfPath, Rule > const &)
Stream a text representation of a pair of SdfPath and UsdStageLoadRules::Rule.
bool operator!=(UsdStageLoadRules const &other) const
Return false if other has exactly the same set of rules as this.
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<.
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 bool IsLoadedWithNoDescendants(SdfPath const &path) const
Return true if the given path and is considered loaded, but none of its descendants are considered lo...
USD_API void Minimize()
Remove any redundant rules to make the set of rules as small as possible without changing behavior.
USD_API Rule GetEffectiveRuleForPath(SdfPath const &path) const
Return the "effective" rule for the given path.
USD_API bool IsLoadedWithAllDescendants(SdfPath const &path) const
Return true if the given path and all descendants are considered loaded by these rules; false otherwi...
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 Unload(SdfPath const &path)
Add a rule indicating that path and all its descendants shall be unloaded.
void swap(UsdStageLoadRules &other)
Swap the contents of these rules with other.
static USD_API UsdStageLoadRules LoadNone()
Return rules that load no payloads.
USD_API bool operator==(UsdStageLoadRules const &other) const
Return true if other has exactly the same set of rules as this.
UsdStageLoadRules()=default
Construct rules that load all payloads.
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 LoadWit...
static UsdStageLoadRules LoadAll()
Return rules that load all payloads.
UsdLoadPolicy
Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or not descendant prims are ...
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
USD_API size_t hash_value(UsdStageLoadRules const &)
Return the hash code for a UsdStageLoadRules object.
void swap(UsdStageLoadRules &l, UsdStageLoadRules &r)
Swap the contents of rules l and r.