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

Add Reflection Macros to TextureAtlasSprite #8428

Merged
merged 1 commit into from
Apr 17, 2023
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_sprite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl Plugin for SpritePlugin {
app.add_asset::<TextureAtlas>()
.register_asset_reflect::<TextureAtlas>()
.register_type::<Sprite>()
.register_type::<TextureAtlasSprite>()
.register_type::<Anchor>()
.register_type::<Mesh2dHandle>()
.add_plugin(Mesh2dRenderPlugin)
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_sprite/src/texture_atlas.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::Anchor;
use bevy_asset::Handle;
use bevy_ecs::component::Component;
use bevy_ecs::{component::Component, reflect::ReflectComponent};
use bevy_math::{Rect, Vec2};
use bevy_reflect::{FromReflect, Reflect, TypeUuid};
use bevy_render::{color::Color, texture::Image};
Expand All @@ -23,7 +23,8 @@ pub struct TextureAtlas {
pub(crate) texture_handles: Option<HashMap<Handle<Image>, usize>>,
}

#[derive(Component, Debug, Clone, Reflect)]
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
#[reflect(Component)]
pub struct TextureAtlasSprite {
/// The tint color used to draw the sprite, defaulting to [`Color::WHITE`]
pub color: Color,
Expand Down