-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Adding derive Reflect for tick structs #11641
Changes from 5 commits
ac6ede3
f03ee11
ee686a1
98eb828
63151fc
97bcad0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ use crate::{ | |
}; | ||
pub use bevy_ecs_macros::Component; | ||
use bevy_ptr::{OwningPtr, UnsafeCellDeref}; | ||
use bevy_reflect::Reflect; | ||
use std::cell::UnsafeCell; | ||
use std::{ | ||
alloc::Layout, | ||
|
@@ -286,7 +287,8 @@ impl ComponentInfo { | |
/// Given a type `T` which implements [`Component`], the `ComponentId` for `T` can be retrieved | ||
/// from a `World` using [`World::component_id()`] or via [`Components::component_id()`]. Access | ||
/// to the `ComponentId` for a [`Resource`] is available via [`Components::resource_id()`]. | ||
#[derive(Debug, Copy, Clone, Hash, Ord, PartialOrd, Eq, PartialEq)] | ||
#[derive(Debug, Copy, Clone, Hash, Ord, PartialOrd, Eq, PartialEq, Reflect)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also add the appropriate registrations (e.g. Same for the other items. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, should i add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there is one for |
||
#[reflect(Debug, Hash, PartialEq)] | ||
pub struct ComponentId(usize); | ||
|
||
impl ComponentId { | ||
|
@@ -669,7 +671,8 @@ impl Components { | |
|
||
/// A value that tracks when a system ran relative to other systems. | ||
/// This is used to power change detection. | ||
#[derive(Copy, Clone, Debug, Eq, PartialEq)] | ||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Reflect)] | ||
#[reflect(Debug, PartialEq)] | ||
pub struct Tick { | ||
tick: u32, | ||
} | ||
|
@@ -762,7 +765,8 @@ impl<'a> TickCells<'a> { | |
} | ||
|
||
/// Records when a component was added and when it was last mutably dereferenced (or added). | ||
#[derive(Copy, Clone, Debug)] | ||
#[derive(Copy, Clone, Debug, Reflect)] | ||
#[reflect(Debug)] | ||
pub struct ComponentTicks { | ||
pub(crate) added: Tick, | ||
pub(crate) changed: Tick, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably also register these types into the
App
(although I’m not sure if the bevy_ecs has a plugin or anything that would make sense to hold that logic)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's no great spot to do this. Maybe
bevy_core
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added them in bevy core, seems like a good place for it