From 53fd158f2d76a2afe49bb953520a16136ae367ae Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 30 Aug 2023 18:09:59 -0500 Subject: [PATCH] Add a way to reset an IBrush to null for default functionality. --- Source/Editor/CustomEditors/Editors/IBrushEditor.cs | 1 + Source/Editor/CustomEditors/Editors/ObjectSwitcherEditor.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs index beb28ca80..387364df6 100644 --- a/Source/Editor/CustomEditors/Editors/IBrushEditor.cs +++ b/Source/Editor/CustomEditors/Editors/IBrushEditor.cs @@ -16,6 +16,7 @@ namespace FlaxEditor.CustomEditors.Editors /// protected override OptionType[] Options => new[] { + new OptionType("null", null), new OptionType("Texture", typeof(TextureBrush)), new OptionType("Sprite", typeof(SpriteBrush)), new OptionType("GPU Texture", typeof(GPUTextureBrush)), diff --git a/Source/Editor/CustomEditors/Editors/ObjectSwitcherEditor.cs b/Source/Editor/CustomEditors/Editors/ObjectSwitcherEditor.cs index 25a058d86..4d0c0f662 100644 --- a/Source/Editor/CustomEditors/Editors/ObjectSwitcherEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ObjectSwitcherEditor.cs @@ -158,7 +158,9 @@ namespace FlaxEditor.CustomEditors.Editors if (comboBox.SelectedIndex != -1) { var option = _options[comboBox.SelectedIndex]; - value = option.Creator(option.Type); + if (option.Type != null) + value = option.Creator(option.Type); + } SetValue(value); RebuildLayoutOnRefresh();