add option for what happens with unavailable entries and fix menu positioning
This commit is contained in:
@@ -140,7 +140,7 @@ namespace FlaxEditor.Options
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Options focus Game Window behaviour when play mode is entered.
|
||||
/// Options for focus Game Window behaviour when play mode is entered.
|
||||
/// </summary>
|
||||
public enum PlayModeFocus
|
||||
{
|
||||
@@ -160,6 +160,22 @@ namespace FlaxEditor.Options
|
||||
GameWindowThenRestore,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic options for a disabled or hidden state. Used for example in create content button.
|
||||
/// </summary>
|
||||
public enum DisabledHidden
|
||||
{
|
||||
/// <summary>
|
||||
/// Disabled state.
|
||||
/// </summary>
|
||||
Disabled,
|
||||
|
||||
/// <summary>
|
||||
/// Hidden state.
|
||||
/// </summary>
|
||||
Hidden,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
@@ -456,6 +472,13 @@ namespace FlaxEditor.Options
|
||||
[EditorDisplay("Visject", "Warn when deleting used parameter"), EditorOrder(552)]
|
||||
public bool WarnOnDeletingUsedVisjectParameter { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating what should happen to unavaliable options in the content create menu.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
[EditorDisplay("Content"), EditorOrder(600)]
|
||||
public DisabledHidden UnavaliableContentCreateOptions { get; set; } = DisabledHidden.Hidden;
|
||||
|
||||
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont);
|
||||
private static FontAsset ConsoleFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user