diff --git a/editor/src/audio/mod.rs b/editor/src/audio/mod.rs index 7bbfbadf1..e67829e33 100644 --- a/editor/src/audio/mod.rs +++ b/editor/src/audio/mod.rs @@ -97,7 +97,7 @@ impl SelectionContainer for AudioBusSelection { .first() .and_then(|handle| state.bus_graph_ref().try_get_bus_ref(*handle).ok()) { - (callback)(EntityInfo::with_no_parent(effect as &dyn Reflect)); + (callback)(EntityInfo::with_no_parent(effect)); } } diff --git a/editor/src/interaction/navmesh/selection.rs b/editor/src/interaction/navmesh/selection.rs index c861a93e4..8af481c02 100644 --- a/editor/src/interaction/navmesh/selection.rs +++ b/editor/src/interaction/navmesh/selection.rs @@ -67,7 +67,7 @@ impl SelectionContainer for NavmeshSelection { let scene = &scenes[game_scene.scene]; let node = scene.graph.try_get_node(self.navmesh_node).unwrap(); (callback)(EntityInfo { - entity: node as &dyn Reflect, + entity: node, has_inheritance_parent: node.has_inheritance_parent(), read_only: false, }); diff --git a/editor/src/plugins/absm/mod.rs b/editor/src/plugins/absm/mod.rs index 8d971ab57..f32e72733 100644 --- a/editor/src/plugins/absm/mod.rs +++ b/editor/src/plugins/absm/mod.rs @@ -148,7 +148,8 @@ where .try_get_node_mut(absm_handle) .ok() .and_then(|n| { - (n as &mut dyn Reflect).first_field_mut::>>>() + n.inner_mut() + .first_field_mut::>>>() }) .map(|v| v.get_value_mut_silent()) } @@ -165,7 +166,8 @@ where { let absm = graph.try_get_node(absm_handle).ok()?; - let animation_player_handle = **(absm as &dyn Reflect) + let animation_player_handle = **absm + .inner_ref() .first_field_ref::>>()?; let animation_player = graph.try_get_mut(animation_player_handle).ok()?; @@ -185,7 +187,8 @@ where .try_get_node(absm_handle) .ok() .and_then(|n| { - (n as &dyn Reflect).first_field_ref::>>>() + n.inner_ref() + .first_field_ref::>>>() }) .map(|v| v.get_value_ref()) } @@ -202,7 +205,8 @@ where { let absm = graph.try_get_node(absm_handle).ok()?; - let animation_player_handle = **(absm as &dyn Reflect) + let animation_player_handle = **absm + .inner_ref() .first_field_ref::>>()?; let animation_player = graph.try_get(animation_player_handle).ok()?; diff --git a/editor/src/plugins/animation/mod.rs b/editor/src/plugins/animation/mod.rs index 50b8528e4..ae75e77a5 100644 --- a/editor/src/plugins/animation/mod.rs +++ b/editor/src/plugins/animation/mod.rs @@ -213,7 +213,10 @@ where graph .try_get_node_mut(handle) .ok() - .and_then(|n| n.self_or_field_mut::>>>()) + .and_then(|n| { + n.inner_mut() + .self_or_field_mut::>>>() + }) .map(|v| v.get_value_mut_silent()) } @@ -229,7 +232,7 @@ where .try_get_node(handle) .ok() .and_then(|n| { - (n as &dyn Reflect) + n.inner_ref() .first_field_ref::>>>() }) .map(|v| v.get_value_ref()) diff --git a/editor/src/plugins/animation/selection.rs b/editor/src/plugins/animation/selection.rs index 6eff26a2a..23099812b 100644 --- a/editor/src/plugins/animation/selection.rs +++ b/editor/src/plugins/animation/selection.rs @@ -135,7 +135,7 @@ where self.entities.first() { if let Some(signal) = animation.signals().iter().find(|s| s.id == *id) { - (callback)(EntityInfo::with_no_parent(signal as &dyn Reflect)); + (callback)(EntityInfo::with_no_parent(signal)); } } } diff --git a/editor/src/ui_scene/selection.rs b/editor/src/ui_scene/selection.rs index 5221587ab..fac011953 100644 --- a/editor/src/ui_scene/selection.rs +++ b/editor/src/ui_scene/selection.rs @@ -59,7 +59,7 @@ impl SelectionContainer for UiSelection { if let Some(first) = self.widgets.first() { if let Ok(node) = ui_scene.ui.try_get_node(*first) { (callback)(EntityInfo { - entity: node as &dyn Reflect, + entity: node, has_inheritance_parent: node.has_inheritance_parent(), read_only: false, }) diff --git a/editor/src/world/selection.rs b/editor/src/world/selection.rs index a95c29fae..066168a76 100644 --- a/editor/src/world/selection.rs +++ b/editor/src/world/selection.rs @@ -63,7 +63,7 @@ impl SelectionContainer for GraphSelection { .and_then(|handle| scene.graph.try_get_node(*handle).ok()) { (callback)(EntityInfo { - entity: node as &dyn Reflect, + entity: node, has_inheritance_parent: node.has_inheritance_parent(), read_only: false, }); diff --git a/fyrox-core/src/reflect/map.rs b/fyrox-core/src/reflect/map.rs index 78975dce5..dfb28afd8 100644 --- a/fyrox-core/src/reflect/map.rs +++ b/fyrox-core/src/reflect/map.rs @@ -89,7 +89,7 @@ where fn reflect_get(&self, key: &dyn Reflect, func: &mut dyn FnMut(Option<&dyn Reflect>)) { match key.downcast_ref::() { Some(key) => match self.get(key) { - Some(value) => func(Some(value as &dyn Reflect)), + Some(value) => func(Some(value)), None => func(None), }, None => func(None), @@ -103,7 +103,7 @@ where ) { match key.downcast_ref::() { Some(key) => match self.get_mut(key) { - Some(value) => func(Some(value as &mut dyn Reflect)), + Some(value) => func(Some(value)), None => func(None), }, None => func(None), diff --git a/fyrox-graph/src/lib.rs b/fyrox-graph/src/lib.rs index 96c4a6315..5682098be 100644 --- a/fyrox-graph/src/lib.rs +++ b/fyrox-graph/src/lib.rs @@ -855,7 +855,7 @@ pub trait SceneGraph: 'static { T: Reflect, { self.try_get_node(handle).and_then(|n| { - (n.inner_ref() as &dyn Reflect) + n.inner_ref() .self_or_field_ref() .ok_or(PoolError::NoSuchField(handle.into())) }) @@ -869,7 +869,7 @@ pub trait SceneGraph: 'static { T: Reflect, { self.try_get_node_mut(handle).and_then(|n| { - (n.inner_mut() as &mut dyn Reflect) + n.inner_mut() .self_or_field_mut() .ok_or(PoolError::NoSuchField(handle.into())) }) diff --git a/fyrox-impl/src/scene/node/mod.rs b/fyrox-impl/src/scene/node/mod.rs index 04d6a1728..cb57554f1 100644 --- a/fyrox-impl/src/scene/node/mod.rs +++ b/fyrox-impl/src/scene/node/mod.rs @@ -270,11 +270,11 @@ pub trait NodeTrait: BaseNodeTrait + Reflect + Visit { // See ObjectOrVariantHelper for the cause of the indirection. impl ObjectOrVariantHelper for PhantomData { fn convert_to_dest_type_helper(node: &Node) -> Option<&T> { - (node.0.deref() as &dyn Reflect).self_or_field_ref() + node.inner_ref().self_or_field_ref() } fn convert_to_dest_type_helper_mut(node: &mut Node) -> Option<&mut T> { - (node.0.deref_mut() as &mut dyn Reflect).self_or_field_mut() + node.inner_mut().self_or_field_mut() } } diff --git a/fyrox-ui/src/control.rs b/fyrox-ui/src/control.rs index 1a98d7d6e..35d1fe020 100644 --- a/fyrox-ui/src/control.rs +++ b/fyrox-ui/src/control.rs @@ -29,6 +29,7 @@ use crate::{ use fyrox_core::{define_as_any_trait, pool::ObjectOrVariantHelper}; use fyrox_core::algebra::Matrix3; +use fyrox_graph::SceneGraphNode; use std::{ any::Any, marker::PhantomData, @@ -456,10 +457,10 @@ pub trait Control: BaseControl + Deref + DerefMut + Reflect + V // See ObjectOrVariantHelper for the cause of the indirection. impl ObjectOrVariantHelper for PhantomData { fn convert_to_dest_type_helper(node: &UiNode) -> Option<&T> { - (node.0.deref() as &dyn Reflect).self_or_field_ref() + node.inner_ref().self_or_field_ref() } fn convert_to_dest_type_helper_mut(node: &mut UiNode) -> Option<&mut T> { - (node.0.deref_mut() as &mut dyn Reflect).self_or_field_mut() + node.inner_mut().self_or_field_mut() } }