mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
fixed name column hiding in inspector
- setting name column width is not the correct way, because this property is recursively supplied to the inner inspectors and hides what shouldn't be hidden
This commit is contained in:
@@ -209,6 +209,7 @@ impl ExportWindow {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
|
||||
@@ -640,6 +640,7 @@ impl BrushPanel {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
|
||||
@@ -268,6 +268,7 @@ impl LightPanel {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
}))
|
||||
|
||||
@@ -110,6 +110,7 @@ impl ParameterPanel {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
})
|
||||
|
||||
@@ -163,6 +163,7 @@ impl DynTypePropertyEditorBuilder {
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object,
|
||||
})
|
||||
@@ -279,6 +280,7 @@ impl PropertyEditorDefinition for DynTypePropertyEditorDefinition {
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
@@ -355,6 +357,7 @@ impl PropertyEditorDefinition for DynTypePropertyEditorDefinition {
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
})
|
||||
|
||||
@@ -238,6 +238,7 @@ impl ScriptPropertyEditorBuilder {
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object,
|
||||
})
|
||||
@@ -383,6 +384,7 @@ impl PropertyEditorDefinition for ScriptPropertyEditorDefinition {
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
@@ -460,6 +462,7 @@ impl PropertyEditorDefinition for ScriptPropertyEditorDefinition {
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
})
|
||||
|
||||
@@ -348,6 +348,7 @@ impl InspectorPlugin {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object,
|
||||
});
|
||||
|
||||
@@ -1058,6 +1058,7 @@ impl RagdollWizard {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
}))
|
||||
|
||||
@@ -219,6 +219,7 @@ impl SettingsWindow {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 250.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
|
||||
@@ -169,6 +169,7 @@ impl SceneSettingsWindow {
|
||||
&& property.downcast_ref::<Option<Lightmap>>().is_none()
|
||||
}),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
|
||||
@@ -119,6 +119,7 @@ fn create_items<'a, 'b, T, I>(
|
||||
generate_property_string_values: bool,
|
||||
filter: PropertyFilter,
|
||||
name_column_width: f32,
|
||||
hide_name_column: bool,
|
||||
base_path: String,
|
||||
has_parent_object: bool,
|
||||
) -> Result<Vec<Item>, InspectorError>
|
||||
@@ -163,6 +164,7 @@ where
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path: format!("{base_path}[{index}]"),
|
||||
has_parent_object,
|
||||
})?;
|
||||
@@ -243,6 +245,7 @@ where
|
||||
ctx: &mut BuildContext,
|
||||
property_info: &FieldRef<'a, '_>,
|
||||
name_column_width: f32,
|
||||
hide_name_column: bool,
|
||||
base_path: String,
|
||||
has_parent_object: bool,
|
||||
) -> Result<Handle<ArrayEditor>, InspectorError> {
|
||||
@@ -262,6 +265,7 @@ where
|
||||
self.generate_property_string_values,
|
||||
self.filter,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
)?
|
||||
@@ -345,12 +349,14 @@ where
|
||||
ctx.build_context,
|
||||
ctx.property_info,
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.base_path.clone(),
|
||||
ctx.has_parent_object,
|
||||
)?;
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
false,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
@@ -374,6 +380,7 @@ where
|
||||
definition_container,
|
||||
environment,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
} = ctx;
|
||||
@@ -430,6 +437,7 @@ where
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path: format!("{base_path}[{index}]"),
|
||||
has_parent_object,
|
||||
})?
|
||||
|
||||
@@ -112,6 +112,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
})
|
||||
@@ -161,6 +162,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
|
||||
@@ -224,6 +224,7 @@ fn create_items<'a, 'b, T, I>(
|
||||
filter: PropertyFilter,
|
||||
immutable_collection: bool,
|
||||
name_column_width: f32,
|
||||
hide_name_column: bool,
|
||||
base_path: String,
|
||||
has_parent_object: bool,
|
||||
) -> Result<Vec<Item>, InspectorError>
|
||||
@@ -266,6 +267,7 @@ where
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path: format!("{base_path}[{index}]"),
|
||||
has_parent_object,
|
||||
})?;
|
||||
@@ -371,6 +373,7 @@ where
|
||||
ctx: &mut BuildContext,
|
||||
property_info: &FieldRef<'a, '_>,
|
||||
name_column_width: f32,
|
||||
hide_name_column: bool,
|
||||
base_path: String,
|
||||
has_parent_object: bool,
|
||||
) -> Result<Handle<CollectionEditor<T>>, InspectorError> {
|
||||
@@ -391,6 +394,7 @@ where
|
||||
self.filter,
|
||||
self.immutable_collection,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
)?
|
||||
@@ -502,12 +506,14 @@ where
|
||||
ctx.build_context,
|
||||
ctx.property_info,
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.base_path.clone(),
|
||||
ctx.has_parent_object,
|
||||
)?;
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
@@ -531,6 +537,7 @@ where
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
} = ctx;
|
||||
@@ -558,6 +565,7 @@ where
|
||||
filter,
|
||||
property_info.immutable_collection,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
)?;
|
||||
@@ -607,6 +615,7 @@ where
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path: format!("{base_path}[{index}]"),
|
||||
has_parent_object,
|
||||
})?
|
||||
|
||||
@@ -168,6 +168,7 @@ impl<T: InspectableEnum> Control for EnumPropertyEditor<T> {
|
||||
generate_property_string_values: self.generate_property_string_values,
|
||||
filter: self.filter.clone(),
|
||||
name_column_width: self.name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: self.base_path.clone(),
|
||||
has_parent_object: self.has_parent_object,
|
||||
});
|
||||
@@ -276,6 +277,7 @@ impl EnumPropertyEditorBuilder {
|
||||
generate_property_string_values: self.generate_property_string_values,
|
||||
filter: self.filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: base_path.clone(),
|
||||
has_parent_object,
|
||||
});
|
||||
@@ -423,6 +425,7 @@ where
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
@@ -471,6 +474,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
|
||||
@@ -218,7 +218,8 @@ where
|
||||
layer_index: ctx.layer_index + 1,
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: 0.0,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: true,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
|
||||
@@ -99,6 +99,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: false,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
@@ -117,6 +118,7 @@ where
|
||||
editor
|
||||
},
|
||||
ctx.name_column_width,
|
||||
ctx.hide_name_column,
|
||||
ctx.build_context,
|
||||
);
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ pub struct PropertyEditorBuildContext<'a, 'b, 'c, 'd> {
|
||||
pub filter: PropertyFilter,
|
||||
/// Width of the property name column.
|
||||
pub name_column_width: f32,
|
||||
pub hide_name_column: bool,
|
||||
pub base_path: String,
|
||||
/// A flag, that defines whether the inspectable object has a parent object from which it can
|
||||
/// obtain initial property values when clicking on the "Revert" button. This flag is used only for
|
||||
@@ -223,6 +224,7 @@ pub struct PropertyEditorMessageContext<'a, 'b, 'c> {
|
||||
pub filter: PropertyFilter,
|
||||
/// Width of the property name column.
|
||||
pub name_column_width: f32,
|
||||
pub hide_name_column: bool,
|
||||
pub base_path: String,
|
||||
/// A flag, that defines whether the inspectable object has a parent object from which it can
|
||||
/// obtain initial property values when clicking on the "Revert" button. This flag is used only for
|
||||
|
||||
@@ -112,6 +112,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
})
|
||||
@@ -161,6 +162,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
|
||||
@@ -548,6 +548,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: format!("{}.{}", ctx.base_path, StyledProperty::<T>::PROPERTY),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
})?;
|
||||
@@ -633,6 +634,7 @@ where
|
||||
generate_property_string_values: ctx.generate_property_string_values,
|
||||
filter: ctx.filter,
|
||||
name_column_width: ctx.name_column_width,
|
||||
hide_name_column: ctx.hide_name_column,
|
||||
base_path: ctx.base_path.clone(),
|
||||
has_parent_object: ctx.has_parent_object,
|
||||
});
|
||||
|
||||
@@ -818,6 +818,7 @@ pub struct InspectorContext {
|
||||
pub object_type_id: TypeId,
|
||||
/// A width of the property name column.
|
||||
pub name_column_width: f32,
|
||||
pub hide_name_column: bool,
|
||||
/// A flag, that defines whether the inspectable object has a parent object from which it can
|
||||
/// obtain initial property values when clicking on "Revert" button. This flag is used only for
|
||||
/// [`crate::core::variable::InheritableVariable`] properties, primarily to hide "Revert" button
|
||||
@@ -847,6 +848,7 @@ impl Default for InspectorContext {
|
||||
environment: None,
|
||||
object_type_id: ().type_id(),
|
||||
name_column_width: 150.0,
|
||||
hide_name_column: false,
|
||||
has_parent_object: false,
|
||||
}
|
||||
}
|
||||
@@ -879,14 +881,9 @@ fn make_expander_check_box(
|
||||
layer_index: usize,
|
||||
property_name: &str,
|
||||
property_description: &str,
|
||||
hide_name: bool,
|
||||
ctx: &mut BuildContext,
|
||||
) -> Handle<CheckBox> {
|
||||
let description = if property_description.is_empty() {
|
||||
property_name.to_string()
|
||||
} else {
|
||||
format!("{property_name}\n\n{property_description}")
|
||||
};
|
||||
|
||||
let handle = CheckBoxBuilder::new(
|
||||
WidgetBuilder::new()
|
||||
.with_vertical_alignment(VerticalAlignment::Center)
|
||||
@@ -901,7 +898,14 @@ fn make_expander_check_box(
|
||||
.with_stroke_thickness(Thickness::zero().into())
|
||||
.build(ctx),
|
||||
)
|
||||
.with_content(
|
||||
.with_content(if hide_name {
|
||||
Handle::NONE
|
||||
} else {
|
||||
let description = if property_description.is_empty() {
|
||||
property_name.to_string()
|
||||
} else {
|
||||
format!("{property_name}\n\n{property_description}")
|
||||
};
|
||||
TextBuilder::new(
|
||||
WidgetBuilder::new()
|
||||
.with_opt_tooltip(make_tooltip(ctx, &description))
|
||||
@@ -910,8 +914,8 @@ fn make_expander_check_box(
|
||||
)
|
||||
.with_vertical_text_alignment(VerticalAlignment::Center)
|
||||
.with_text(property_name)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx)
|
||||
})
|
||||
.checked(Some(true))
|
||||
.with_check_mark(make_arrow(ctx, ArrowDirection::Bottom, 8.0))
|
||||
.with_uncheck_mark(make_arrow(ctx, ArrowDirection::Right, 8.0))
|
||||
@@ -937,6 +941,7 @@ pub fn make_expander_container(
|
||||
header: Handle<impl ObjectOrVariant<UiNode>>,
|
||||
content: Handle<impl ObjectOrVariant<UiNode>>,
|
||||
width: f32,
|
||||
hide_name_column: bool,
|
||||
ctx: &mut BuildContext,
|
||||
) -> Handle<UiNode> {
|
||||
ExpanderBuilder::new(WidgetBuilder::new())
|
||||
@@ -944,9 +949,14 @@ pub fn make_expander_container(
|
||||
layer_index,
|
||||
property_name,
|
||||
description,
|
||||
hide_name_column,
|
||||
ctx,
|
||||
))
|
||||
.with_expander_column(Column::strict(width))
|
||||
.with_expander_column(if hide_name_column {
|
||||
Column::strict(0.0)
|
||||
} else {
|
||||
Column::strict(width)
|
||||
})
|
||||
.with_expanded(true)
|
||||
.with_header(header)
|
||||
.with_content(content)
|
||||
@@ -974,6 +984,7 @@ fn make_simple_property_container(
|
||||
editor: Handle<impl ObjectOrVariant<UiNode>>,
|
||||
description: &str,
|
||||
width: f32,
|
||||
hide_name_column: bool,
|
||||
ctx: &mut BuildContext,
|
||||
) -> Handle<UiNode> {
|
||||
ctx[editor.to_base()].set_row(0).set_column(1);
|
||||
@@ -985,7 +996,10 @@ fn make_simple_property_container(
|
||||
|
||||
GridBuilder::new(WidgetBuilder::new().with_child(title).with_child(editor))
|
||||
.add_row(Row::auto())
|
||||
.add_columns(vec![Column::strict(width), Column::stretch()])
|
||||
.add_columns(vec![
|
||||
Column::strict(if hide_name_column { 0.0 } else { width }),
|
||||
Column::stretch(),
|
||||
])
|
||||
.build(ctx)
|
||||
.to_base()
|
||||
}
|
||||
@@ -1037,6 +1051,7 @@ pub struct InspectorContextArgs<'a, 'b, 'c> {
|
||||
pub generate_property_string_values: bool,
|
||||
pub filter: PropertyFilter,
|
||||
pub name_column_width: f32,
|
||||
pub hide_name_column: bool,
|
||||
pub base_path: String,
|
||||
/// A flag, that defines whether the inspectable object has a parent object from which it can
|
||||
/// obtain initial property values when clicking on "Revert" button. This flag is used only for
|
||||
@@ -1069,6 +1084,7 @@ impl InspectorContext {
|
||||
generate_property_string_values,
|
||||
filter,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path,
|
||||
has_parent_object,
|
||||
} = context;
|
||||
@@ -1114,6 +1130,7 @@ impl InspectorContext {
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
base_path: property_path.clone(),
|
||||
has_parent_object,
|
||||
},
|
||||
@@ -1122,14 +1139,15 @@ impl InspectorContext {
|
||||
let (container, editor) = match instance {
|
||||
PropertyEditorInstance::Simple { editor } => (
|
||||
make_simple_property_container(
|
||||
if name_column_width != 0.0 {
|
||||
create_header(ctx, info.display_name, layer_index)
|
||||
} else {
|
||||
if hide_name_column {
|
||||
Handle::NONE
|
||||
} else {
|
||||
create_header(ctx, info.display_name, layer_index)
|
||||
},
|
||||
editor,
|
||||
&description,
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
ctx,
|
||||
),
|
||||
editor,
|
||||
@@ -1173,6 +1191,7 @@ impl InspectorContext {
|
||||
.build(ctx),
|
||||
&description,
|
||||
name_column_width,
|
||||
false,
|
||||
ctx,
|
||||
)
|
||||
}
|
||||
@@ -1192,6 +1211,7 @@ impl InspectorContext {
|
||||
.build(ctx),
|
||||
&description,
|
||||
name_column_width,
|
||||
false,
|
||||
ctx,
|
||||
));
|
||||
}
|
||||
@@ -1257,6 +1277,7 @@ impl InspectorContext {
|
||||
environment,
|
||||
object_type_id: object_type_id(object),
|
||||
name_column_width,
|
||||
hide_name_column,
|
||||
has_parent_object,
|
||||
}
|
||||
}
|
||||
@@ -1308,6 +1329,7 @@ impl InspectorContext {
|
||||
generate_property_string_values,
|
||||
filter: filter.clone(),
|
||||
name_column_width: self.name_column_width,
|
||||
hide_name_column: self.hide_name_column,
|
||||
base_path: base_path.clone(),
|
||||
has_parent_object: self.has_parent_object,
|
||||
};
|
||||
|
||||
@@ -242,6 +242,7 @@ impl SettingsWindow {
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
name_column_width: 170.0,
|
||||
hide_name_column: false,
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user