mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
removed owner_type_id field from FieldInfo
- it was used only once in the entire project and mostly useless in other cases - this change allows to decouple field metadata from its actual values, thus speeding up fetching of fields info
This commit is contained in:
@@ -148,7 +148,7 @@ where
|
||||
if let Some(definition) = environment.available_animations.get(*value) {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(Handle::<T>::from(definition.handle)),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -238,7 +238,6 @@ impl PropertyEditorDefinition for FontPropertyEditorDefinition {
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(FontFieldMessage::Font(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
|
||||
@@ -552,7 +552,6 @@ impl<T: Reflect> PropertyEditorDefinition for NodeHandlePropertyEditorDefinition
|
||||
ctx.message.data::<HandlePropertyEditorMessage<T>>()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
|
||||
@@ -412,7 +412,6 @@ where
|
||||
ctx.message.data::<ResourceFieldMessage<T>>()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
|
||||
@@ -556,7 +556,6 @@ impl PropertyEditorDefinition for ScriptPropertyEditorDefinition {
|
||||
});
|
||||
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(script),
|
||||
});
|
||||
@@ -567,7 +566,7 @@ impl PropertyEditorDefinition for ScriptPropertyEditorDefinition {
|
||||
// Mimic Option<Script> path by adding `.Some@0` suffix to property path.
|
||||
// It is needed because we're editing compound type in this editor.
|
||||
name: ctx.name.to_string() + ".Some@0",
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Inspectable(Box::new(property_changed.clone())),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ impl PropertyEditorDefinition for SpriteSheetFramesContainerEditorDefinition {
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(container.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -251,7 +251,6 @@ impl PropertyEditorDefinition for SurfaceDataPropertyEditorDefinition {
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(SurfaceDataPropertyEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
|
||||
@@ -246,7 +246,6 @@ impl PropertyEditorDefinition for TexturePropertyEditorDefinition {
|
||||
ctx.message.data::<TextureEditorMessage>()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: if self.untyped {
|
||||
FieldKind::object(value.clone().map(|r| r.into_untyped()))
|
||||
|
||||
@@ -30,7 +30,6 @@ use crate::{
|
||||
scene::commands::terrain::{AddTerrainLayerCommand, DeleteTerrainLayerCommand},
|
||||
Command,
|
||||
};
|
||||
use std::any::TypeId;
|
||||
|
||||
pub struct SceneNodePropertyChangedHandler;
|
||||
|
||||
@@ -39,10 +38,10 @@ impl SceneNodePropertyChangedHandler {
|
||||
&self,
|
||||
args: &PropertyChanged,
|
||||
handle: Handle<Node>,
|
||||
_node: &mut Node,
|
||||
node: &mut Node,
|
||||
) -> Option<Command> {
|
||||
// Terrain is special and have its own commands for specific properties.
|
||||
if args.path() == Terrain::LAYERS && args.owner_type_id == TypeId::of::<Terrain>() {
|
||||
if args.path() == Terrain::LAYERS && node.is_terrain() {
|
||||
match args.value {
|
||||
FieldKind::Collection(ref collection_changed) => match **collection_changed {
|
||||
CollectionChanged::Add(_) => {
|
||||
|
||||
@@ -303,7 +303,7 @@ impl PropertyEditorDefinition for MaterialPropertyEditorDefinition {
|
||||
if let Some(MaterialFieldMessage::Material(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -267,7 +267,6 @@ impl PropertyEditorDefinition for TileDefinitionHandlePropertyEditorDefinition {
|
||||
if let Some(&TileDefinitionHandleEditorMessage::Value(Some(value))) = ctx.message.data()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value),
|
||||
});
|
||||
@@ -322,7 +321,6 @@ impl PropertyEditorDefinition for OptionTileDefinitionHandlePropertyEditorDefini
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(&TileDefinitionHandleEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value),
|
||||
});
|
||||
|
||||
@@ -93,7 +93,6 @@ macro_rules! define_two_args_node {
|
||||
fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo])) {
|
||||
func(&[
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Lhs",
|
||||
display_name: "Lhs",
|
||||
description: "",
|
||||
@@ -109,7 +108,6 @@ macro_rules! define_two_args_node {
|
||||
doc: "",
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Rhs",
|
||||
display_name: "Rhs",
|
||||
description: "",
|
||||
@@ -254,7 +252,6 @@ impl<T: EntityId> Reflect for NotNode<T> {
|
||||
|
||||
fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo])) {
|
||||
func(&[FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Lhs",
|
||||
display_name: "Lhs",
|
||||
description: "",
|
||||
|
||||
@@ -128,7 +128,6 @@ fn quote_field_prop(
|
||||
|
||||
quote! {
|
||||
FieldInfo {
|
||||
owner_type_id: std::any::TypeId::of::<Self>(),
|
||||
name: #prop_key_name,
|
||||
display_name: #display_name,
|
||||
tag: #tag,
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#![allow(clippy::disallowed_names)] // Useless in tests
|
||||
|
||||
use std::{
|
||||
any::TypeId,
|
||||
collections::HashMap,
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
@@ -332,7 +331,6 @@ fn reflect_fields_list_of_enum() {
|
||||
|
||||
fn default_prop() -> FieldInfo<'static, 'static> {
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<()>(),
|
||||
name: "",
|
||||
value: &(),
|
||||
reflect_value: &(),
|
||||
@@ -361,14 +359,12 @@ fn inspect_default() {
|
||||
|
||||
let expected = vec![
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "the_field",
|
||||
display_name: "The Field",
|
||||
value: &data.the_field,
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "another_field",
|
||||
display_name: "Another Field",
|
||||
value: &data.another_field,
|
||||
@@ -410,14 +406,12 @@ fn inspect_attributes() {
|
||||
|
||||
let expected = vec![
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "x",
|
||||
display_name: "Super X",
|
||||
value: &data.x,
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "y",
|
||||
display_name: "Y",
|
||||
value: &data.y,
|
||||
@@ -449,14 +443,12 @@ fn inspect_struct() {
|
||||
fields_info,
|
||||
vec![
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Tuple>(),
|
||||
name: "0",
|
||||
display_name: "0",
|
||||
value: &x.0,
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Tuple>(),
|
||||
name: "1",
|
||||
display_name: "1",
|
||||
value: &x.1,
|
||||
@@ -498,7 +490,6 @@ fn inspect_enum() {
|
||||
fields_info,
|
||||
vec![
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "Named@x",
|
||||
display_name: "X",
|
||||
value: match data {
|
||||
@@ -508,7 +499,6 @@ fn inspect_enum() {
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "Named@y",
|
||||
display_name: "Y",
|
||||
value: match data {
|
||||
@@ -518,7 +508,6 @@ fn inspect_enum() {
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "Named@z",
|
||||
display_name: "Z",
|
||||
value: match data {
|
||||
@@ -538,7 +527,6 @@ fn inspect_enum() {
|
||||
fields_info,
|
||||
vec![
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "Tuple@0",
|
||||
display_name: "0",
|
||||
value: match data {
|
||||
@@ -548,7 +536,6 @@ fn inspect_enum() {
|
||||
..default_prop()
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Data>(),
|
||||
name: "Tuple@1",
|
||||
display_name: "1",
|
||||
value: match data {
|
||||
|
||||
@@ -118,7 +118,6 @@ impl<T: Reflect> Reflect for Handle<T> {
|
||||
fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo])) {
|
||||
func(&[
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Index",
|
||||
display_name: "Index",
|
||||
description: "",
|
||||
@@ -134,7 +133,6 @@ impl<T: Reflect> Reflect for Handle<T> {
|
||||
doc: "",
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Generation",
|
||||
display_name: "Generation",
|
||||
description: "",
|
||||
|
||||
@@ -72,9 +72,6 @@ pub enum CastError {
|
||||
}
|
||||
|
||||
pub struct FieldInfo<'a, 'b> {
|
||||
/// A type id of the owner of the property.
|
||||
pub owner_type_id: TypeId,
|
||||
|
||||
/// A name of the property.
|
||||
pub name: &'b str,
|
||||
|
||||
@@ -136,7 +133,6 @@ impl FieldInfo<'_, '_> {
|
||||
impl fmt::Debug for FieldInfo<'_, '_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("PropertyInfo")
|
||||
.field("owner_type_id", &self.owner_type_id)
|
||||
.field("name", &self.name)
|
||||
.field("display_name", &self.display_name)
|
||||
.field("value", &format_args!("{:?}", self.value as *const _))
|
||||
@@ -155,8 +151,7 @@ impl PartialEq<Self> for FieldInfo<'_, '_> {
|
||||
let value_ptr_a = self.value as *const _ as *const ();
|
||||
let value_ptr_b = other.value as *const _ as *const ();
|
||||
|
||||
self.owner_type_id == other.owner_type_id
|
||||
&& self.name == other.name
|
||||
self.name == other.name
|
||||
&& self.display_name == other.display_name
|
||||
&& std::ptr::eq(value_ptr_a, value_ptr_b)
|
||||
&& self.read_only == other.read_only
|
||||
|
||||
@@ -98,7 +98,6 @@ impl Reflect for Limb {
|
||||
fn fields_info(&self, func: &mut dyn FnMut(&[FieldInfo])) {
|
||||
func(&[
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Bone",
|
||||
display_name: "Bone",
|
||||
description: "",
|
||||
@@ -114,7 +113,6 @@ impl Reflect for Limb {
|
||||
doc: "",
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "PhysicalBone",
|
||||
display_name: "Physical Bone",
|
||||
description: "",
|
||||
@@ -130,7 +128,6 @@ impl Reflect for Limb {
|
||||
doc: "",
|
||||
},
|
||||
FieldInfo {
|
||||
owner_type_id: TypeId::of::<Self>(),
|
||||
name: "Children",
|
||||
display_name: "Children",
|
||||
description: "",
|
||||
|
||||
@@ -127,7 +127,6 @@ where
|
||||
'b: 'a,
|
||||
{
|
||||
Ok(FieldInfo {
|
||||
owner_type_id: TypeId::of::<T>(),
|
||||
name,
|
||||
display_name,
|
||||
value: item,
|
||||
@@ -446,7 +445,7 @@ where
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Collection(Box::new(CollectionChanged::ItemChanged {
|
||||
index: *index,
|
||||
property: definition
|
||||
@@ -454,7 +453,6 @@ where
|
||||
.translate_message(PropertyEditorTranslationContext {
|
||||
environment: ctx.environment.clone(),
|
||||
name: "",
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
message,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
})?
|
||||
|
||||
@@ -91,7 +91,6 @@ where
|
||||
if let Some(BitFieldMessage::Value(value)) = ctx.message.data::<BitFieldMessage<T>>() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ impl PropertyEditorDefinition for BoolPropertyEditorDefinition {
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -241,7 +241,6 @@ where
|
||||
'b: 'a,
|
||||
{
|
||||
Ok(FieldInfo {
|
||||
owner_type_id: TypeId::of::<T>(),
|
||||
name,
|
||||
display_name,
|
||||
value: item,
|
||||
@@ -629,7 +628,6 @@ where
|
||||
if let Some(collection_changed) = ctx.message.data::<CollectionChanged>() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
value: FieldKind::Collection(Box::new(collection_changed.clone())),
|
||||
});
|
||||
} else if let Some(CollectionEditorMessage::ItemChanged { index, message }) =
|
||||
@@ -642,7 +640,7 @@ where
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Collection(Box::new(CollectionChanged::ItemChanged {
|
||||
index: *index,
|
||||
property: definition
|
||||
@@ -650,7 +648,6 @@ where
|
||||
.translate_message(PropertyEditorTranslationContext {
|
||||
environment: ctx.environment.clone(),
|
||||
name: "",
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
message,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
})?
|
||||
|
||||
@@ -78,7 +78,7 @@ impl PropertyEditorDefinition for ColorPropertyEditorDefinition {
|
||||
if let Some(ColorFieldMessage::Color(value)) = ctx.message.data::<ColorFieldMessage>() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
@@ -128,7 +128,7 @@ impl PropertyEditorDefinition for ColorGradientPropertyEditorDefinition {
|
||||
if let Some(ColorGradientEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ impl PropertyEditorDefinition for CurvePropertyEditorDefinition {
|
||||
if let Some(CurveEditorMessage::Sync(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.first().cloned().unwrap()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -554,13 +554,13 @@ where
|
||||
EnumPropertyEditorMessage::PropertyChanged(property_changed) => {
|
||||
Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Inspectable(Box::new(property_changed.clone())),
|
||||
})
|
||||
}
|
||||
EnumPropertyEditorMessage::Variant(index) => Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object((self.variant_generator)(*index)),
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -83,7 +83,6 @@ impl PropertyEditorDefinition for ImmutableStringPropertyEditorDefinition {
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(TextMessage::Text(value)) = ctx.message.data::<TextMessage>() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(ImmutableString::new(value)),
|
||||
});
|
||||
|
||||
@@ -222,7 +222,6 @@ where
|
||||
let value = property_info.cast_value::<InheritableVariable<T>>()?;
|
||||
|
||||
Ok(FieldInfo {
|
||||
owner_type_id: TypeId::of::<T>(),
|
||||
name: property_info.name,
|
||||
display_name: property_info.display_name,
|
||||
value: &**value,
|
||||
@@ -348,7 +347,7 @@ where
|
||||
if let Some(InheritablePropertyEditorMessage::Revert) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Inheritable(InheritableAction::Revert),
|
||||
});
|
||||
}
|
||||
@@ -363,7 +362,7 @@ where
|
||||
PropertyEditorTranslationContext {
|
||||
environment: ctx.environment.clone(),
|
||||
name: ctx.name,
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
message: ctx.message,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
},
|
||||
|
||||
@@ -160,7 +160,7 @@ where
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_owned(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::Inspectable(Box::new(msg.clone())),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ impl PropertyEditorDefinition for HotKeyPropertyEditorDefinition {
|
||||
if let Some(HotKeyEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
@@ -123,7 +123,7 @@ impl PropertyEditorDefinition for KeyBindingPropertyEditorDefinition {
|
||||
if let Some(KeyBindingEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ impl<const R: usize, const C: usize, T: NumericType> PropertyEditorDefinition
|
||||
ctx.message.data::<MatrixEditorMessage<R, C, T>>()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
|
||||
@@ -242,9 +242,6 @@ pub struct PropertyEditorTranslationContext<'b, 'c> {
|
||||
/// The name of the property being edited.
|
||||
/// This comes from [ContextEntry::property_name](crate::inspector::ContextEntry).
|
||||
pub name: &'b str,
|
||||
/// The type of the object whose property is being edited.
|
||||
/// This comes from [ContextEntry::property_owner_type_id](crate::inspector::ContextEntry).
|
||||
pub owner_type_id: TypeId,
|
||||
/// The original message that may be translated, if it represents a change in the property.
|
||||
pub message: &'c UiMessage,
|
||||
/// The list of the Inspectors property editors.
|
||||
|
||||
@@ -113,7 +113,7 @@ where
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ impl PropertyEditorDefinition for PathPropertyEditorDefinition {
|
||||
if let Some(PathEditorMessage::Path(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,7 +118,6 @@ where
|
||||
);
|
||||
let rotation = quat_from_euler(euler, RotationOrder::XYZ);
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(rotation),
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ impl<T: NumericType> PropertyEditorDefinition for RangePropertyEditorDefinition<
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ where
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ where
|
||||
'b: 'a,
|
||||
{
|
||||
Ok(FieldInfo {
|
||||
owner_type_id: TypeId::of::<T>(),
|
||||
name: property_info.name,
|
||||
display_name: property_info.display_name,
|
||||
value,
|
||||
@@ -166,7 +165,7 @@ where
|
||||
PropertyEditorTranslationContext {
|
||||
environment: ctx.environment.clone(),
|
||||
name: ctx.name,
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
message: ctx.message,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
},
|
||||
|
||||
@@ -79,7 +79,6 @@ impl PropertyEditorDefinition for StringPropertyEditorDefinition {
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(TextMessage::Text(value)) = ctx.message.data::<TextMessage>() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
|
||||
@@ -215,7 +215,6 @@ where
|
||||
let value = property_info.cast_value::<StyledProperty<T>>()?;
|
||||
|
||||
Ok(FieldInfo {
|
||||
owner_type_id: TypeId::of::<T>(),
|
||||
name: property_info.name,
|
||||
display_name: property_info.display_name,
|
||||
value: &**value,
|
||||
@@ -338,7 +337,7 @@ where
|
||||
.translate_message(PropertyEditorTranslationContext {
|
||||
environment: ctx.environment.clone(),
|
||||
name: ctx.name,
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
message: ctx.message,
|
||||
definition_container: ctx.definition_container.clone(),
|
||||
})?;
|
||||
|
||||
@@ -888,7 +888,7 @@ impl PropertyEditorDefinition for TextureSlicePropertyEditorDefinition {
|
||||
if let Some(TextureSliceEditorMessage::Slice(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(value.clone()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ impl PropertyEditorDefinition for Utf32StringPropertyEditorDefinition {
|
||||
if ctx.message.direction() == MessageDirection::FromWidget {
|
||||
if let Some(TextMessage::Text(value)) = ctx.message.data::<TextMessage>() {
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(value.chars().collect::<Vec<_>>()),
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ impl PropertyEditorDefinition for UuidPropertyEditorDefinition {
|
||||
if let Some(UuidEditorMessage::Value(value)) = ctx.message.data() {
|
||||
return Some(PropertyChanged {
|
||||
name: ctx.name.to_string(),
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ impl<T: NumericType, const D: usize> PropertyEditorDefinition
|
||||
ctx.message.data::<VecEditorMessage<T, D>>()
|
||||
{
|
||||
return Some(PropertyChanged {
|
||||
owner_type_id: ctx.owner_type_id,
|
||||
name: ctx.name.to_string(),
|
||||
value: FieldKind::object(*value),
|
||||
});
|
||||
|
||||
@@ -322,8 +322,6 @@ impl FieldKind {
|
||||
pub struct PropertyChanged {
|
||||
/// The name of the edited property.
|
||||
pub name: String,
|
||||
/// The type of the object that owns the property.
|
||||
pub owner_type_id: TypeId,
|
||||
/// The details of the change.
|
||||
pub value: FieldKind,
|
||||
}
|
||||
@@ -542,8 +540,6 @@ pub struct ContextEntry {
|
||||
pub property_display_name: String,
|
||||
/// The name of the field being edited, as found in [FieldInfo::tag].
|
||||
pub property_tag: String,
|
||||
/// The type of the objects whose fields are being inspected, as found in [FieldInfo::owner_type_id].
|
||||
pub property_owner_type_id: TypeId,
|
||||
/// The type of the property being edited, as found in [PropertyEditorDefinition::value_type_id](editors::PropertyEditorDefinition::value_type_id).
|
||||
pub property_value_type_id: TypeId,
|
||||
/// The list of property editor definitions being used by the inspector.
|
||||
@@ -911,7 +907,6 @@ impl InspectorContext {
|
||||
property_name: info.name.to_string(),
|
||||
property_display_name: info.display_name.to_string(),
|
||||
property_tag: info.tag.to_string(),
|
||||
property_owner_type_id: info.owner_type_id,
|
||||
property_debug_output: field_text.clone(),
|
||||
property_container: container,
|
||||
});
|
||||
@@ -1170,7 +1165,6 @@ impl Control for Inspector {
|
||||
.translate_message(PropertyEditorTranslationContext {
|
||||
environment: env.clone(),
|
||||
name: &entry.property_name,
|
||||
owner_type_id: entry.property_owner_type_id,
|
||||
message,
|
||||
definition_container: self.context.property_definitions.clone(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user