From 31a446cfab8e4fbfc809555346eec00ed7f61ff8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Tue, 11 May 2021 14:57:07 +0200 Subject: [PATCH 1/3] Fix getter only properties not showing. --- Source/Editor/CustomEditors/Editors/GenericEditor.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index 179f5b935..fdbf75d1c 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -258,13 +258,12 @@ namespace FlaxEditor.CustomEditors.Editors for (int i = 0; i < properties.Length; i++) { var p = properties[i]; - - // Skip properties without getter or setter - if (!p.HasGet || !p.HasSet) - continue; - var attributes = p.GetAttributes(true); + // Skip properties without getter or setter + if (!p.HasGet || (!p.HasSet && !attributes.Any(x => x is ShowInEditorAttribute))) + continue; + // Skip hidden fields, handle special attributes if ((!p.IsPublic && !attributes.Any(x => x is ShowInEditorAttribute)) || attributes.Any(x => x is HideInEditorAttribute)) continue; From 166f7c272822f6da1f5768f3e322104bd09cedd4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Tue, 11 May 2021 16:09:27 +0200 Subject: [PATCH 2/3] Refactor. --- Source/Editor/CustomEditors/Editors/GenericEditor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index fdbf75d1c..374684375 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -259,13 +259,14 @@ namespace FlaxEditor.CustomEditors.Editors { var p = properties[i]; var attributes = p.GetAttributes(true); + var showInEditor = attributes.Any(x => x is ShowInEditorAttribute); // Skip properties without getter or setter - if (!p.HasGet || (!p.HasSet && !attributes.Any(x => x is ShowInEditorAttribute))) + if (!p.HasGet || (!p.HasSet && !showInEditor)) continue; // Skip hidden fields, handle special attributes - if ((!p.IsPublic && !attributes.Any(x => x is ShowInEditorAttribute)) || attributes.Any(x => x is HideInEditorAttribute)) + if ((!p.IsPublic && !showInEditor) || showInEditor) continue; items.Add(new ItemInfo(p, attributes)); From 03cd86b4d7c1aad74cb05444d7ca3a10eddeed04 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Tue, 11 May 2021 16:16:37 +0200 Subject: [PATCH 3/3] Fix. --- Source/Editor/CustomEditors/Editors/GenericEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index 374684375..d4079ad79 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -266,7 +266,7 @@ namespace FlaxEditor.CustomEditors.Editors continue; // Skip hidden fields, handle special attributes - if ((!p.IsPublic && !showInEditor) || showInEditor) + if ((!p.IsPublic && !showInEditor) || attributes.Any(x => x is HideInEditorAttribute)) continue; items.Add(new ItemInfo(p, attributes));