mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-21 19:44:18 +00:00
fix downcast
This commit is contained in:
parent
0ad9f13f1d
commit
1b6dec8f5a
@ -1,18 +1,13 @@
|
||||
use bevy::{
|
||||
log::{info, warn},
|
||||
prelude::Entity,
|
||||
reflect::Reflect,
|
||||
reflect::{FromReflect, Reflect},
|
||||
};
|
||||
|
||||
use super::{fake_entity, reflect_ext};
|
||||
|
||||
pub fn patch_reflect_entity(reflect: &mut dyn Reflect) -> Option<Entity> {
|
||||
// We can put here either `fake_entity::Entity` or `bevy::ecs::entity::Entity`, but the latter would result in a false downcast.
|
||||
let maybe_fake = reflect
|
||||
.downcast_mut::<fake_entity::Entity>() // TODO: doesn't work yet, seems like it doesnt work when it's a dynamic type
|
||||
.map(|fake| fake.name.clone());
|
||||
|
||||
info!("{}", reflect.reflect_type_ident().unwrap());
|
||||
let maybe_fake = fake_entity::Entity::from_reflect(reflect).map(|fake| fake.name.clone());
|
||||
|
||||
if let Some(reference) = maybe_fake {
|
||||
let entity = if let Some(name) = reference {
|
||||
|
Loading…
Reference in New Issue
Block a user