mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 22:20:20 +00:00
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
This commit is contained in:
parent
30ac157b80
commit
764961be22
2 changed files with 4 additions and 2 deletions
|
@ -58,6 +58,7 @@ impl Plugin for SpritePlugin {
|
||||||
app.add_asset::<TextureAtlas>()
|
app.add_asset::<TextureAtlas>()
|
||||||
.register_asset_reflect::<TextureAtlas>()
|
.register_asset_reflect::<TextureAtlas>()
|
||||||
.register_type::<Sprite>()
|
.register_type::<Sprite>()
|
||||||
|
.register_type::<TextureAtlasSprite>()
|
||||||
.register_type::<Anchor>()
|
.register_type::<Anchor>()
|
||||||
.register_type::<Mesh2dHandle>()
|
.register_type::<Mesh2dHandle>()
|
||||||
.add_plugin(Mesh2dRenderPlugin)
|
.add_plugin(Mesh2dRenderPlugin)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::Anchor;
|
use crate::Anchor;
|
||||||
use bevy_asset::Handle;
|
use bevy_asset::Handle;
|
||||||
use bevy_ecs::component::Component;
|
use bevy_ecs::{component::Component, reflect::ReflectComponent};
|
||||||
use bevy_math::{Rect, Vec2};
|
use bevy_math::{Rect, Vec2};
|
||||||
use bevy_reflect::{FromReflect, Reflect, TypeUuid};
|
use bevy_reflect::{FromReflect, Reflect, TypeUuid};
|
||||||
use bevy_render::{color::Color, texture::Image};
|
use bevy_render::{color::Color, texture::Image};
|
||||||
|
@ -23,7 +23,8 @@ pub struct TextureAtlas {
|
||||||
pub(crate) texture_handles: Option<HashMap<Handle<Image>, usize>>,
|
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 {
|
pub struct TextureAtlasSprite {
|
||||||
/// The tint color used to draw the sprite, defaulting to [`Color::WHITE`]
|
/// The tint color used to draw the sprite, defaulting to [`Color::WHITE`]
|
||||||
pub color: Color,
|
pub color: Color,
|
||||||
|
|
Loading…
Reference in a new issue