From b23cf5f1d825d94e1545e6a6751f096b1a1ae1f1 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Fri, 5 Aug 2022 13:27:32 +0200 Subject: [PATCH] Fix displaying multiple structure parameters in Visject Surface parameters panel --- .../Container/PropertiesListElement.cs | 20 +++++++++++++++++++ Source/Editor/Surface/VisjectSurfaceWindow.cs | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/Editor/CustomEditors/Elements/Container/PropertiesListElement.cs b/Source/Editor/CustomEditors/Elements/Container/PropertiesListElement.cs index 8f573ee60..bd44486cf 100644 --- a/Source/Editor/CustomEditors/Elements/Container/PropertiesListElement.cs +++ b/Source/Editor/CustomEditors/Elements/Container/PropertiesListElement.cs @@ -29,6 +29,26 @@ namespace FlaxEditor.CustomEditors.Elements Properties = new PropertiesList(this); } + /// + /// Adds object property editor. Selects proper based on overrides. + /// + /// The property name. + /// The values. + /// The custom editor to use. If null will detect it by auto. + /// The created element. + public CustomEditor Property(string name, ValueContainer values, CustomEditor overrideEditor = null) + { + var editor = CustomEditorsUtil.CreateEditor(values, overrideEditor); + var style = editor.Style; + if (style == DisplayStyle.Group) + { + var group = Group(name, editor, true); + group.Panel.Open(); + return group.Object(values, editor); + } + return Object(values, editor); + } + internal readonly List Labels = new List(); internal void OnAddProperty(string name, string tooltip) diff --git a/Source/Editor/Surface/VisjectSurfaceWindow.cs b/Source/Editor/Surface/VisjectSurfaceWindow.cs index d6b68030d..885e8be15 100644 --- a/Source/Editor/Surface/VisjectSurfaceWindow.cs +++ b/Source/Editor/Surface/VisjectSurfaceWindow.cs @@ -427,7 +427,7 @@ namespace FlaxEditor.Surface propertyLabel.MouseLeftDoubleClick += (label, location) => StartParameterRenaming(pIndex, label); propertyLabel.SetupContextMenu += OnPropertyLabelSetupContextMenu; var property = itemLayout.AddPropertyItem(propertyLabel, tooltipText); - property.Object(propertyValue); + property.Property("Value", propertyValue); } CustomEditors.Editors.GenericEditor.OnGroupUsage();