diff --git a/editor/src/export/mod.rs b/editor/src/export/mod.rs index 76ec0662a..05372e909 100644 --- a/editor/src/export/mod.rs +++ b/editor/src/export/mod.rs @@ -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, }); diff --git a/editor/src/interaction/terrain.rs b/editor/src/interaction/terrain.rs index d60c85fa9..34ad7e07c 100644 --- a/editor/src/interaction/terrain.rs +++ b/editor/src/interaction/terrain.rs @@ -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, }); diff --git a/editor/src/light.rs b/editor/src/light.rs index 68a479432..87bd46f50 100644 --- a/editor/src/light.rs +++ b/editor/src/light.rs @@ -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, })) diff --git a/editor/src/plugins/absm/parameter.rs b/editor/src/plugins/absm/parameter.rs index be6b12821..0770f292f 100644 --- a/editor/src/plugins/absm/parameter.rs +++ b/editor/src/plugins/absm/parameter.rs @@ -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, }) diff --git a/editor/src/plugins/inspector/editors/dyntype.rs b/editor/src/plugins/inspector/editors/dyntype.rs index 46dea8da3..2cf814fe6 100644 --- a/editor/src/plugins/inspector/editors/dyntype.rs +++ b/editor/src/plugins/inspector/editors/dyntype.rs @@ -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, }) diff --git a/editor/src/plugins/inspector/editors/script.rs b/editor/src/plugins/inspector/editors/script.rs index ac76ecb66..2e2831b66 100644 --- a/editor/src/plugins/inspector/editors/script.rs +++ b/editor/src/plugins/inspector/editors/script.rs @@ -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, }) diff --git a/editor/src/plugins/inspector/mod.rs b/editor/src/plugins/inspector/mod.rs index 41ab25899..17aaf71c7 100644 --- a/editor/src/plugins/inspector/mod.rs +++ b/editor/src/plugins/inspector/mod.rs @@ -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, }); diff --git a/editor/src/plugins/ragdoll.rs b/editor/src/plugins/ragdoll.rs index ba507142d..bde69f3a7 100644 --- a/editor/src/plugins/ragdoll.rs +++ b/editor/src/plugins/ragdoll.rs @@ -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, })) diff --git a/editor/src/plugins/settings.rs b/editor/src/plugins/settings.rs index 151e65c5e..041231a53 100644 --- a/editor/src/plugins/settings.rs +++ b/editor/src/plugins/settings.rs @@ -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, }); diff --git a/editor/src/scene/settings/mod.rs b/editor/src/scene/settings/mod.rs index 6641009db..7caead7dd 100644 --- a/editor/src/scene/settings/mod.rs +++ b/editor/src/scene/settings/mod.rs @@ -169,6 +169,7 @@ impl SceneSettingsWindow { && property.downcast_ref::>().is_none() }), name_column_width: 150.0, + hide_name_column: false, base_path: Default::default(), has_parent_object: false, }); diff --git a/fyrox-ui/src/inspector/editors/array.rs b/fyrox-ui/src/inspector/editors/array.rs index c61be19a2..6d49239f9 100644 --- a/fyrox-ui/src/inspector/editors/array.rs +++ b/fyrox-ui/src/inspector/editors/array.rs @@ -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, 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, 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, })? diff --git a/fyrox-ui/src/inspector/editors/cell.rs b/fyrox-ui/src/inspector/editors/cell.rs index 0a6e6ea44..830f0b993 100644 --- a/fyrox-ui/src/inspector/editors/cell.rs +++ b/fyrox-ui/src/inspector/editors/cell.rs @@ -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, }); diff --git a/fyrox-ui/src/inspector/editors/collection.rs b/fyrox-ui/src/inspector/editors/collection.rs index 922f98a4b..c54333b7d 100644 --- a/fyrox-ui/src/inspector/editors/collection.rs +++ b/fyrox-ui/src/inspector/editors/collection.rs @@ -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, 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>, 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, })? diff --git a/fyrox-ui/src/inspector/editors/enumeration.rs b/fyrox-ui/src/inspector/editors/enumeration.rs index 97dceb627..add3afcdd 100644 --- a/fyrox-ui/src/inspector/editors/enumeration.rs +++ b/fyrox-ui/src/inspector/editors/enumeration.rs @@ -168,6 +168,7 @@ impl Control for EnumPropertyEditor { 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, }); diff --git a/fyrox-ui/src/inspector/editors/inherit.rs b/fyrox-ui/src/inspector/editors/inherit.rs index 831f2de44..04480ade2 100644 --- a/fyrox-ui/src/inspector/editors/inherit.rs +++ b/fyrox-ui/src/inspector/editors/inherit.rs @@ -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, }); diff --git a/fyrox-ui/src/inspector/editors/inspectable.rs b/fyrox-ui/src/inspector/editors/inspectable.rs index f25c36a23..d1946cdd6 100644 --- a/fyrox-ui/src/inspector/editors/inspectable.rs +++ b/fyrox-ui/src/inspector/editors/inspectable.rs @@ -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, ); diff --git a/fyrox-ui/src/inspector/editors/mod.rs b/fyrox-ui/src/inspector/editors/mod.rs index dfce9a3e0..ce99df9a8 100644 --- a/fyrox-ui/src/inspector/editors/mod.rs +++ b/fyrox-ui/src/inspector/editors/mod.rs @@ -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 diff --git a/fyrox-ui/src/inspector/editors/refcell.rs b/fyrox-ui/src/inspector/editors/refcell.rs index d3e1272ce..93e6f529a 100644 --- a/fyrox-ui/src/inspector/editors/refcell.rs +++ b/fyrox-ui/src/inspector/editors/refcell.rs @@ -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, }); diff --git a/fyrox-ui/src/inspector/editors/style.rs b/fyrox-ui/src/inspector/editors/style.rs index cea830c1a..7484b3121 100644 --- a/fyrox-ui/src/inspector/editors/style.rs +++ b/fyrox-ui/src/inspector/editors/style.rs @@ -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::::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, }); diff --git a/fyrox-ui/src/inspector/mod.rs b/fyrox-ui/src/inspector/mod.rs index 2c874780d..783fbc64f 100644 --- a/fyrox-ui/src/inspector/mod.rs +++ b/fyrox-ui/src/inspector/mod.rs @@ -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 { - 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>, content: Handle>, width: f32, + hide_name_column: bool, ctx: &mut BuildContext, ) -> Handle { 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>, description: &str, width: f32, + hide_name_column: bool, ctx: &mut BuildContext, ) -> Handle { 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, }; diff --git a/project-manager/src/settings.rs b/project-manager/src/settings.rs index bbbd5f12a..585f1c392 100644 --- a/project-manager/src/settings.rs +++ b/project-manager/src/settings.rs @@ -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, });