pub struct SubSelection { /* private fields */ }Expand description
A set of selected sub-objects (faces, vertices, edges, or points) across one or more parent objects.
Parallel to crate::interaction::selection::Selection but operates at
sub-object granularity. Each entry pairs a parent object_id with a
SubObjectRef. No ordering is maintained beyond the tracked primary.
§Typical usage
Hold a SubSelection alongside a Selection. Use Selection to track
which objects are selected at object level; use SubSelection to track
which specific faces or points within those objects are highlighted.
// On rect-pick:
let rect_result = pick_rect(...);
sub_sel.clear();
sub_sel.extend_from_rect_pick(&rect_result);
// On ray-pick (face highlight):
if let Some(sub) = hit.sub_object {
sub_sel.select_one(hit.id, sub);
}Implementations§
Source§impl SubSelection
impl SubSelection
Sourcepub fn version(&self) -> u64
pub fn version(&self) -> u64
Monotonically increasing generation counter.
Incremented by wrapping_add(1) on every mutation. Compare against a
cached value to detect changes without re-hashing.
Sourcepub fn select_one(&mut self, object_id: NodeId, sub: SubObjectRef)
pub fn select_one(&mut self, object_id: NodeId, sub: SubObjectRef)
Clear and select exactly one sub-object.
Sourcepub fn toggle(&mut self, object_id: NodeId, sub: SubObjectRef)
pub fn toggle(&mut self, object_id: NodeId, sub: SubObjectRef)
Toggle a sub-object in or out of the selection.
If added, it becomes the primary. If removed, primary is cleared or set to an arbitrary remaining entry.
Sourcepub fn add(&mut self, object_id: NodeId, sub: SubObjectRef)
pub fn add(&mut self, object_id: NodeId, sub: SubObjectRef)
Add a sub-object without clearing others.
Sourcepub fn remove(&mut self, object_id: NodeId, sub: SubObjectRef)
pub fn remove(&mut self, object_id: NodeId, sub: SubObjectRef)
Remove a sub-object from the selection.
Sourcepub fn extend(
&mut self,
items: impl IntoIterator<Item = (NodeId, SubObjectRef)>,
)
pub fn extend( &mut self, items: impl IntoIterator<Item = (NodeId, SubObjectRef)>, )
Extend from an iterator of (object_id, SubObjectRef) pairs.
The last pair becomes primary.
Sourcepub fn extend_from_rect_pick(&mut self, result: &RectPickResult)
pub fn extend_from_rect_pick(&mut self, result: &RectPickResult)
Populate from a RectPickResult.
Adds all sub-objects from the rect pick without clearing the current
selection. Call clear first if you want a fresh selection.
Sourcepub fn contains(&self, object_id: NodeId, sub: SubObjectRef) -> bool
pub fn contains(&self, object_id: NodeId, sub: SubObjectRef) -> bool
Whether a specific sub-object is selected.
Sourcepub fn primary(&self) -> Option<(NodeId, SubObjectRef)>
pub fn primary(&self) -> Option<(NodeId, SubObjectRef)>
The most recently selected (object_id, SubObjectRef) pair.
Sourcepub fn iter(&self) -> impl Iterator<Item = &(NodeId, SubObjectRef)>
pub fn iter(&self) -> impl Iterator<Item = &(NodeId, SubObjectRef)>
Iterate over all selected (object_id, SubObjectRef) pairs.
Sourcepub fn for_object(
&self,
object_id: NodeId,
) -> impl Iterator<Item = SubObjectRef> + '_
pub fn for_object( &self, object_id: NodeId, ) -> impl Iterator<Item = SubObjectRef> + '_
All sub-object refs for a specific parent object.
Sourcepub fn face_count(&self) -> usize
pub fn face_count(&self) -> usize
Count of selected faces across all objects.
Sourcepub fn point_count(&self) -> usize
pub fn point_count(&self) -> usize
Count of selected points across all objects.
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Count of selected vertices across all objects.
Sourcepub fn voxel_count(&self) -> usize
pub fn voxel_count(&self) -> usize
Count of selected voxels across all objects.
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Count of selected cells across all objects.
Trait Implementations§
Source§impl Clone for SubSelection
impl Clone for SubSelection
Source§fn clone(&self) -> SubSelection
fn clone(&self) -> SubSelection
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 SubSelection
impl Debug for SubSelection
Source§impl Default for SubSelection
impl Default for SubSelection
Source§fn default() -> SubSelection
fn default() -> SubSelection
Auto Trait Implementations§
impl Freeze for SubSelection
impl RefUnwindSafe for SubSelection
impl Send for SubSelection
impl Sync for SubSelection
impl Unpin for SubSelection
impl UnsafeUnpin for SubSelection
impl UnwindSafe for SubSelection
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.