pub struct NodeHandleMap<N> { /* private fields */ }
Expand description
A OriginalHandle -> CopyHandle
map. It is used to map handles to nodes after copying.
For example, scene nodes have lots of cross references, the simplest cross reference is a handle to parent node, and a set of handles to children nodes. Skinned meshes also store handles to scenes nodes that serve as bones. When you copy a node, you need handles of the copy to point to respective copies. This map allows you to do this.
Mapping could fail if you do a partial copy of some hierarchy that does not have respective copies of nodes that must be remapped. For example you can copy just a skinned mesh, but not its bones - in this case mapping will fail, but you still can use old handles even it does not make any sense.
Implementations§
Source§impl<N> NodeHandleMap<N>where
N: Reflect + NameProvider,
impl<N> NodeHandleMap<N>where
N: Reflect + NameProvider,
Sourcepub fn insert(
&mut self,
original_handle: Handle<N>,
copy_handle: Handle<N>,
) -> Option<Handle<N>>
pub fn insert( &mut self, original_handle: Handle<N>, copy_handle: Handle<N>, ) -> Option<Handle<N>>
Adds new original -> copy
handle mapping.
Sourcepub fn map(&self, handle: &mut Handle<N>) -> &Self
pub fn map(&self, handle: &mut Handle<N>) -> &Self
Maps a handle to a handle of its origin, or sets it to Handle::NONE if there is no such node. It should be used when you are sure that respective origin exists.
Sourcepub fn map_slice<T>(&self, handles: &mut [T]) -> &Self
pub fn map_slice<T>(&self, handles: &mut [T]) -> &Self
Maps each handle in the slice to a handle of its origin, or sets it to Handle::NONE if there is no such node. It should be used when you are sure that respective origin exists.
Sourcepub fn try_map(&self, handle: &mut Handle<N>) -> bool
pub fn try_map(&self, handle: &mut Handle<N>) -> bool
Tries to map a handle to a handle of its origin. If it exists, the method returns true or false otherwise. It should be used when you not sure that respective origin exists.
Sourcepub fn try_map_slice<T>(&self, handles: &mut [T]) -> bool
pub fn try_map_slice<T>(&self, handles: &mut [T]) -> bool
Tries to map each handle in the slice to a handle of its origin. If it exists, the method returns true or false otherwise. It should be used when you not sure that respective origin exists.
Sourcepub fn try_map_silent(
&self,
inheritable_handle: &mut InheritableVariable<Handle<N>>,
) -> bool
pub fn try_map_silent( &self, inheritable_handle: &mut InheritableVariable<Handle<N>>, ) -> bool
Tries to silently map (without setting modified
flag) a templated handle to a handle of its origin.
If it exists, the method returns true or false otherwise. It should be used when you not sure that respective
origin exists.
Sourcepub fn inner(&self) -> &FxHashMap<Handle<N>, Handle<N>>
pub fn inner(&self) -> &FxHashMap<Handle<N>, Handle<N>>
Returns a shared reference to inner map.
Sourcepub fn into_inner(self) -> FxHashMap<Handle<N>, Handle<N>>
pub fn into_inner(self) -> FxHashMap<Handle<N>, Handle<N>>
Returns inner map.
Sourcepub fn remap_handles(&self, node: &mut N, ignored_types: &[TypeId])
pub fn remap_handles(&self, node: &mut N, ignored_types: &[TypeId])
Tries to remap handles to nodes in a given entity using reflection. It finds all supported fields recursively
(Handle<Node>
, Vec<Handle<Node>>
, InheritableVariable<Handle<Node>>
, InheritableVariable<Vec<Handle<Node>>>
)
and automatically maps old handles to new.
pub fn remap_inheritable_handles(&self, node: &mut N, ignored_types: &[TypeId])
Trait Implementations§
Source§impl<N> Clone for NodeHandleMap<N>
impl<N> Clone for NodeHandleMap<N>
Auto Trait Implementations§
impl<N> Freeze for NodeHandleMap<N>
impl<N> RefUnwindSafe for NodeHandleMap<N>where
N: RefUnwindSafe,
impl<N> Send for NodeHandleMap<N>
impl<N> Sync for NodeHandleMap<N>
impl<N> Unpin for NodeHandleMap<N>where
N: Unpin,
impl<N> UnwindSafe for NodeHandleMap<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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 as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any
. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
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.