diff --git a/Source/Editor/CustomEditors/CustomEditorPresenter.cs b/Source/Editor/CustomEditors/CustomEditorPresenter.cs
index 44188b8fb..de2291dea 100644
--- a/Source/Editor/CustomEditors/CustomEditorPresenter.cs
+++ b/Source/Editor/CustomEditors/CustomEditorPresenter.cs
@@ -9,6 +9,33 @@ using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors
{
+ ///
+ /// The per-feature flags for custom editors system.
+ ///
+ [HideInEditor, Flags]
+ public enum FeatureFlags
+ {
+ ///
+ /// Nothing.
+ ///
+ None = 0,
+
+ ///
+ /// Enables caching the expanded groups in this presenter. Used to preserve the expanded groups using project cache.
+ ///
+ CacheExpandedGroups = 1 << 0,
+
+ ///
+ /// Enables using prefab-related features of the properties editor (eg. revert to prefab option).
+ ///
+ UsePrefab = 1 << 1,
+
+ ///
+ /// Enables using default-value-related features of the properties editor (eg. revert to default option).
+ ///
+ UseDefault = 1 << 2,
+ }
+
///
/// Main class for Custom Editors used to present selected objects properties and allow to modify them.
///
@@ -205,9 +232,9 @@ namespace FlaxEditor.CustomEditors
public bool BuildOnUpdate => _buildOnUpdate;
///
- /// True if cache the expanded groups in this presenter, otherwise will disable this feature. Used to preserve the expanded groups using project cache.
+ /// The features to use for properties editor.
///
- public bool CacheExpandedGroups;
+ public FeatureFlags Features = FeatureFlags.UsePrefab | FeatureFlags.UseDefault;
///
/// Occurs when before creating layout for the selected objects editor UI. Can be used to inject custom UI to the layout.
diff --git a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
index 90028fc61..08b44f46a 100644
--- a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
@@ -613,7 +613,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Create group
var title = CustomEditorsUtil.GetPropertyNameUI(scriptType.Name);
var group = layout.Group(title, editor);
- if (Presenter.CacheExpandedGroups)
+ if ((Presenter.Features & FeatureFlags.CacheExpandedGroups) != 0)
{
if (Editor.Instance.ProjectCache.IsCollapsedGroup(title))
group.Panel.Close(false);
diff --git a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
index a080aaa4a..555ea42e5 100644
--- a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
+++ b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
@@ -118,11 +118,15 @@ namespace FlaxEditor.CustomEditors.GUI
if (linkedEditor != null)
{
- var revertToPrefab = menu.AddButton("Revert to Prefab", linkedEditor.RevertToReferenceValue);
- revertToPrefab.Enabled = linkedEditor.CanRevertReferenceValue;
- var resetToDefault = menu.AddButton("Reset to default", linkedEditor.RevertToDefaultValue);
- resetToDefault.Enabled = linkedEditor.CanRevertDefaultValue;
- menu.AddSeparator();
+ var features = linkedEditor.Presenter.Features;
+ if ((features & (FeatureFlags.UseDefault | FeatureFlags.UsePrefab)) != 0)
+ {
+ if ((features & FeatureFlags.UsePrefab) != 0)
+ menu.AddButton("Revert to Prefab", linkedEditor.RevertToReferenceValue).Enabled = linkedEditor.CanRevertReferenceValue;
+ if ((features & FeatureFlags.UseDefault) != 0)
+ menu.AddButton("Reset to default", linkedEditor.RevertToDefaultValue).Enabled = linkedEditor.CanRevertDefaultValue;
+ menu.AddSeparator();
+ }
menu.AddButton("Copy", linkedEditor.Copy);
var paste = menu.AddButton("Paste", linkedEditor.Paste);
paste.Enabled = linkedEditor.CanPaste;
diff --git a/Source/Editor/CustomEditors/LayoutElementsContainer.cs b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
index b63d9f6b9..94e9a121d 100644
--- a/Source/Editor/CustomEditors/LayoutElementsContainer.cs
+++ b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
@@ -85,7 +85,7 @@ namespace FlaxEditor.CustomEditors
{
element.Panel.Close(false);
}
- else if (this is CustomEditorPresenter presenter && presenter.CacheExpandedGroups)
+ else if (this is CustomEditorPresenter presenter && (presenter.Features & FeatureFlags.CacheExpandedGroups) != 0)
{
if (Editor.Instance.ProjectCache.IsCollapsedGroup(title))
element.Panel.Close(false);
diff --git a/Source/Editor/Windows/Assets/VisualScriptWindow.cs b/Source/Editor/Windows/Assets/VisualScriptWindow.cs
index f9b6f01ad..95e730bea 100644
--- a/Source/Editor/Windows/Assets/VisualScriptWindow.cs
+++ b/Source/Editor/Windows/Assets/VisualScriptWindow.cs
@@ -359,6 +359,7 @@ namespace FlaxEditor.Windows.Assets
// Properties editor
_propertiesEditor = new CustomEditorPresenter(_undo);
+ _propertiesEditor.Features = FeatureFlags.None;
_propertiesEditor.Panel.Parent = _split.Panel2;
_propertiesEditor.Modified += OnPropertyEdited;
_properties = new PropertiesProxy();
diff --git a/Source/Editor/Windows/PropertiesWindow.cs b/Source/Editor/Windows/PropertiesWindow.cs
index dc2dfc308..8e0ae5af6 100644
--- a/Source/Editor/Windows/PropertiesWindow.cs
+++ b/Source/Editor/Windows/PropertiesWindow.cs
@@ -34,7 +34,7 @@ namespace FlaxEditor.Windows
Presenter = new CustomEditorPresenter(editor.Undo, null, this);
Presenter.Panel.Parent = this;
Presenter.GetUndoObjects += GetUndoObjects;
- Presenter.CacheExpandedGroups = true;
+ Presenter.Features |= FeatureFlags.CacheExpandedGroups;
Editor.SceneEditing.SelectionChanged += OnSelectionChanged;
}