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>) -> &NodeHandleMap<N>
pub fn map(&self, handle: &mut Handle<N>) -> &NodeHandleMap<N>
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]) -> &NodeHandleMap<N>
pub fn map_slice<T>(&self, handles: &mut [T]) -> &NodeHandleMap<N>
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,
) -> &HashMap<Handle<N>, Handle<N>, BuildHasherDefault<FxHasher>>
pub fn inner( &self, ) -> &HashMap<Handle<N>, Handle<N>, BuildHasherDefault<FxHasher>>
Returns a shared reference to inner map.
Sourcepub fn into_inner(
self,
) -> HashMap<Handle<N>, Handle<N>, BuildHasherDefault<FxHasher>>
pub fn into_inner( self, ) -> HashMap<Handle<N>, Handle<N>, BuildHasherDefault<FxHasher>>
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>
Source§fn clone(&self) -> NodeHandleMap<N>
fn clone(&self) -> NodeHandleMap<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<N> Default for NodeHandleMap<N>
impl<N> Default for NodeHandleMap<N>
Source§fn default() -> NodeHandleMap<N>
fn default() -> 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 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>
. Box<dyn Any>
can
then be further downcast
into Box<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>
. Rc<Any>
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> 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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
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<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.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.