Why aren't `Fill` and `Stroke` housed in `ShapeBundle`?
akappel opened this issue · 2 comments
Obviously this is already merged (via #198) and out in the wild, but I'm trying to understand why Fill
and Stroke
were pulled out of ShapeBundle
? The idea of making them components was a good one, and the updated ergonomics of GeometryBuilder
seems sound. But now I have two extra components on my top-level bundle that weren't needed previously, and are only useful in the context of the ShapeBundle
.
As an example, my PinballBundle
goes from:
#[derive(Component)]
pub struct Pinball;
#[derive(Bundle)]
pub struct PinballBundle {
pinball: Pinball,
rigidbody: RigidBody,
collider: Collider,
friction: Friction,
#[bundle]
shape_bundle: ShapeBundle,
}
to:
#[derive(Component)]
pub struct Pinball;
#[derive(Bundle)]
pub struct PinballBundle {
pinball: Pinball,
rigidbody: RigidBody,
collider: Collider,
friction: Friction,
#[bundle]
shape_bundle: ShapeBundle,
fill: Fill,
stroke: Stroke,
}
Not a huge deal, just liked having it all packaged under ShapeBundle
. Since I use ShapeBundle
in other places as well, it feels like I'll need to create an intermediary bundle to join them back together.
It's because you may not always want to have both components at the same time, and Bevy does not have bundles with optional components.
We may add a different bundle for each draw mode, but I have to think about it.
- For optional components, see bevyengine/bevy#2157
Ah okay, makes sense. Thanks for the background! A bundle for each draw mode sounds promising, but for now I'll just create that intermediary bundle with both 👍 Thanks!