bevy/crates/bevy_render/src
Carter Anderson d8fa57bd7b
Switch ChildOf back to tuple struct (#18672)
# Objective

In #17905 we swapped to a named field on `ChildOf` to help resolve
variable naming ambiguity of child vs parent (ex: `child_of.parent`
clearly reads as "I am accessing the parent of the child_of
relationship", whereas `child_of.0` is less clear).

Unfortunately this has the side effect of making initialization less
ideal. `ChildOf { parent }` reads just as well as `ChildOf(parent)`, but
`ChildOf { parent: root }` doesn't read nearly as well as
`ChildOf(root)`.

## Solution

Move back to `ChildOf(pub Entity)` but add a `child_of.parent()`
function and use it for all accesses. The downside here is that users
are no longer "forced" to access the parent field with `parent`
nomenclature, but I think this strikes the right balance.

Take a look at the diff. I think the results provide strong evidence for
this change. Initialization has the benefit of reading much better _and_
of taking up significantly less space, as many lines go from 3 to 1, and
we're cutting out a bunch of syntax in some cases.

Sadly I do think this should land in 0.16 as the cost of doing this
_after_ the relationships migration is high.
2025-04-02 00:10:10 +00:00
..
batching Use GpuPreprocessingMode::None if features not supported. (#18630) 2025-03-31 18:10:22 +00:00
camera Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 06:04:26 +00:00
diagnostic Tracy GPU support (#18490) 2025-03-28 04:57:01 +00:00
experimental bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
mesh Have the mesh allocator handle modified meshes (#18531) 2025-03-27 21:39:09 +00:00
primitives reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
render_graph Implement experimental GPU two-phase occlusion culling for the standard 3D mesh pipeline. (#17413) 2025-01-27 05:02:46 +00:00
render_phase Fix no indirect drawing (#18628) 2025-03-31 19:20:57 +00:00
render_resource Fix wesl in wasm and webgl2 (#18591) 2025-03-28 21:45:02 +00:00
renderer Fix and improve tracy rendering spans (#18588) 2025-03-28 05:35:47 +00:00
texture Allowed creating uninitialized images (for use as storage textures) (#17760) 2025-02-10 22:22:07 +00:00
view Switch ChildOf back to tuple struct (#18672) 2025-04-02 00:10:10 +00:00
alpha.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
bindless.wgsl Use global binding arrays for bindless resources. (#17898) 2025-02-21 05:55:36 +00:00
color_operations.wgsl move wgsl color operations from bevy_pbr to bevy_render (#13209) 2024-05-04 10:30:23 +00:00
extract_component.rs Replace internal uses of insert_or_spawn_batch (#18035) 2025-03-06 16:16:36 +00:00
extract_instances.rs Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
extract_param.rs Improve error message for missing resources (#18593) 2025-03-30 02:38:17 +00:00
extract_resource.rs Fix "Unrecognized Option" error when using Criterion-specific arguments in benchmarks (#17222) 2025-01-08 00:09:31 +00:00
globals.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
globals.wgsl Refactor Globals and View structs into separate shaders (#7512) 2023-02-11 17:55:18 +00:00
gpu_component_array_buffer.rs Generic system config (#17962) 2025-03-12 00:12:30 +00:00
gpu_readback.rs Generic system config (#17962) 2025-03-12 00:12:30 +00:00
lib.rs Tracy GPU support (#18490) 2025-03-28 04:57:01 +00:00
maths.wgsl Atmosphere LUT parameterization improvements (#17555) 2025-02-03 21:52:11 +00:00
pipelined_rendering.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
render_asset.rs Have the mesh allocator handle modified meshes (#18531) 2025-03-27 21:39:09 +00:00
settings.rs Upgrade to wgpu v24 (#17542) 2025-02-09 19:40:53 +00:00
storage.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
sync_component.rs Refactored ComponentHook Parameters into HookContext (#17503) 2025-01-23 02:45:24 +00:00
sync_world.rs Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 06:04:26 +00:00