Skip to content

Commit

Permalink
Add FromReflect for Timer (#6422)
Browse files Browse the repository at this point in the history
# Objective

- Time have `Reflect`, but doesn't have `FromReflect`.

## Solution

- Add it for `Timer`, `Stopwatch` and `TimerMode`.

---

## Changelog

### Added

* `FromReflect` derive for `Timer`, `Stopwatch` and `TimerMode`.
  • Loading branch information
Shatur committed Oct 30, 2022
1 parent aa8c745 commit 7540328
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_time/src/stopwatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use bevy_utils::Duration;
/// assert!(stopwatch.paused());
/// assert_eq!(stopwatch.elapsed_secs(), 0.0);
/// ```
#[derive(Clone, Debug, Default, Reflect)]
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
#[reflect(Default)]
pub struct Stopwatch {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_time/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy_utils::Duration;
/// exceeded, and can still be reset at any given point.
///
/// Paused timers will not have elapsed time increased.
#[derive(Clone, Debug, Default, Reflect)]
#[derive(Clone, Debug, Default, Reflect, FromReflect)]
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
#[reflect(Default)]
pub struct Timer {
Expand Down Expand Up @@ -403,7 +403,7 @@ impl Timer {
}

/// Specifies [`Timer`] behavior.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, Reflect)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, Reflect, FromReflect)]
#[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))]
#[reflect(Default)]
pub enum TimerMode {
Expand Down

0 comments on commit 7540328

Please sign in to comment.