pub struct PopulationMask { /* private fields */ }Expand description
Population mask limiting which prim paths a
Stage exposes (C++ UsdStagePopulationMask).
A mask path includes that prim’s subtree. Ancestors of masked paths are also included, so traversal can reach the requested working set.
The stored paths are a sorted antichain of absolute prim paths (C++
_ValidateAndNormalize): sorted so equal masks compare and hash equal —
required by InstanceKey — and free of redundant descendants so membership
is one binary search rather than a scan.
Implementations§
Source§impl PopulationMask
impl PopulationMask
Sourcepub fn new(
paths: impl IntoIterator<Item: IntoPath>,
) -> Result<Self, PopulationMaskError>
pub fn new( paths: impl IntoIterator<Item: IntoPath>, ) -> Result<Self, PopulationMaskError>
Creates a mask from prim paths, normalizing once: sort, then drop every
path an earlier one already covers. Sorting puts each path’s descendants
directly after it, which is exactly the neighbour dedup_by compares
against (C++ SdfPath::RemoveDescendentPaths).
Sourcepub fn with_path(self, path: impl IntoPath) -> Result<Self, PopulationMaskError>
pub fn with_path(self, path: impl IntoPath) -> Result<Self, PopulationMaskError>
Returns a copy of this mask with path added.
Sourcepub fn add_path(
&mut self,
path: impl IntoPath,
) -> Result<&mut Self, PopulationMaskError>
pub fn add_path( &mut self, path: impl IntoPath, ) -> Result<&mut Self, PopulationMaskError>
Adds a prim path to the mask, keeping it a sorted antichain: the path is inserted at its ordered position, and the descendants it subsumes are removed as one contiguous range. A path an existing entry already covers is dropped.
Sourcepub fn paths(&self) -> &[Path]
pub fn paths(&self) -> &[Path]
Returns the mask paths, sorted and with redundant descendants removed.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the mask contains no paths, and so includes nothing.
Sourcepub fn is_all(&self) -> bool
pub fn is_all(&self) -> bool
Returns true if the mask includes the full stage.
The absolute root covers every path, so normalization reduces a mask
containing it to exactly [/].
Sourcepub fn includes(&self, path: &Path) -> bool
pub fn includes(&self, path: &Path) -> bool
Returns true if path is inside the population mask — it lies at or
below a mask path, or is an ancestor of one so traversal can reach the
working set (C++ UsdStagePopulationMask::Includes).
Variant selection segments in path are stripped before matching so a
mask of /Prim/Child still includes opinions authored under
/Prim{set=sel}Child.
Sourcepub fn includes_subtree(&self, path: &Path) -> bool
pub fn includes_subtree(&self, path: &Path) -> bool
Returns true if the mask includes path and its entire subtree — that
is, path is at or below a mask path (C++
UsdStagePopulationMask::IncludesSubtree). Being a mere ancestor of a
mask path is not enough, since the rest of the subtree stays excluded.
Child filtering short-circuits on this: once a subtree is wholly included, no descendant needs testing.
Sourcepub fn make_relative_to(&self, instance: &Path) -> Self
pub fn make_relative_to(&self, instance: &Path) -> Self
Re-expresses this mask relative to instance, for use as an instancing
key ingredient (C++ Usd_InstanceKey’s _MakeMaskRelativeTo). Mask
paths below instance
are re-rooted onto the absolute root; those outside its subtree describe
nothing about it and are dropped.
An instance whose whole subtree the mask includes keys as
all. C++ derives the empty mask for that case and gets
away with it only because it never keys an instance the mask excluded,
which would derive the same empty mask; naming the two apart keeps the
distinction available here.
Trait Implementations§
Source§impl Clone for PopulationMask
impl Clone for PopulationMask
Source§fn clone(&self) -> PopulationMask
fn clone(&self) -> PopulationMask
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PopulationMask
impl Debug for PopulationMask
Source§impl Default for PopulationMask
impl Default for PopulationMask
impl Eq for PopulationMask
Source§impl Hash for PopulationMask
impl Hash for PopulationMask
Source§impl PartialEq for PopulationMask
impl PartialEq for PopulationMask
impl StructuralPartialEq for PopulationMask
Auto Trait Implementations§
impl Freeze for PopulationMask
impl RefUnwindSafe for PopulationMask
impl Send for PopulationMask
impl Sync for PopulationMask
impl Unpin for PopulationMask
impl UnsafeUnpin for PopulationMask
impl UnwindSafe for PopulationMask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.