bevy/examples/animation
Carter Anderson 1553ee98ff 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-03 21:45:43 +02:00
..
animated_mesh_control.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
animated_mesh_events.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
animated_mesh.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
animated_transform.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
animated_ui.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
animation_events.rs AnimationEvent -> Event and other improvements (#16440) 2024-11-22 00:16:04 +00:00
animation_graph.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
animation_masks.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
color_animation.rs ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
custom_skinned_mesh.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00
eased_motion.rs AnimatedField and Rework Evaluators (#16484) 2024-11-27 22:19:55 +00:00
easing_functions.rs Add ways to configure EasingFunction::Steps via new StepConfig (#17752) 2025-02-11 22:19:01 +00:00
gltf_skinned_mesh.rs Switch ChildOf back to tuple struct (#18672) 2025-04-03 21:45:43 +02:00
morph_targets.rs Revert "Replace Ambient Lights with Environment Map Lights (#17482)" (#18167) 2025-03-05 23:08:46 +00:00