bevyengine / bevyengine/bevy

Support the `<verb>_parent_in_place()` API for operating on parents instead of children

Open
#14,008 0 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Usability D-Straightforward S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

We've got [`set_parent_in_place`](https://docs.rs/bevy/0.14.0-rc.3/bevy/prelude/trait.BuildChildrenTransformExt.html#tymethod.set_parent_in_place) and [`remove_parent_in_place`](https://docs.rs/bevy/0.14.0-rc.3/bevy/prelude/trait.BuildChildrenTransformExt.html#tymethod.remove_parent_in_place) when operating on a child, but no corresponding methods when adding children to a parent.

## What solution would you like?

Duplicate [`BuildChildren`](https://docs.rs/bevy/0.14.0-rc.3/bevy/hierarchy/trait.BuildChildren.html)'s methods for `_in_place`, adding the following methods:
- `with_children_in_place`
- `add_child_in_place`
- `push_children_in_place`
- `insert_children_in_place`
- `remove_children_in_place`
- `clear_children_in_place`
- `replace_children`

if we also add `set_parent_in_place` and `remove_parent_in_place`, we can probably even remove the [`BuildChildrenTransformExt`](https://docs.rs/bevy/0.14.0-rc.3/bevy/prelude/trait.BuildChildrenTransformExt.html#tymethod.remove_parent_in_place) trait.

## What alternative(s) have you considered?

Don't add the suggested API. The desired outcome can always be achieved by limiting yourself to operating on a child or iterating over children instead of using the API on the parent.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.