mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
more concise naming
This commit is contained in:
@@ -250,7 +250,7 @@ impl Toolbar {
|
||||
inner_type_name: std::any::type_name::<N>().to_string(),
|
||||
handle: Default::default(),
|
||||
inner_type_id: TypeId::of::<N>(),
|
||||
derived_type_ids: N::derived_entity_list().to_vec(),
|
||||
derived_type_ids: N::derived_types().to_vec(),
|
||||
children: vec![],
|
||||
};
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ impl<T: Reflect> Control for HandlePropertyEditor<T> {
|
||||
vec![SelectedHandle {
|
||||
handle: self.value.into(),
|
||||
inner_type_id: TypeId::of::<T>(),
|
||||
derived_type_ids: T::derived_entity_list().to_vec(),
|
||||
derived_type_ids: T::derived_types().to_vec(),
|
||||
}],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ impl<T: Reflect> From<Handle<T>> for SelectedHandle {
|
||||
fn from(value: Handle<T>) -> Self {
|
||||
Self {
|
||||
inner_type_id: TypeId::of::<T>(),
|
||||
derived_type_ids: T::derived_entity_list().to_vec(),
|
||||
derived_type_ids: T::derived_types().to_vec(),
|
||||
handle: value.into(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ macro_rules! define_two_args_node {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
@@ -230,12 +230,12 @@ impl<T: EntityId> Reflect for NotNode<T> {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
@@ -460,7 +460,7 @@ fn gen_impl(
|
||||
std::any::type_name::<Self>()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [std::any::TypeId] {
|
||||
fn derived_types() -> &'static [std::any::TypeId] {
|
||||
static ARRAY: std::sync::LazyLock<Vec<std::any::TypeId>> = std::sync::LazyLock::new(|| vec![
|
||||
#types
|
||||
]);
|
||||
@@ -468,8 +468,8 @@ fn gen_impl(
|
||||
&ARRAY
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn doc(&self) -> &'static str {
|
||||
|
||||
@@ -88,15 +88,15 @@ impl<T: Reflect> Reflect for Handle<T> {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId]
|
||||
fn derived_types() -> &'static [TypeId]
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
T::derived_entity_list()
|
||||
T::derived_types()
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
@@ -104,15 +104,15 @@ where
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId]
|
||||
fn derived_types() -> &'static [TypeId]
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -204,11 +204,11 @@ pub trait Reflect: ReflectBase {
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId]
|
||||
fn derived_types() -> &'static [TypeId]
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId];
|
||||
fn query_derived_types(&self) -> &'static [TypeId];
|
||||
|
||||
fn type_name(&self) -> &'static str;
|
||||
|
||||
@@ -1140,15 +1140,15 @@ macro_rules! blank_reflect {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [std::any::TypeId]
|
||||
fn derived_types() -> &'static [std::any::TypeId]
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
@@ -1213,13 +1213,13 @@ macro_rules! delegate_reflect {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [std::any::TypeId] {
|
||||
fn derived_types() -> &'static [std::any::TypeId] {
|
||||
// TODO
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [std::any::TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
@@ -1448,6 +1448,6 @@ mod test {
|
||||
#[test]
|
||||
fn test_derived() {
|
||||
let base = Base;
|
||||
assert_eq!(base.query_derived_entity_list(), &[TypeId::of::<Derived>()])
|
||||
assert_eq!(base.query_derived_types(), &[TypeId::of::<Derived>()])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,14 +304,14 @@ macro_rules! impl_reflect_inner_mutability {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [std::any::TypeId] {
|
||||
fn derived_types() -> &'static [std::any::TypeId] {
|
||||
// TODO: This seems to be impossible to implement because of `?Sized` trait bound
|
||||
// up above.
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [std::any::TypeId] {
|
||||
T::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [std::any::TypeId] {
|
||||
T::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&$self) -> &'static str {
|
||||
|
||||
@@ -374,15 +374,15 @@ where
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId]
|
||||
fn derived_types() -> &'static [TypeId]
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
T::derived_entity_list()
|
||||
T::derived_types()
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
+6
-10
@@ -233,9 +233,7 @@ where
|
||||
// Handle derived entities handles.
|
||||
entity.as_handle_mut(&mut |handle| {
|
||||
if let Some(handle) = handle {
|
||||
if handle
|
||||
.query_derived_entity_list()
|
||||
.contains(&TypeId::of::<N>())
|
||||
if handle.query_derived_types().contains(&TypeId::of::<N>())
|
||||
&& handle.reflect_is_some()
|
||||
&& !self.try_map_reflect(handle)
|
||||
{
|
||||
@@ -375,9 +373,7 @@ where
|
||||
entity.as_handle_mut(&mut |handle| {
|
||||
if let Some(handle) = handle {
|
||||
if do_map
|
||||
&& handle
|
||||
.query_derived_entity_list()
|
||||
.contains(&TypeId::of::<N>())
|
||||
&& handle.query_derived_types().contains(&TypeId::of::<N>())
|
||||
&& handle.reflect_is_some()
|
||||
&& !self.try_map_reflect(handle)
|
||||
{
|
||||
@@ -1596,12 +1592,12 @@ mod test {
|
||||
self.0.deref_mut().field_mut(name, func)
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1867,7 +1863,7 @@ mod test {
|
||||
fn derived_type_ids(&self, handle: Handle<Self::Node>) -> Option<Vec<TypeId>> {
|
||||
self.nodes
|
||||
.try_borrow(handle)
|
||||
.map(|n| n.0.deref().query_derived_entity_list().to_vec())
|
||||
.map(|n| n.0.deref().query_derived_types().to_vec())
|
||||
}
|
||||
|
||||
fn actual_type_name(&self, handle: Handle<Self::Node>) -> Option<&'static str> {
|
||||
|
||||
@@ -1829,7 +1829,7 @@ impl BaseSceneGraph for Graph {
|
||||
fn derived_type_ids(&self, handle: Handle<Self::Node>) -> Option<Vec<TypeId>> {
|
||||
self.pool
|
||||
.try_borrow(handle)
|
||||
.map(|n| Box::deref(&n.0).query_derived_entity_list().to_vec())
|
||||
.map(|n| Box::deref(&n.0).query_derived_types().to_vec())
|
||||
}
|
||||
|
||||
fn actual_type_name(&self, handle: Handle<Self::Node>) -> Option<&'static str> {
|
||||
|
||||
@@ -533,12 +533,12 @@ impl Reflect for Node {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
@@ -71,12 +71,12 @@ impl Reflect for Limb {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
@@ -671,12 +671,12 @@ impl Reflect for Script {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
+1
-1
@@ -3253,7 +3253,7 @@ impl BaseSceneGraph for UserInterface {
|
||||
fn derived_type_ids(&self, handle: Handle<Self::Node>) -> Option<Vec<TypeId>> {
|
||||
self.nodes
|
||||
.try_borrow(handle)
|
||||
.map(|n| n.0.query_derived_entity_list().to_vec())
|
||||
.map(|n| n.0.query_derived_types().to_vec())
|
||||
}
|
||||
|
||||
fn actual_type_name(&self, handle: Handle<Self::Node>) -> Option<&'static str> {
|
||||
|
||||
@@ -283,12 +283,12 @@ impl Reflect for UiNode {
|
||||
file!()
|
||||
}
|
||||
|
||||
fn derived_entity_list() -> &'static [TypeId] {
|
||||
fn derived_types() -> &'static [TypeId] {
|
||||
&[]
|
||||
}
|
||||
|
||||
fn query_derived_entity_list(&self) -> &'static [TypeId] {
|
||||
Self::derived_entity_list()
|
||||
fn query_derived_types(&self) -> &'static [TypeId] {
|
||||
Self::derived_types()
|
||||
}
|
||||
|
||||
fn type_name(&self) -> &'static str {
|
||||
|
||||
Reference in New Issue
Block a user