diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs
index 617c1c3de..897ad91b8 100644
--- a/Source/Editor/Options/InterfaceOptions.cs
+++ b/Source/Editor/Options/InterfaceOptions.cs
@@ -140,7 +140,7 @@ namespace FlaxEditor.Options
}
///
- /// Options focus Game Window behaviour when play mode is entered.
+ /// Options for focus Game Window behaviour when play mode is entered.
///
public enum PlayModeFocus
{
@@ -160,6 +160,22 @@ namespace FlaxEditor.Options
GameWindowThenRestore,
}
+ ///
+ /// Generic options for a disabled or hidden state. Used for example in create content button.
+ ///
+ public enum DisabledHidden
+ {
+ ///
+ /// Disabled state.
+ ///
+ Disabled,
+
+ ///
+ /// Hidden state.
+ ///
+ Hidden,
+ }
+
///
/// Gets or sets the Editor User Interface scale. Applied to all UI elements, windows and text. Can be used to scale the interface up on a bigger display. Editor restart required.
///
@@ -456,6 +472,13 @@ namespace FlaxEditor.Options
[EditorDisplay("Visject", "Warn when deleting used parameter"), EditorOrder(552)]
public bool WarnOnDeletingUsedVisjectParameter { get; set; } = true;
+ ///
+ /// Gets or sets a value indicating what should happen to unavaliable options in the content create menu.
+ ///
+ [DefaultValue(true)]
+ [EditorDisplay("Content"), EditorOrder(600)]
+ public DisabledHidden UnavaliableContentCreateOptions { get; set; } = DisabledHidden.Hidden;
+
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal(EditorAssets.PrimaryFont);
private static FontAsset ConsoleFont => FlaxEngine.Content.LoadAsyncInternal(EditorAssets.InconsolataRegularFont);
diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs
index 318bf5231..a53de0900 100644
--- a/Source/Editor/Windows/ContentWindow.cs
+++ b/Source/Editor/Windows/ContentWindow.cs
@@ -278,11 +278,31 @@ namespace FlaxEditor.Windows
}
var menu = new ContextMenu();
- CreateNewFolderMenu(menu, CurrentViewFolder, true);
- CreateNewModuleMenu(menu, CurrentViewFolder, true);
+
+ InterfaceOptions interfaceOptions = Editor.Instance.Options.Options.Interface;
+ bool disableUnavaliable = interfaceOptions.UnavaliableContentCreateOptions == InterfaceOptions.DisabledHidden.Disabled;
+
+ CreateNewFolderMenu(menu, CurrentViewFolder, disableUnavaliable);
+ CreateNewModuleMenu(menu, CurrentViewFolder, disableUnavaliable);
menu.AddSeparator();
- CreateNewContentItemMenu(menu, CurrentViewFolder, false, true);
- menu.Show(this, _createNewButton.UpperLeft, ContextMenuDirection.RightUp);
+ CreateNewContentItemMenu(menu, CurrentViewFolder, false, disableUnavaliable);
+ // Hack: Show the menu once to get the direction, then show it above or below the button depending on the direction.
+ menu.Show(this, _createNewButton.UpperLeft);
+ var direction = menu.Direction;
+ menu.Hide();
+ bool below = false;
+ switch (direction)
+ {
+ case ContextMenuDirection.RightDown:
+ case ContextMenuDirection.LeftDown:
+ below = true;
+ break;
+ case ContextMenuDirection.RightUp:
+ case ContextMenuDirection.LeftUp:
+ below = false;
+ break;
+ }
+ menu.Show(this, below ? _createNewButton.BottomLeft : _createNewButton.UpperLeft, direction);
}
private ContextMenu OnViewDropdownPopupCreate(ComboBox comboBox)