Merge branch 'master' into 1.5

# Conflicts:
#	Source/Engine/Renderer/AmbientOcclusionPass.cpp
This commit is contained in:
Wojtek Figat
2023-01-15 18:27:49 +01:00
10 changed files with 761 additions and 29 deletions

View File

@@ -96,6 +96,7 @@ namespace FlaxEditor.Modules
handler.ProgressStart += HandlerOnProgressStart;
handler.ProgressChanged += HandlerOnProgressChanged;
handler.ProgressEnd += HandlerOnProgressEnd;
handler.ProgressFailed += HandlerOnProgressFail;
}
/// <summary>
@@ -113,6 +114,7 @@ namespace FlaxEditor.Modules
handler.ProgressStart -= HandlerOnProgressStart;
handler.ProgressChanged -= HandlerOnProgressChanged;
handler.ProgressEnd -= HandlerOnProgressEnd;
handler.ProgressFailed -= HandlerOnProgressFail;
}
private void UpdateProgress()
@@ -150,5 +152,11 @@ namespace FlaxEditor.Modules
Editor.Windows.FlashMainWindow();
}
}
private void HandlerOnProgressFail(ProgressHandler handler, string message)
{
UpdateProgress();
Editor.UI.ProgressFailed(message);
}
}
}

View File

@@ -31,8 +31,10 @@ namespace FlaxEditor.Modules
{
private Label _progressLabel;
private ProgressBar _progressBar;
private Button _outputLogButton;
private List<KeyValuePair<string, DateTime>> _statusMessages;
private ContentStats _contentStats;
private bool _progressFailed;
private ContextMenuButton _menuFileSaveScenes;
private ContextMenuButton _menuFileCloseScenes;
@@ -252,6 +254,12 @@ namespace FlaxEditor.Modules
{
if (StatusBar == null)
return;
if (ScriptsBuilder.LastCompilationFailed)
{
ProgressFailed("Scripts Compilation Failed");
return;
}
var contentStats = FlaxEngine.Content.Stats;
Color color;
@@ -303,7 +311,28 @@ namespace FlaxEditor.Modules
if (_progressLabel != null)
_progressLabel.Text = text;
if (_progressBar != null)
{
if (_progressFailed)
{
ResetProgressFailure();
}
_progressBar.Value = progress * 100.0f;
}
}
internal void ProgressFailed(string message)
{
_progressFailed = true;
StatusBar.StatusColor = Color.Red;
StatusBar.Text = message;
_outputLogButton.Visible = true;
}
internal void ResetProgressFailure()
{
_outputLogButton.Visible = false;
_progressFailed = false;
UpdateStatusBar();
}
/// <inheritdoc />
@@ -584,6 +613,30 @@ namespace FlaxEditor.Modules
Parent = mainWindow,
Offsets = new Margin(0, 0, -StatusBar.DefaultHeight, StatusBar.DefaultHeight),
};
// Output log button
_outputLogButton = new Button()
{
AnchorPreset = AnchorPresets.TopLeft,
Parent = StatusBar,
Visible = false,
Text = "",
Width = 200,
TooltipText = "Opens or shows the output log window.",
BackgroundColor = Color.Transparent,
BorderColor = Color.Transparent,
BackgroundColorHighlighted = Color.Transparent,
BackgroundColorSelected = Color.Transparent,
BorderColorHighlighted = Color.Transparent,
BorderColorSelected = Color.Transparent,
};
_outputLogButton.LocalY -= 2;
var defaultTextColor = StatusBar.TextColor;
_outputLogButton.HoverBegin += () => StatusBar.TextColor = Style.Current.BackgroundSelected;
_outputLogButton.HoverEnd += () => StatusBar.TextColor = defaultTextColor;
_outputLogButton.Clicked += () =>
{
Editor.Windows.OutputLogWin.FocusOrShow();
};
// Progress bar with label
const float progressBarWidth = 120.0f;