bevy/examples/animation
Shane 484721be80
Have EntityCommands methods consume self for easier chaining (#14897)
# Objective

Fixes #14883

## Solution

Pretty simple update to `EntityCommands` methods to consume `self` and
return it rather than taking `&mut self`. The things probably worth
noting:

* I added `#[allow(clippy::should_implement_trait)]` to the `add` method
because it causes a linting conflict with `std::ops::Add`.
* `despawn` and `log_components` now return `Self`. I'm not sure if
that's exactly the desired behavior so I'm happy to adjust if that seems
wrong.

## Testing

Tested with `cargo run -p ci`. I think that should be sufficient to call
things good.

## Migration Guide

The most likely migration needed is changing code from this:

```
        let mut entity = commands.get_or_spawn(entity);

        if depth_prepass {
            entity.insert(DepthPrepass);
        }
        if normal_prepass {
            entity.insert(NormalPrepass);
        }
        if motion_vector_prepass {
            entity.insert(MotionVectorPrepass);
        }
        if deferred_prepass {
            entity.insert(DeferredPrepass);
        }
```

to this:

```
        let mut entity = commands.get_or_spawn(entity);

        if depth_prepass {
            entity = entity.insert(DepthPrepass);
        }
        if normal_prepass {
            entity = entity.insert(NormalPrepass);
        }
        if motion_vector_prepass {
            entity = entity.insert(MotionVectorPrepass);
        }
        if deferred_prepass {
            entity.insert(DeferredPrepass);
        }
```

as can be seen in several of the example code updates here. There will
probably also be instances where mutable `EntityCommands` vars no longer
need to be mutable.
2024-08-26 18:24:59 +00:00
..
animated_fox.rs Add AnimationGraph::from_clips and simplify animated_fox example (#14853) 2024-08-25 14:16:04 +00:00
animated_transform.rs Implement the AnimationGraph, allowing for multiple animations to be blended together. (#11989) 2024-03-07 20:22:42 +00:00
animation_graph.rs Have EntityCommands methods consume self for easier chaining (#14897) 2024-08-26 18:24:59 +00:00
color_animation.rs Disallow empty cubic and rational curves (#14382) 2024-07-29 23:25:14 +00:00
cubic_curve.rs Disallow empty cubic and rational curves (#14382) 2024-07-29 23:25:14 +00:00
custom_skinned_mesh.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
gltf_skinned_mesh.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
morph_targets.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00