Skip to content

Commit 764961b

Browse files
authored
Add Reflection Macros to TextureAtlasSprite (#8428)
# Objective Add Reflection to `TextureAtlasSprite` to bring it inline with `Sprite` ## Solution Addition of appropriate macros to the type --- ## Changelog `#[reflect(Component)]` and derive `FromReflect` for `TextureAtlasSprite` Added `TextureAtlasSprite` to the TypeRegistry
1 parent 30ac157 commit 764961b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/bevy_sprite/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl Plugin for SpritePlugin {
5858
app.add_asset::<TextureAtlas>()
5959
.register_asset_reflect::<TextureAtlas>()
6060
.register_type::<Sprite>()
61+
.register_type::<TextureAtlasSprite>()
6162
.register_type::<Anchor>()
6263
.register_type::<Mesh2dHandle>()
6364
.add_plugin(Mesh2dRenderPlugin)

crates/bevy_sprite/src/texture_atlas.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::Anchor;
22
use bevy_asset::Handle;
3-
use bevy_ecs::component::Component;
3+
use bevy_ecs::{component::Component, reflect::ReflectComponent};
44
use bevy_math::{Rect, Vec2};
55
use bevy_reflect::{FromReflect, Reflect, TypeUuid};
66
use bevy_render::{color::Color, texture::Image};
@@ -23,7 +23,8 @@ pub struct TextureAtlas {
2323
pub(crate) texture_handles: Option<HashMap<Handle<Image>, usize>>,
2424
}
2525

26-
#[derive(Component, Debug, Clone, Reflect)]
26+
#[derive(Component, Debug, Clone, Reflect, FromReflect)]
27+
#[reflect(Component)]
2728
pub struct TextureAtlasSprite {
2829
/// The tint color used to draw the sprite, defaulting to [`Color::WHITE`]
2930
pub color: Color,

0 commit comments

Comments
 (0)