Skip to main content

PopulationMask

Struct PopulationMask 

Source
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

Source

pub fn all() -> Self

Creates a mask that includes the full stage.

Source

pub fn empty() -> Self

Creates an empty mask, which includes nothing.

Source

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

Source

pub fn with_path(self, path: impl IntoPath) -> Result<Self, PopulationMaskError>

Returns a copy of this mask with path added.

Source

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.

Source

pub fn paths(&self) -> &[Path]

Returns the mask paths, sorted and with redundant descendants removed.

Source

pub fn is_empty(&self) -> bool

Returns true if the mask contains no paths, and so includes nothing.

Source

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 [/].

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> PopulationMask

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PopulationMask

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PopulationMask

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for PopulationMask

Source§

impl Hash for PopulationMask

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PopulationMask

Source§

fn eq(&self, other: &PopulationMask) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PopulationMask

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.