mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Reflect derived traits on all components and resources: bevy_picking (#15225)
Solves https://github.com/bevyengine/bevy/issues/15187 for bevy_picking
This commit is contained in:
parent
b6b28a621f
commit
0c92908baf
4 changed files with 9 additions and 7 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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?
|
||||
///
|
||||
|
@ -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,
|
||||
|
|
|
@ -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]
|
||||
|
@ -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)>,
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue