bevy/crates/bevy_core_pipeline/src
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
..
auto_exposure Don't ask for ResMut in queue_view_auto_exposure_pipelines (#14762) 2024-08-15 17:15:31 +00:00
blit Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bloom Expose max_mip_dimension and uv_offset in BloomSettings. (#14512) 2024-08-13 15:01:42 +00:00
contrast_adaptive_sharpening Using Cas instead of CAS #14341 (#14357) 2024-07-20 18:12:24 +00:00
core_2d Fix pass_span drop panic obscuring transparent 2d render errors (#14758) 2024-08-15 18:41:01 +00:00
core_3d Have EntityCommands methods consume self for easier chaining (#14897) 2024-08-26 18:24:59 +00:00
deferred Don't ignore draw errors (#13240) 2024-07-22 19:22:30 +00:00
dof Remove Component derive for DepthOfFieldMode (#14761) 2024-08-15 17:14:49 +00:00
fullscreen_vertex_shader Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
fxaa Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
motion_blur Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00
post_process Start a built-in postprocessing stack, and implement chromatic aberration in it. (#13695) 2024-07-15 13:59:02 +00:00
prepass Don't ignore draw errors (#13240) 2024-07-22 19:22:30 +00:00
skybox Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00
smaa Fixup Msaa docs. (#14442) 2024-07-22 21:37:25 +00:00
taa Fix TAA on camera with viewport (#14582) 2024-08-07 23:59:38 +00:00
tonemapping Skip tonemapping in case it is none (#13679) 2024-06-05 11:32:46 +00:00
upscaling Ignore PipelineCache ambiguities (#14772) 2024-08-16 23:43:40 +00:00
lib.rs Using Cas instead of CAS #14341 (#14357) 2024-07-20 18:12:24 +00:00
msaa_writeback.rs Move Msaa to component (#14273) 2024-07-22 18:28:23 +00:00