Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect derived traits on all components and resources: bevy_picking #15225

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/bevy_picking/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ use crate::{
/// The documentation for the [`pointer_events`] explains the events this module exposes and
/// the order in which they fire.
#[derive(Clone, PartialEq, Debug, Reflect, Component)]
#[reflect(Component, Debug)]
pub struct Pointer<E: Debug + Clone + Reflect> {
/// The pointer that triggered this event
pub pointer_id: PointerId,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_picking/src/focus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn build_hover_map(
/// the entity will be considered pressed. If that entity is instead being hovered by both pointers,
/// it will be considered hovered.
#[derive(Component, Copy, Clone, Default, Eq, PartialEq, Debug, Reflect)]
#[reflect(Component, Default)]
#[reflect(Component, Default, PartialEq, Debug)]
pub enum PickingInteraction {
/// The entity is being pressed down by a pointer.
Pressed = 2,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_picking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub mod prelude {
/// make an entity non-hoverable, or allow items below it to be hovered. See the documentation on
/// the fields for more details.
#[derive(Component, Debug, Clone, Reflect, PartialEq, Eq)]
#[reflect(Component, Default)]
#[reflect(Component, Default, Debug, PartialEq)]
pub struct Pickable {
/// Should this entity block entities below it from being picked?
///
Expand Down Expand Up @@ -317,7 +317,7 @@ impl Plugin for DefaultPickingPlugins {
/// This plugin contains several settings, and is added to the wrold as a resource after initialization. You
/// can configure picking settings at runtime through the resource.
#[derive(Copy, Clone, Debug, Resource, Reflect)]
#[reflect(Resource, Default)]
#[reflect(Resource, Default, Debug)]
pub struct PickingPlugin {
/// Enables and disables all picking features.
pub is_enabled: bool,
Expand Down
9 changes: 5 additions & 4 deletions crates/bevy_picking/src/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::backend::HitData;
/// This component is needed because pointers can be spawned and despawned, but they need to have a
/// stable ID that persists regardless of the Entity they are associated with.
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, Component, Reflect)]
#[reflect(Component, Default)]
#[reflect(Component, Default, Debug, Hash, PartialEq)]
pub enum PointerId {
/// The mouse pointer.
#[default]
Expand Down Expand Up @@ -65,7 +65,7 @@ impl PointerId {
/// Holds a list of entities this pointer is currently interacting with, sorted from nearest to
/// farthest.
#[derive(Debug, Default, Clone, Component, Reflect)]
#[reflect(Component, Default)]
#[reflect(Component, Default, Debug)]
pub struct PointerInteraction {
pub(crate) sorted_entities: Vec<(Entity, HitData)>,
}
Expand Down Expand Up @@ -93,7 +93,7 @@ pub fn update_pointer_map(pointers: Query<(Entity, &PointerId)>, mut map: ResMut

/// Tracks the state of the pointer's buttons in response to [`PointerInput`] events.
#[derive(Debug, Default, Clone, Component, Reflect, PartialEq, Eq)]
#[reflect(Component, Default)]
#[reflect(Component, Default, Debug, PartialEq)]
pub struct PointerPress {
primary: bool,
secondary: bool,
Expand Down Expand Up @@ -155,7 +155,7 @@ impl PointerButton {

/// Component that tracks a pointer's current [`Location`].
#[derive(Debug, Default, Clone, Component, Reflect, PartialEq)]
#[reflect(Component, Default)]
#[reflect(Component, Default, Debug, PartialEq)]
pub struct PointerLocation {
/// The [`Location`] of the pointer. Note that a location is both the target, and the position
/// on the target.
Expand All @@ -180,6 +180,7 @@ impl PointerLocation {
/// render target. It is up to picking backends to associate a Pointer's `Location` with a
/// specific `Camera`, if any.
#[derive(Debug, Clone, Component, Reflect, PartialEq)]
#[reflect(Component, Debug, PartialEq)]
pub struct Location {
/// The [`NormalizedRenderTarget`] associated with the pointer, usually a window.
pub target: NormalizedRenderTarget,
Expand Down