#[reflect(Default)] for Handle/Mesh2dHandle (#12264)

# Objective

- Make default handles constructible via reflection

## Solution

- Add missing `#[reflect(Default)]` to them

---------

Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
This commit is contained in:
Sludge 2024-03-04 05:18:02 +01:00 committed by GitHub
parent 541a321a3d
commit fadc6d08c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -3,7 +3,7 @@ use crate::{
UntypedAssetId,
};
use bevy_ecs::prelude::*;
use bevy_reflect::{Reflect, TypePath};
use bevy_reflect::{std_traits::ReflectDefault, Reflect, TypePath};
use bevy_utils::{get_short_name, Uuid};
use crossbeam_channel::{Receiver, Sender};
use std::{
@ -122,7 +122,7 @@ impl std::fmt::Debug for StrongHandle {
///
/// [`Handle::Strong`] also provides access to useful [`Asset`] metadata, such as the [`AssetPath`] (if it exists).
#[derive(Component, Reflect)]
#[reflect(Component)]
#[reflect(Default, Component, Debug, Hash, PartialEq)]
pub enum Handle<A: Asset> {
/// A "strong" reference to a live (or loading) [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset`] will be kept
/// alive until the [`Handle`] is dropped. Strong handles also provide access to additional asset metadata.

View File

@ -10,7 +10,7 @@ use bevy_ecs::{
system::{lifetimeless::*, SystemParamItem, SystemState},
};
use bevy_math::{Affine3, Vec4};
use bevy_reflect::Reflect;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::mesh::MeshVertexBufferLayoutRef;
use bevy_render::{
batching::{
@ -39,7 +39,7 @@ use crate::Material2dBindGroupId;
///
/// It wraps a [`Handle<Mesh>`] to differentiate from the 3d pipelines which use the handles directly as components
#[derive(Default, Clone, Component, Debug, Reflect, PartialEq, Eq)]
#[reflect(Component)]
#[reflect(Default, Component)]
pub struct Mesh2dHandle(pub Handle<Mesh>);
impl From<Handle<Mesh>> for Mesh2dHandle {