Merge remote-tracking branch 'origin/master' into 1.6
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
using FlaxEditor.CustomEditors.Elements;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEngine.Json;
|
||||
|
||||
namespace FlaxEditor.CustomEditors.Editors
|
||||
{
|
||||
@@ -54,6 +55,13 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
ZElement = grid.FloatValue();
|
||||
ZElement.ValueBox.ValueChanged += OnValueChanged;
|
||||
ZElement.ValueBox.SlidingEnd += ClearToken;
|
||||
|
||||
LinkedLabel.SetupContextMenu += (label, menu, editor) =>
|
||||
{
|
||||
menu.AddSeparator();
|
||||
var value = ((Quaternion)Values[0]).EulerAngles;
|
||||
menu.AddButton("Copy Euler", () => { Clipboard.Text = JsonSerializer.Serialize(value); }).TooltipText = "Copy the Euler Angles in Degrees";
|
||||
};
|
||||
}
|
||||
|
||||
private void OnValueChanged()
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace FlaxEditor.Modules
|
||||
private ContextMenuButton _menuFileSaveScenes;
|
||||
private ContextMenuButton _menuFileCloseScenes;
|
||||
private ContextMenuButton _menuFileGenerateScriptsProjectFiles;
|
||||
private ContextMenuButton _menuSaveAll;
|
||||
private ContextMenuButton _menuEditUndo;
|
||||
private ContextMenuButton _menuEditRedo;
|
||||
private ContextMenuButton _menuEditCut;
|
||||
@@ -47,6 +48,7 @@ namespace FlaxEditor.Modules
|
||||
private ContextMenuButton _menuEditDelete;
|
||||
private ContextMenuButton _menuEditDuplicate;
|
||||
private ContextMenuButton _menuEditSelectAll;
|
||||
private ContextMenuButton _menuEditFind;
|
||||
private ContextMenuButton _menuSceneMoveActorToViewport;
|
||||
private ContextMenuButton _menuSceneAlignActorWithViewport;
|
||||
private ContextMenuButton _menuSceneAlignViewportWithActor;
|
||||
@@ -136,6 +138,11 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
public MainMenuButton MenuHelp { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fired when the main menu short cut keys are updated. Can be used to update plugin short cut keys.
|
||||
/// </summary>
|
||||
public event Action MainMenuShortcutKeysUpdated;
|
||||
|
||||
internal UIModule(Editor editor)
|
||||
: base(editor)
|
||||
{
|
||||
@@ -349,6 +356,8 @@ namespace FlaxEditor.Modules
|
||||
InitStatusBar(mainWindow);
|
||||
InitDockPanel(mainWindow);
|
||||
|
||||
Editor.Options.OptionsChanged += OnOptionsChanged;
|
||||
|
||||
// Add dummy control for drawing the main window borders if using a custom style
|
||||
#if PLATFORM_WINDOWS
|
||||
if (!Editor.Options.Options.Interface.UseNativeWindowSystem)
|
||||
@@ -464,11 +473,13 @@ namespace FlaxEditor.Modules
|
||||
Parent = mainWindow
|
||||
};
|
||||
|
||||
var inputOptions = Editor.Options.Options.Input;
|
||||
|
||||
// File
|
||||
MenuFile = MainMenu.AddButton("File");
|
||||
var cm = MenuFile.ContextMenu;
|
||||
cm.VisibleChanged += OnMenuFileShowHide;
|
||||
cm.AddButton("Save All", "Ctrl+S", Editor.SaveAll);
|
||||
_menuSaveAll = cm.AddButton("Save All", inputOptions.Save.ToString(), Editor.SaveAll);
|
||||
_menuFileSaveScenes = cm.AddButton("Save scenes", Editor.Scene.SaveScenes);
|
||||
_menuFileCloseScenes = cm.AddButton("Close scenes", Editor.Scene.CloseAllScenes);
|
||||
cm.AddSeparator();
|
||||
@@ -484,18 +495,18 @@ namespace FlaxEditor.Modules
|
||||
MenuEdit = MainMenu.AddButton("Edit");
|
||||
cm = MenuEdit.ContextMenu;
|
||||
cm.VisibleChanged += OnMenuEditShowHide;
|
||||
_menuEditUndo = cm.AddButton(string.Empty, "Ctrl+Z", Editor.PerformUndo);
|
||||
_menuEditRedo = cm.AddButton(string.Empty, "Ctrl+Y", Editor.PerformRedo);
|
||||
_menuEditUndo = cm.AddButton(string.Empty, inputOptions.Undo.ToString(), Editor.PerformUndo);
|
||||
_menuEditRedo = cm.AddButton(string.Empty, inputOptions.Redo.ToString(), Editor.PerformRedo);
|
||||
cm.AddSeparator();
|
||||
_menuEditCut = cm.AddButton("Cut", "Ctrl+X", Editor.SceneEditing.Cut);
|
||||
_menuEditCopy = cm.AddButton("Copy", "Ctrl+C", Editor.SceneEditing.Copy);
|
||||
_menuEditPaste = cm.AddButton("Paste", "Ctrl+V", Editor.SceneEditing.Paste);
|
||||
_menuEditCut = cm.AddButton("Cut", inputOptions.Cut.ToString(), Editor.SceneEditing.Cut);
|
||||
_menuEditCopy = cm.AddButton("Copy", inputOptions.Copy.ToString(), Editor.SceneEditing.Copy);
|
||||
_menuEditPaste = cm.AddButton("Paste", inputOptions.Paste.ToString(), Editor.SceneEditing.Paste);
|
||||
cm.AddSeparator();
|
||||
_menuEditDelete = cm.AddButton("Delete", "Del", Editor.SceneEditing.Delete);
|
||||
_menuEditDuplicate = cm.AddButton("Duplicate", "Ctrl+D", Editor.SceneEditing.Duplicate);
|
||||
_menuEditDelete = cm.AddButton("Delete", inputOptions.Delete.ToString(), Editor.SceneEditing.Delete);
|
||||
_menuEditDuplicate = cm.AddButton("Duplicate", inputOptions.Duplicate.ToString(), Editor.SceneEditing.Duplicate);
|
||||
cm.AddSeparator();
|
||||
_menuEditSelectAll = cm.AddButton("Select all", "Ctrl+A", Editor.SceneEditing.SelectAllScenes);
|
||||
cm.AddButton("Find", "Ctrl+F", Editor.Windows.SceneWin.Search);
|
||||
_menuEditSelectAll = cm.AddButton("Select all", inputOptions.SelectAll.ToString(), Editor.SceneEditing.SelectAllScenes);
|
||||
_menuEditFind = cm.AddButton("Find", inputOptions.Search.ToString(), Editor.Windows.SceneWin.Search);
|
||||
|
||||
// Scene
|
||||
MenuScene = MainMenu.AddButton("Scene");
|
||||
@@ -512,8 +523,8 @@ namespace FlaxEditor.Modules
|
||||
MenuGame = MainMenu.AddButton("Game");
|
||||
cm = MenuGame.ContextMenu;
|
||||
cm.VisibleChanged += OnMenuGameShowHide;
|
||||
_menuGamePlay = cm.AddButton("Play", "F5", Editor.Simulation.RequestStartPlay);
|
||||
_menuGamePause = cm.AddButton("Pause", "F6", Editor.Simulation.RequestPausePlay);
|
||||
_menuGamePlay = cm.AddButton("Play", inputOptions.Play.ToString(), Editor.Simulation.RequestStartPlay);
|
||||
_menuGamePause = cm.AddButton("Pause", inputOptions.Pause.ToString(), Editor.Simulation.RequestPausePlay);
|
||||
cm.AddSeparator();
|
||||
cm.AddButton("Cook&Run", Editor.Windows.GameCookerWin.BuildAndRun).LinkTooltip("Runs Game Cooker to build the game for this platform and runs the game after.");
|
||||
cm.AddButton("Run cooked game", Editor.Windows.GameCookerWin.RunCooked).LinkTooltip("Runs the game build from the last cooking output. Use Cook&Play or Game Cooker first.");
|
||||
@@ -579,6 +590,25 @@ namespace FlaxEditor.Modules
|
||||
cm.AddButton("Information about Flax", () => new AboutDialog().Show());
|
||||
}
|
||||
|
||||
private void OnOptionsChanged(FlaxEditor.Options.EditorOptions options)
|
||||
{
|
||||
var inputOptions = options.Input;
|
||||
|
||||
_menuSaveAll.ShortKeys = inputOptions.Save.ToString();
|
||||
_menuEditUndo.ShortKeys = inputOptions.Undo.ToString();
|
||||
_menuEditRedo.ShortKeys = inputOptions.Redo.ToString();
|
||||
_menuEditCut.ShortKeys = inputOptions.Cut.ToString();
|
||||
_menuEditCopy.ShortKeys = inputOptions.Copy.ToString();
|
||||
_menuEditDelete.ShortKeys = inputOptions.Delete.ToString();
|
||||
_menuEditDuplicate.ShortKeys = inputOptions.Duplicate.ToString();
|
||||
_menuEditSelectAll.ShortKeys = inputOptions.SelectAll.ToString();
|
||||
_menuEditFind.ShortKeys = inputOptions.Search.ToString();
|
||||
_menuGamePlay.ShortKeys = inputOptions.Play.ToString();
|
||||
_menuGamePause.ShortKeys = inputOptions.Pause.ToString();
|
||||
|
||||
MainMenuShortcutKeysUpdated?.Invoke();
|
||||
}
|
||||
|
||||
private void InitToolstrip(RootControl mainWindow)
|
||||
{
|
||||
ToolStrip = new ToolStrip(34.0f, MainMenu.Bottom)
|
||||
|
||||
@@ -407,14 +407,17 @@ namespace FlaxEditor.Options
|
||||
}
|
||||
}
|
||||
|
||||
private readonly List<Binding> _bindings;
|
||||
/// <summary>
|
||||
/// List of all available bindings.
|
||||
/// </summary>
|
||||
public List<Binding> Bindings;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="InputActionsContainer"/> class.
|
||||
/// </summary>
|
||||
public InputActionsContainer()
|
||||
{
|
||||
_bindings = new List<Binding>();
|
||||
Bindings = new List<Binding>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -423,7 +426,7 @@ namespace FlaxEditor.Options
|
||||
/// <param name="bindings">The input bindings collection.</param>
|
||||
public InputActionsContainer(params Binding[] bindings)
|
||||
{
|
||||
_bindings = new List<Binding>(bindings);
|
||||
Bindings = new List<Binding>(bindings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -432,7 +435,7 @@ namespace FlaxEditor.Options
|
||||
/// <param name="binding">The input binding.</param>
|
||||
public void Add(Binding binding)
|
||||
{
|
||||
_bindings.Add(binding);
|
||||
Bindings.Add(binding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -442,7 +445,7 @@ namespace FlaxEditor.Options
|
||||
/// <param name="callback">The callback to invoke on user input.</param>
|
||||
public void Add(Func<InputOptions, InputBinding> binder, Action callback)
|
||||
{
|
||||
_bindings.Add(new Binding(binder, callback));
|
||||
Bindings.Add(new Binding(binder, callback));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -451,7 +454,7 @@ namespace FlaxEditor.Options
|
||||
/// <param name="bindings">The input bindings collection.</param>
|
||||
public void Add(params Binding[] bindings)
|
||||
{
|
||||
_bindings.AddRange(bindings);
|
||||
Bindings.AddRange(bindings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -466,12 +469,12 @@ namespace FlaxEditor.Options
|
||||
var root = control.Root;
|
||||
var options = editor.Options.Options.Input;
|
||||
|
||||
for (int i = 0; i < _bindings.Count; i++)
|
||||
for (int i = 0; i < Bindings.Count; i++)
|
||||
{
|
||||
var binding = _bindings[i].Binder(options);
|
||||
var binding = Bindings[i].Binder(options);
|
||||
if (binding.Process(control, key))
|
||||
{
|
||||
_bindings[i].Callback();
|
||||
Bindings[i].Callback();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,10 +357,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
var dragAreaColor = BackgroundColor / 2.0f;
|
||||
|
||||
if (IsMouseOver)
|
||||
BackgroundColor *= 1.2f;
|
||||
if (_textRectHovered)
|
||||
BackgroundColor *= 1.2f;
|
||||
BackgroundColor *= 1.5f;
|
||||
|
||||
Render2D.FillRectangle(_textRect, BackgroundColor);
|
||||
Render2D.FillRectangle(_dragAreaRect, dragAreaColor);
|
||||
@@ -1192,10 +1190,8 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
BackgroundColor = style.BackgroundNormal;
|
||||
var dragAreaColor = BackgroundColor / 2.0f;
|
||||
|
||||
if (IsMouseOver)
|
||||
BackgroundColor *= 1.2f;
|
||||
if (_textRectHovered)
|
||||
BackgroundColor *= 1.2f;
|
||||
BackgroundColor *= 1.5f;
|
||||
|
||||
Render2D.FillRectangle(_textRect, BackgroundColor);
|
||||
Render2D.FillRectangle(_dragAreaRect, dragAreaColor);
|
||||
|
||||
@@ -802,18 +802,7 @@ void Actor::Initialize()
|
||||
|
||||
void Actor::BeginPlay(SceneBeginData* data)
|
||||
{
|
||||
// Perform additional verification
|
||||
ASSERT(!IsDuringPlay());
|
||||
#if BUILD_DEBUG
|
||||
for (int32 i = 0; i < Children.Count(); i++)
|
||||
{
|
||||
ASSERT(Children[i]->IsDuringPlay() == IsDuringPlay());
|
||||
}
|
||||
for (int32 i = 0; i < Scripts.Count(); i++)
|
||||
{
|
||||
ASSERT(Scripts[i]->IsDuringPlay() == IsDuringPlay());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set flag
|
||||
Flags |= ObjectFlags::IsDuringPlay;
|
||||
@@ -843,18 +832,7 @@ void Actor::BeginPlay(SceneBeginData* data)
|
||||
|
||||
void Actor::EndPlay()
|
||||
{
|
||||
// Perform additional verification
|
||||
ASSERT(IsDuringPlay());
|
||||
#if BUILD_DEBUG
|
||||
for (int32 i = 0; i < Children.Count(); i++)
|
||||
{
|
||||
ASSERT(Children[i]->IsDuringPlay() == IsDuringPlay());
|
||||
}
|
||||
for (int32 i = 0; i < Scripts.Count(); i++)
|
||||
{
|
||||
ASSERT(Scripts[i]->IsDuringPlay() == IsDuringPlay());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fire event for scripting
|
||||
if (IsActiveInHierarchy() && GetScene())
|
||||
@@ -871,7 +849,8 @@ void Actor::EndPlay()
|
||||
// Call event deeper
|
||||
for (int32 i = 0; i < Children.Count(); i++)
|
||||
{
|
||||
Children[i]->EndPlay();
|
||||
if (Children[i]->IsDuringPlay())
|
||||
Children[i]->EndPlay();
|
||||
}
|
||||
|
||||
// Fire event for scripting
|
||||
@@ -886,7 +865,8 @@ void Actor::EndPlay()
|
||||
// Inform attached scripts
|
||||
for (int32 i = 0; i < Scripts.Count(); i++)
|
||||
{
|
||||
Scripts[i]->EndPlay();
|
||||
if (Scripts[i]->IsDuringPlay())
|
||||
Scripts[i]->EndPlay();
|
||||
}
|
||||
|
||||
// Cleanup managed object
|
||||
|
||||
Reference in New Issue
Block a user