pub struct NodeHandleMap { /* private fields */ }Expand description
A OriginalHandle -> CopyHandle map. It is used to map handles to nodes after copying.
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 NodeHandleMap
impl NodeHandleMap
sourcepub fn map(&self, handle: &mut Handle<Node>) -> &Self
pub fn map(&self, handle: &mut Handle<Node>) -> &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]) -> &Selfwhere
T: Deref<Target = Handle<Node>> + DerefMut,
pub fn map_slice<T>(&self, handles: &mut [T]) -> &Selfwhere T: Deref<Target = Handle<Node>> + DerefMut,
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<Node>) -> bool
pub fn try_map(&self, handle: &mut Handle<Node>) -> 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]) -> boolwhere
T: Deref<Target = Handle<Node>> + DerefMut,
pub fn try_map_slice<T>(&self, handles: &mut [T]) -> boolwhere T: Deref<Target = Handle<Node>> + DerefMut,
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<Node>>
) -> bool
pub fn try_map_silent( &self, inheritable_handle: &mut InheritableVariable<Handle<Node>> ) -> 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<Node>, Handle<Node>>
pub fn inner(&self) -> &FxHashMap<Handle<Node>, Handle<Node>>
Returns a shared reference to inner map.
sourcepub fn remap_handles(&self, node: &mut Node)
pub fn remap_handles(&self, node: &mut Node)
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.
Trait Implementations§
source§impl Clone for NodeHandleMap
impl Clone for NodeHandleMap
source§fn clone(&self) -> NodeHandleMap
fn clone(&self) -> NodeHandleMap
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Default for NodeHandleMap
impl Default for NodeHandleMap
source§fn default() -> NodeHandleMap
fn default() -> NodeHandleMap
Auto Trait Implementations§
impl !RefUnwindSafe for NodeHandleMap
impl Send for NodeHandleMap
impl Sync for NodeHandleMap
impl Unpin for NodeHandleMap
impl !UnwindSafe for NodeHandleMap
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§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.§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.§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.§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> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ScriptMessagePayload for Twhere
T: 'static + Send,
impl<T> ScriptMessagePayload for Twhere T: 'static + Send,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self as &dyn Anysource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self as &dyn Any§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.