Skip to content

Implemented #[bundle(ignore)] and #[bundle(flatten)]#5628

Closed
maccesch wants to merge 0 commit intobevyengine:mainfrom
Synphonyte:main
Closed

Implemented #[bundle(ignore)] and #[bundle(flatten)]#5628
maccesch wants to merge 0 commit intobevyengine:mainfrom
Synphonyte:main

Conversation

@maccesch
Copy link
Copy Markdown
Contributor

@maccesch maccesch commented Aug 9, 2022

Objective

Fixes #5559

Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.


Migration Guide

In #[derive(Bundle)] structs:

#[bundle] => #[bundle(flatten)]

@IceSentry IceSentry added the A-ECS Entities, components, systems, and events label Aug 9, 2022
@alice-i-cecile alice-i-cecile added the C-Usability A targeted quality-of-life change that makes Bevy easier to use label Aug 9, 2022
@maccesch
Copy link
Copy Markdown
Contributor Author

maccesch commented Aug 9, 2022

@alice-i-cecile Please also add breaking change label

@alice-i-cecile alice-i-cecile added the M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Aug 9, 2022
@SkiFire13
Copy link
Copy Markdown
Contributor

nest feels a bit weird to me, wouldn't it be more intuitive/standard if it was flatten?

@maccesch
Copy link
Copy Markdown
Contributor Author

@alice-i-cecile Should I change sth or is this ready?

@alice-i-cecile
Copy link
Copy Markdown
Member

This is ready :) Just needs more reviews; feel free to ask on Discord.

Also ping @aevyrie who wanted this.

@alice-i-cecile
Copy link
Copy Markdown
Member

I also think I'm on board with the suggestion from @SkiFire13 :)

Copy link
Copy Markdown
Member

@joseph-gio joseph-gio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be very useful.

@maccesch maccesch changed the title Implemented #[bundle(ignore)] and #[bundle(nest)] Implemented #[bundle(ignore)] and #[bundle(flatten)] Aug 26, 2022
@alice-i-cecile
Copy link
Copy Markdown
Member

Git state definitely got messed up pretty bad here :( Feel free to remake the PR on a new branch if you can't sort it out.

@maccesch maccesch closed this Sep 29, 2022
bors bot pushed a commit that referenced this pull request Oct 24, 2022
# Objective

Fixes #5559

Replaces #5628

## Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.

---

## Changelog

Added the possibility to ignore fields in a bundle with `#[bundle(ignore)]`. Typically used when `PhantomData` needs to be added to a `Bundle`.
bors bot pushed a commit that referenced this pull request Oct 24, 2022
# Objective

Fixes #5559

Replaces #5628

## Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.

---

## Changelog

Added the possibility to ignore fields in a bundle with `#[bundle(ignore)]`. Typically used when `PhantomData` needs to be added to a `Bundle`.
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
# Objective

Fixes bevyengine#5559

Replaces bevyengine#5628

## Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.

---

## Changelog

Added the possibility to ignore fields in a bundle with `#[bundle(ignore)]`. Typically used when `PhantomData` needs to be added to a `Bundle`.
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this pull request Dec 17, 2022
# Objective

Fixes bevyengine#5559

Replaces bevyengine#5628

## Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.

---

## Changelog

Added the possibility to ignore fields in a bundle with `#[bundle(ignore)]`. Typically used when `PhantomData` needs to be added to a `Bundle`.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

Fixes bevyengine#5559

Replaces bevyengine#5628

## Solution

Because the generated method from_components() creates an instance of Self my implementation requires any field type that is marked to be ignored to implement Default.

---

## Changelog

Added the possibility to ignore fields in a bundle with `#[bundle(ignore)]`. Typically used when `PhantomData` needs to be added to a `Bundle`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to ignore field of bundle

5 participants