fn check_and_terminate_animation<T>(
    control_id: u64,
    hierarchy: &AnimationHierarchy<T>,
    samplers: &mut WriteStorage<SamplerControlSet<T>>,
) -> bool
where
    T: AnimationSampling,
{
    // Check for termination
    if check_termination(control_id, hierarchy, &samplers) {
        // Do termination
        for (_, node_entity) in &hierarchy.nodes {
            let empty = samplers
                .get_mut(*node_entity)
                .map(|sampler| {
                    sampler.clear(control_id);
                    sampler.is_empty()
                })
                .unwrap_or(false);
            if empty {
                samplers.remove(*node_entity);
            }
        }
        true
    } else {
        // Request termination of samplers
        for (_, node_entity) in &hierarchy.nodes {
            if let Some(ref mut s) = samplers.get_mut(*node_entity) {
                s.abort(control_id);
            }
        }
        false
    }
}
/// Check if all nodes in an `AnimationHierarchy` are ready for termination, if so remove all
/// `SamplerControlSet`s for the hierarchy, if not request termination on all sampler controls
Check if all nodes in an `AnimationHierarchy` are ready for termination, if so remove all
`SamplerControlSet`s for the hierarchy, if not request termination on all sampler controls
Check if all nodes in an ` AnimationHierarchy ` are ready for termination if so remove all ` SamplerControlSet ` s for the hierarchy if not request termination on all sampler controls
fn check_and_terminate_animation<T>(
    control_id: u64,
    hierarchy: &AnimationHierarchy<T>,
    samplers: &mut WriteStorage<SamplerControlSet<T>>,
) -> bool
where
    T: AnimationSampling,
{
    // Check for termination
    if check_termination(control_id, hierarchy, &samplers) {
        // Do termination
        for (_, node_entity) in &hierarchy.nodes {
            let empty = samplers
                .get_mut(*node_entity)
                .map(|sampler| {
                    sampler.clear(control_id);
                    sampler.is_empty()
                })
                .unwrap_or(false);
            if empty {
                samplers.remove(*node_entity);
            }
        }
        true
    } else {
        // Request termination of samplers
        for (_, node_entity) in &hierarchy.nodes {
            if let Some(ref mut s) = samplers.get_mut(*node_entity) {
                s.abort(control_id);
            }
        }
        false
    }
}
fn check_and_terminate_animation < T > ( control_id : u64 , hierarchy : & AnimationHierarchy < T > , samplers : & mut WriteStorage < SamplerControlSet < T > > , ) -> bool where T : AnimationSampling , { // Check for termination if check_termination ( control_id , hierarchy , & samplers ) { // Do termination for ( _ , node_entity ) in & hierarchy . nodes { let empty = samplers . get_mut ( * node_entity ) . map ( | sampler | { sampler . clear ( control_id ) ; sampler . is_empty ( ) } ) . unwrap_or ( false ) ; if empty { samplers . remove ( * node_entity ) ; } } true } else { // Request termination of samplers for ( _ , node_entity ) in & hierarchy . nodes { if let Some ( ref mut s ) = samplers . get_mut ( * node_entity ) { s . abort ( control_id ) ; } } false } }
Check if all nodes in an `AnimationHierarchy` are ready for termination, if so remove all
`SamplerControlSet`s for the hierarchy, if not request termination on all sampler controls
Check if all nodes in an ` AnimationHierarchy ` are ready for termination if so remove all ` SamplerControlSet ` s for the hierarchy if not request termination on all sampler controls
control_id
u64
hierarchy
&AnimationHierarchy<T>
samplers
&mut WriteStorage<SamplerControlSet<T>>
control_id
u64
hierarchy
&AnimationHierarchy<T>
samplers
&mut WriteStorage<SamplerControlSet<T>>