Merge remote-tracking branch 'upstream/master' into reverse-z

This commit is contained in:
ExMatics HydrogenC
2024-06-04 12:08:07 +08:00
22 changed files with 252 additions and 87 deletions
+13
View File
@@ -223,6 +223,19 @@ void ManagedEditor::Init()
{
LOG(Info, "Loading managed assemblies (due to disabled compilation on startup)");
Scripting::Load();
const auto endInitMethod = mclass->GetMethod("EndInit");
if (endInitMethod == nullptr)
{
LOG(Fatal, "Invalid Editor assembly! Missing EndInit method.");
}
endInitMethod->Invoke(instance, nullptr, &exception);
if (exception)
{
MException ex(exception);
ex.Log(LogType::Warning, TEXT("ManagedEditor::EndInit"));
LOG_STR(Fatal, TEXT("Failed to initialize editor during EndInit! ") + ex.Message);
}
}
// Call building if need to (based on CL)
+75 -26
View File
@@ -175,13 +175,6 @@ namespace FlaxEditor.Options
[EditorDisplay("Interface", "New Window Location"), EditorOrder(150), Tooltip("Define the opening method for new windows, open in a new tab by default.")]
public DockStateProxy NewWindowLocation { get; set; } = DockStateProxy.Float;
/// <summary>
/// Gets or sets the timestamps prefix mode for debug log messages.
/// </summary>
[DefaultValue(TimestampsFormats.None)]
[EditorDisplay("Interface"), EditorOrder(210), Tooltip("The timestamps prefix mode for debug log messages.")]
public TimestampsFormats DebugLogTimestampsFormat { get; set; } = TimestampsFormats.None;
/// <summary>
/// Gets or sets the editor icons scale. Editor restart required.
/// </summary>
@@ -220,21 +213,70 @@ namespace FlaxEditor.Options
/// <summary>
/// Gets or sets the timestamps prefix mode for output log messages.
/// </summary>
[DefaultValue(TimestampsFormats.TimeSinceStartup)]
[EditorDisplay("Output Log", "Timestamps Format"), EditorOrder(300), Tooltip("The timestamps prefix mode for output log messages.")]
public TimestampsFormats OutputLogTimestampsFormat { get; set; } = TimestampsFormats.TimeSinceStartup;
[DefaultValue(TimestampsFormats.None)]
[EditorDisplay("Debug Log"), EditorOrder(350), Tooltip("The timestamps prefix mode for debug log messages.")]
public TimestampsFormats DebugLogTimestampsFormat { get; set; } = TimestampsFormats.None;
/// <summary>
/// Gets or sets the clear on play for debug log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Debug Log", "Clear on Play"), EditorOrder(360), Tooltip("Clears all log entries on enter playmode.")]
public bool DebugLogClearOnPlay { get; set; } = true;
/// <summary>
/// Gets or sets the collapse mode for debug log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Debug Log"), EditorOrder(361), Tooltip("Collapses similar or repeating log entries.")]
public bool DebugLogCollapse { get; set; } = true;
/// <summary>
/// Gets or sets the automatic pause on error for debug log messages.
/// </summary>
[DefaultValue(false)]
[EditorDisplay("Debug Log", "Pause on Error"), EditorOrder(362), Tooltip("Performs auto pause on error.")]
public bool DebugLogPauseOnError { get; set; } = false;
/// <summary>
/// Gets or sets the automatic pause on error for debug log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Debug Log", "Show error messages"), EditorOrder(370), Tooltip("Shows/hides error messages.")]
public bool DebugLogShowErrorMessages { get; set; } = true;
/// <summary>
/// Gets or sets the automatic pause on error for debug log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Debug Log", "Show warning messages"), EditorOrder(371), Tooltip("Shows/hides warning messages.")]
public bool DebugLogShowWarningMessages { get; set; } = true;
/// <summary>
/// Gets or sets the automatic pause on error for debug log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Debug Log", "Show info messages"), EditorOrder(372), Tooltip("Shows/hides info messages.")]
public bool DebugLogShowInfoMessages { get; set; } = true;
/// <summary>
/// Gets or sets the timestamps prefix mode for output log messages.
/// </summary>
[DefaultValue(TimestampsFormats.TimeSinceStartup)]
[EditorDisplay("Output Log", "Timestamps Format"), EditorOrder(400), Tooltip("The timestamps prefix mode for output log messages.")]
public TimestampsFormats OutputLogTimestampsFormat { get; set; } = TimestampsFormats.TimeSinceStartup;
/// <summary>
/// Gets or sets the log type prefix mode for output log messages.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Output Log", "Show Log Type"), EditorOrder(310), Tooltip("Determines whether show log type prefix in output log messages.")]
[EditorDisplay("Output Log", "Show Log Type"), EditorOrder(410), Tooltip("Determines whether show log type prefix in output log messages.")]
public bool OutputLogShowLogType { get; set; } = true;
/// <summary>
/// Gets or sets the output log text font.
/// </summary>
[EditorDisplay("Output Log", "Text Font"), EditorOrder(320), Tooltip("The output log text font.")]
[EditorDisplay("Output Log", "Text Font"), EditorOrder(420), Tooltip("The output log text font.")]
public FontReference OutputLogTextFont
{
get => _outputLogFont;
@@ -253,63 +295,70 @@ namespace FlaxEditor.Options
/// Gets or sets the output log text color.
/// </summary>
[DefaultValue(typeof(Color), "1,1,1,1")]
[EditorDisplay("Output Log", "Text Color"), EditorOrder(330), Tooltip("The output log text color.")]
[EditorDisplay("Output Log", "Text Color"), EditorOrder(430), Tooltip("The output log text color.")]
public Color OutputLogTextColor { get; set; } = Color.White;
/// <summary>
/// Gets or sets the output log text shadow color.
/// </summary>
[DefaultValue(typeof(Color), "0,0,0,0.5")]
[EditorDisplay("Output Log", "Text Shadow Color"), EditorOrder(340), Tooltip("The output log text shadow color.")]
[EditorDisplay("Output Log", "Text Shadow Color"), EditorOrder(440), Tooltip("The output log text shadow color.")]
public Color OutputLogTextShadowColor { get; set; } = new Color(0, 0, 0, 0.5f);
/// <summary>
/// Gets or sets the output log text shadow offset. Set to 0 to disable this feature.
/// </summary>
[DefaultValue(typeof(Float2), "1,1")]
[EditorDisplay("Output Log", "Text Shadow Offset"), EditorOrder(340), Tooltip("The output log text shadow offset. Set to 0 to disable this feature.")]
[EditorDisplay("Output Log", "Text Shadow Offset"), EditorOrder(445), Tooltip("The output log text shadow offset. Set to 0 to disable this feature.")]
public Float2 OutputLogTextShadowOffset { get; set; } = new Float2(1);
/// <summary>
/// Gets or sets a value indicating whether auto-focus output log window on code compilation error.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Output Log", "Focus Output Log On Compilation Error"), EditorOrder(350), Tooltip("Determines whether auto-focus output log window on code compilation error.")]
[EditorDisplay("Output Log", "Focus Output Log On Compilation Error"), EditorOrder(450), Tooltip("Determines whether auto-focus output log window on code compilation error.")]
public bool FocusOutputLogOnCompilationError { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether auto-focus output log window on game build error.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Output Log", "Focus Output Log On Game Build Error"), EditorOrder(360), Tooltip("Determines whether auto-focus output log window on game build error.")]
[EditorDisplay("Output Log", "Focus Output Log On Game Build Error"), EditorOrder(460), Tooltip("Determines whether auto-focus output log window on game build error.")]
public bool FocusOutputLogOnGameBuildError { get; set; } = true;
/// <summary>
/// Gets or sets the value for automatic scroll to bottom in output log.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Output Log", "Scroll to bottom"), EditorOrder(470), Tooltip("Scroll the output log view to bottom automatically after new lines are added.")]
public bool OutputLogScrollToBottom { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether auto-focus game window on play mode start.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Play In-Editor", "Focus Game Window On Play"), EditorOrder(400), Tooltip("Determines whether auto-focus game window on play mode start.")]
[EditorDisplay("Play In-Editor", "Focus Game Window On Play"), EditorOrder(500), Tooltip("Determines whether auto-focus game window on play mode start.")]
public bool FocusGameWinOnPlay { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating what action should be taken upon pressing the play button.
/// </summary>
[DefaultValue(PlayAction.PlayScenes)]
[EditorDisplay("Play In-Editor", "Play Button Action"), EditorOrder(410)]
[EditorDisplay("Play In-Editor", "Play Button Action"), EditorOrder(510)]
public PlayAction PlayButtonAction { get; set; } = PlayAction.PlayScenes;
/// <summary>
/// Gets or sets a value indicating how the game window should be displayed when the game is launched.
/// </summary>
[DefaultValue(GameWindowMode.Docked)]
[EditorDisplay("Play In-Editor", "Game Window Mode"), EditorOrder(420), Tooltip("Determines how the game window is displayed when the game is launched.")]
[EditorDisplay("Play In-Editor", "Game Window Mode"), EditorOrder(520), Tooltip("Determines how the game window is displayed when the game is launched.")]
public GameWindowMode DefaultGameWindowMode { get; set; } = GameWindowMode.Docked;
/// <summary>
/// Gets or sets a value indicating the number of game clients to launch when building and/or running cooked game.
/// </summary>
[DefaultValue(1), Range(1, 4)]
[EditorDisplay("Cook & Run"), EditorOrder(500)]
[EditorDisplay("Cook & Run"), EditorOrder(600)]
public int NumberOfGameClientsToLaunch = 1;
/// <summary>
@@ -331,13 +380,13 @@ namespace FlaxEditor.Options
/// <summary>
/// The list of fallback fonts to use when main text font is missing certain characters. Empty to use fonts from GraphicsSettings.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(650)]
[EditorDisplay("Fonts"), EditorOrder(750)]
public FontAsset[] FallbackFonts = new FontAsset[1] { FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.FallbackFont) };
/// <summary>
/// Gets or sets the title font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(600), Tooltip("The title font for editor UI.")]
[EditorDisplay("Fonts"), EditorOrder(700), Tooltip("The title font for editor UI.")]
public FontReference TitleFont
{
get => _titleFont;
@@ -355,7 +404,7 @@ namespace FlaxEditor.Options
/// <summary>
/// Gets or sets the large font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(610), Tooltip("The large font for editor UI.")]
[EditorDisplay("Fonts"), EditorOrder(710), Tooltip("The large font for editor UI.")]
public FontReference LargeFont
{
get => _largeFont;
@@ -373,7 +422,7 @@ namespace FlaxEditor.Options
/// <summary>
/// Gets or sets the medium font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(620), Tooltip("The medium font for editor UI.")]
[EditorDisplay("Fonts"), EditorOrder(720), Tooltip("The medium font for editor UI.")]
public FontReference MediumFont
{
get => _mediumFont;
@@ -391,7 +440,7 @@ namespace FlaxEditor.Options
/// <summary>
/// Gets or sets the small font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(630), Tooltip("The small font for editor UI.")]
[EditorDisplay("Fonts"), EditorOrder(730), Tooltip("The small font for editor UI.")]
public FontReference SmallFont
{
get => _smallFont;
-1
View File
@@ -71,7 +71,6 @@ namespace FlaxEditor.States
{
// Skip compilation on startup
OnCompilationEnd(true);
Editor.EndInit();
}
}
+14 -12
View File
@@ -2198,21 +2198,23 @@ namespace FlaxEditor.Surface.Archetypes
_combobox.ClearItems();
_tooltips.Clear();
_functionNodesIds.Clear();
var nodes = Surface.Nodes;
var count = _signature != null ? nodes.Count : 0;
for (int i = 0; i < count; i++)
if (Surface != null && _signature != null)
{
if (nodes[i] is VisualScriptFunctionNode functionNode)
var nodes = Surface.Nodes;
for (int i = 0; i < nodes.Count; i++)
{
// Get if function signature matches the event signature
functionNode.GetSignature(out var functionSig);
if (IsValidFunctionSignature(ref functionSig))
if (nodes[i] is VisualScriptFunctionNode functionNode)
{
if (functionNode.ID == handlerFunctionNodeId)
toSelect = _functionNodesIds.Count;
_functionNodesIds.Add(functionNode.ID);
_tooltips.Add(functionNode.TooltipText);
_combobox.AddItem(functionSig.ToString());
// Get if function signature matches the event signature
functionNode.GetSignature(out var functionSig);
if (IsValidFunctionSignature(ref functionSig))
{
if (functionNode.ID == handlerFunctionNodeId)
toSelect = _functionNodesIds.Count;
_functionNodesIds.Add(functionNode.ID);
_tooltips.Add(functionNode.TooltipText);
_combobox.AddItem(functionSig.ToString());
}
}
}
}
+1 -1
View File
@@ -1266,7 +1266,7 @@ namespace FlaxEditor.Surface.Archetypes
/// <inheritdoc />
public void DrawConnectingLine(ref Float2 startPos, ref Float2 endPos, ref Color color)
{
OutputBox.DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, 2);
OutputBox.DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, OutputBox.ConnectingConnectionThickness);
}
/// <inheritdoc />
+1 -1
View File
@@ -738,7 +738,7 @@ namespace FlaxEditor.Surface.Elements
/// <inheritdoc />
public void DrawConnectingLine(ref Float2 startPos, ref Float2 endPos, ref Color color)
{
OutputBox.DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, 2);
OutputBox.DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, OutputBox.ConnectingConnectionThickness);
}
/// <inheritdoc />
+1 -1
View File
@@ -35,7 +35,7 @@ namespace FlaxEditor.Surface.Elements
ParentNode.ValuesChanged += OnNodeValuesChanged;
// Disable slider if surface doesn't allow it
if (!ParentNode.Surface.CanLivePreviewValueChanges)
if (ParentNode.Surface != null && !ParentNode.Surface.CanLivePreviewValueChanges)
_slideSpeed = 0.0f;
}
+55 -16
View File
@@ -14,6 +14,26 @@ namespace FlaxEditor.Surface.Elements
[HideInEditor]
public class OutputBox : Box
{
/// <summary>
/// The default thickness of the connection line
/// </summary>
public const float DefaultConnectionThickness = 1.5f;
/// <summary>
/// The thickness of a highlighted connection line
/// </summary>
public const float ConnectingConnectionThickness = 2.5f;
/// <summary>
/// The thickness of the selected connection line
/// </summary>
public const float SelectedConnectionThickness = 3f;
/// <summary>
/// The offset between the connection line and the box
/// </summary>
public const float DefaultConnectionOffset = 24f;
/// <summary>
/// Distance for the mouse to be considered above the connection
/// </summary>
@@ -33,7 +53,7 @@ namespace FlaxEditor.Surface.Elements
/// <param name="end">The end location.</param>
/// <param name="color">The connection color.</param>
/// <param name="thickness">The connection thickness.</param>
public static void DrawConnection(SurfaceStyle style, ref Float2 start, ref Float2 end, ref Color color, float thickness = 1)
public static void DrawConnection(SurfaceStyle style, ref Float2 start, ref Float2 end, ref Color color, float thickness = DefaultConnectionThickness)
{
if (style.DrawConnection != null)
{
@@ -41,11 +61,22 @@ namespace FlaxEditor.Surface.Elements
return;
}
float connectionOffset = Mathf.Max(0f, DefaultConnectionOffset * (1 - Editor.Instance.Options.Options.Interface.ConnectionCurvature));
Float2 offsetStart = new Float2(start.X + connectionOffset, start.Y);
Float2 offsetEnd = new Float2(end.X - connectionOffset, end.Y);
// Calculate control points
CalculateBezierControlPoints(start, end, out var control1, out var control2);
CalculateBezierControlPoints(offsetStart, offsetEnd, out var control1, out var control2);
// Draw offset lines only if necessary
if (connectionOffset >= float.Epsilon)
{
Render2D.DrawLine(start, offsetStart, color, thickness);
Render2D.DrawLine(offsetEnd, end, color, thickness);
}
// Draw line
Render2D.DrawBezier(start, control1, control2, end, color, thickness);
Render2D.DrawBezier(offsetStart, control1, control2, offsetEnd, color, thickness);
/*
// Debug drawing control points
@@ -80,9 +111,10 @@ namespace FlaxEditor.Surface.Elements
/// <param name="mousePosition">The mouse position</param>
public bool IntersectsConnection(Box targetBox, ref Float2 mousePosition)
{
var startPos = ConnectionOrigin;
var endPos = targetBox.ConnectionOrigin;
return IntersectsConnection(ref startPos, ref endPos, ref mousePosition, MouseOverConnectionDistance);
float connectionOffset = Mathf.Max(0f, DefaultConnectionOffset * (1 - Editor.Instance.Options.Options.Interface.ConnectionCurvature));
Float2 start = new Float2(ConnectionOrigin.X + connectionOffset, ConnectionOrigin.Y);
Float2 end = new Float2(targetBox.ConnectionOrigin.X - connectionOffset, targetBox.ConnectionOrigin.Y);
return IntersectsConnection(ref start, ref end, ref mousePosition, MouseOverConnectionDistance);
}
/// <summary>
@@ -102,22 +134,26 @@ namespace FlaxEditor.Surface.Elements
if ((point.Y - (start.Y - offset)) * ((end.Y + offset) - point.Y) < 0)
return false;
float squaredDistance = distance;
CalculateBezierControlPoints(start, end, out var control1, out var control2);
float connectionOffset = Mathf.Max(0f, DefaultConnectionOffset * (1 - Editor.Instance.Options.Options.Interface.ConnectionCurvature));
Float2 offsetStart = new Float2(start.X + connectionOffset, start.Y);
Float2 offsetEnd = new Float2(end.X - connectionOffset, end.Y);
var d1 = control1 - start;
float squaredDistance = distance;
CalculateBezierControlPoints(offsetStart, offsetEnd, out var control1, out var control2);
var d1 = control1 - offsetStart;
var d2 = control2 - control1;
var d3 = end - control2;
var d3 = offsetEnd - control2;
float len = d1.Length + d2.Length + d3.Length;
int segmentCount = Math.Min(Math.Max(Mathf.CeilToInt(len * 0.05f), 1), 100);
float segmentCountInv = 1.0f / segmentCount;
Bezier(ref start, ref control1, ref control2, ref end, 0, out var p);
Bezier(ref offsetStart, ref control1, ref control2, ref offsetEnd, 0, out var p);
for (int i = 1; i <= segmentCount; i++)
{
var oldp = p;
float t = i * segmentCountInv;
Bezier(ref start, ref control1, ref control2, ref end, t, out p);
Bezier(ref offsetStart, ref control1, ref control2, ref offsetEnd, t, out p);
// Maybe it would be reasonable to return the point?
CollisionsHelper.ClosestPointPointLine(ref point, ref oldp, ref p, out var result);
@@ -153,14 +189,17 @@ namespace FlaxEditor.Surface.Elements
{
Box targetBox = Connections[i];
var endPos = targetBox.ConnectionOrigin;
var highlight = 1 + Mathf.Max(startHighlight, targetBox.ConnectionsHighlightIntensity);
var highlight = DefaultConnectionThickness + Mathf.Max(startHighlight, targetBox.ConnectionsHighlightIntensity);
var alpha = targetBox.Enabled && targetBox.IsActive ? 1.0f : 0.6f;
var color = _currentTypeColor * highlight * alpha;
// We have to calculate an offset here to preserve the original color for when the default connection thickness is larger than 1
var highlightOffset = (highlight - (DefaultConnectionThickness - 1));
var color = _currentTypeColor * highlightOffset * alpha;
// TODO: Figure out how to only draw the topmost connection
if (IntersectsConnection(ref startPos, ref endPos, ref mousePosition, mouseOverDistance))
{
highlight += 0.5f;
highlight += DefaultConnectionThickness * 0.5f;
}
DrawConnection(style, ref startPos, ref endPos, ref color, highlight);
@@ -177,7 +216,7 @@ namespace FlaxEditor.Surface.Elements
var endPos = targetBox.ConnectionOrigin;
var alpha = targetBox.Enabled && targetBox.IsActive ? 1.0f : 0.6f;
var color = _currentTypeColor * alpha;
DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, 2.5f);
DrawConnection(Surface.Style, ref startPos, ref endPos, ref color, SelectedConnectionThickness);
}
/// <inheritdoc />
+40 -10
View File
@@ -318,7 +318,6 @@ namespace FlaxEditor.Windows
{
Title = "Debug Log";
Icon = IconInfo;
OnEditorOptionsChanged(Editor.Options.Options);
FlaxEditor.Utilities.Utils.SetupCommonInputActions(this);
// Toolstrip
@@ -327,17 +326,42 @@ namespace FlaxEditor.Windows
Parent = this,
};
toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
_clearOnPlayButton = (ToolStripButton)toolstrip.AddButton("Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
bool collapse = true;
if (Editor.ProjectCache.TryGetCustomData("DebugLogCollapse", out bool setCollapse))
collapse = setCollapse;
_collapseLogsButton = (ToolStripButton)toolstrip.AddButton("Collapse", () => Editor.ProjectCache.SetCustomData("DebugLogCollapse", _collapseLogsButton.Checked.ToString())).SetAutoCheck(true).SetChecked(collapse).LinkTooltip("Collapses similar logs.");
_pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
_clearOnPlayButton = (ToolStripButton)toolstrip.AddButton("Clear on Play", () =>
{
editor.Options.Options.Interface.DebugLogClearOnPlay = _clearOnPlayButton.Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Clears all log entries on enter playmode");
_collapseLogsButton = (ToolStripButton)toolstrip.AddButton("Collapse", () =>
{
editor.Options.Options.Interface.DebugLogCollapse = _collapseLogsButton.Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Collapses similar logs.");
_pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error", () =>
{
editor.Options.Options.Interface.DebugLogPauseOnError = _pauseOnErrorButton.Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
toolstrip.AddSeparator();
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides error messages");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides warning messages");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked)).SetAutoCheck(true).SetChecked(true).LinkTooltip("Shows/hides info messages");
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () =>
{
UpdateLogTypeVisibility(LogGroup.Error, _groupButtons[0].Checked);
editor.Options.Options.Interface.DebugLogShowErrorMessages = _groupButtons[0].Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Shows/hides error messages");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () =>
{
UpdateLogTypeVisibility(LogGroup.Warning, _groupButtons[1].Checked);
editor.Options.Options.Interface.DebugLogShowWarningMessages = _groupButtons[1].Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Shows/hides warning messages");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () =>
{
UpdateLogTypeVisibility(LogGroup.Info, _groupButtons[2].Checked);
editor.Options.Options.Interface.DebugLogShowInfoMessages = _groupButtons[2].Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Shows/hides info messages");
UpdateCount();
OnEditorOptionsChanged(Editor.Options.Options);
// Split panel
_split = new SplitPanel(Orientation.Vertical, ScrollBars.Vertical, ScrollBars.Both)
@@ -383,6 +407,12 @@ namespace FlaxEditor.Windows
private void OnEditorOptionsChanged(EditorOptions options)
{
_timestampsFormats = options.Interface.DebugLogTimestampsFormat;
_clearOnPlayButton.Checked = options.Interface.DebugLogClearOnPlay;
_collapseLogsButton.Checked = options.Interface.DebugLogCollapse;
_pauseOnErrorButton.Checked = options.Interface.DebugLogPauseOnError;
_groupButtons[0].Checked = options.Interface.DebugLogShowErrorMessages;
_groupButtons[1].Checked = options.Interface.DebugLogShowWarningMessages;
_groupButtons[2].Checked = options.Interface.DebugLogShowInfoMessages;
}
/// <summary>
+13 -1
View File
@@ -162,7 +162,7 @@ namespace FlaxEditor.Windows
Editor.Options.Apply(_options);
ClearDirtyFlag();
GatherData();
}
private void SetupCustomTabs()
@@ -234,6 +234,18 @@ namespace FlaxEditor.Windows
base.OnDestroy();
}
/// <inheritdoc />
protected override void OnShow()
{
if (!_isDataDirty)
{
// Refresh the data, skip when data is modified during window docking
GatherData();
}
base.OnShow();
}
/// <inheritdoc />
protected override bool OnClosing(ClosingReason reason)
{
+1 -1
View File
@@ -212,7 +212,7 @@ bool BehaviorKnowledge::HasGoal(ScriptingTypeHandle type) const
return false;
}
Variant BehaviorKnowledge::GetGoal(ScriptingTypeHandle type)
const Variant& BehaviorKnowledge::GetGoal(ScriptingTypeHandle type) const
{
for (const Variant& goal : Goals)
{
+1 -1
View File
@@ -101,7 +101,7 @@ public:
/// </summary>
/// <param name="type">The goal type.</param>
/// <returns>The goal value or null if not found.</returns>
API_FUNCTION() Variant GetGoal(ScriptingTypeHandle type);
API_FUNCTION() const Variant& GetGoal(ScriptingTypeHandle type) const;
/// <summary>
/// Adds the goal to the knowledge. If goal of that type already exists then it's value is updated.
+1 -1
View File
@@ -124,7 +124,7 @@ void GameplayGlobals::SetDefaultValues(const Dictionary<String, Variant>& values
}
}
Variant GameplayGlobals::GetValue(const StringView& name) const
const Variant& GameplayGlobals::GetValue(const StringView& name) const
{
ScopeLock lock(Locker);
auto e = Variables.TryGet(name);
+1 -1
View File
@@ -66,7 +66,7 @@ public:
/// </summary>
/// <param name="name">The variable name.</param>
/// <returns>The value.</returns>
API_FUNCTION() Variant GetValue(const StringView& name) const;
API_FUNCTION() const Variant& GetValue(const StringView& name) const;
/// <summary>
/// Sets the value of the global variable (it must be added first).
+2 -2
View File
@@ -273,7 +273,7 @@ AnimGraphParameter* AnimatedModel::GetParameter(const StringView& name)
return nullptr;
}
Variant AnimatedModel::GetParameterValue(const StringView& name)
const Variant& AnimatedModel::GetParameterValue(const StringView& name) const
{
CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(Variant::Null);
for (auto& param : GraphInstance.Parameters)
@@ -299,7 +299,7 @@ void AnimatedModel::SetParameterValue(const StringView& name, const Variant& val
LOG(Warning, "Failed to set animated model '{0}' missing parameter '{1}'", ToString(), name);
}
Variant AnimatedModel::GetParameterValue(const Guid& id)
const Variant& AnimatedModel::GetParameterValue(const Guid& id) const
{
CHECK_ANIM_GRAPH_PARAM_ACCESS_RESULT(Variant::Null);
for (auto& param : GraphInstance.Parameters)
+2 -2
View File
@@ -308,7 +308,7 @@ public:
/// </summary>
/// <param name="name">The parameter name.</param>
/// <returns>The value.</returns>
API_FUNCTION() Variant GetParameterValue(const StringView& name);
API_FUNCTION() const Variant& GetParameterValue(const StringView& name) const;
/// <summary>
/// Sets the anim graph instance parameter value.
@@ -322,7 +322,7 @@ public:
/// </summary>
/// <param name="id">The parameter id.</param>
/// <returns>The value.</returns>
API_FUNCTION() Variant GetParameterValue(const Guid& id);
API_FUNCTION() const Variant& GetParameterValue(const Guid& id) const;
/// <summary>
/// Sets the anim graph instance parameter value.
+3 -3
View File
@@ -91,14 +91,14 @@ Variant ParticleEffectParameter::GetDefaultValue() const
return paramValue;
}
Variant ParticleEffectParameter::GetDefaultEmitterValue() const
const Variant& ParticleEffectParameter::GetDefaultEmitterValue() const
{
CHECK_RETURN(IsValid(), Variant::False);
const ParticleSystemParameter& param = _effect->ParticleSystem->Emitters[_emitterIndex]->Graph.Parameters[_paramIndex];
return param.Value;
}
Variant ParticleEffectParameter::GetValue() const
const Variant& ParticleEffectParameter::GetValue() const
{
CHECK_RETURN(IsValid(), Variant::False);
const Variant& paramValue = _effect->Instance.Emitters[_emitterIndex].Parameters[_paramIndex];
@@ -205,7 +205,7 @@ ParticleEffectParameter* ParticleEffect::GetParameter(const StringView& emitterT
return nullptr;
}
Variant ParticleEffect::GetParameterValue(const StringView& emitterTrackName, const StringView& paramName)
const Variant& ParticleEffect::GetParameterValue(const StringView& emitterTrackName, const StringView& paramName)
{
const auto param = GetParameter(emitterTrackName, paramName);
CHECK_RETURN(param, Variant::Null);
+3 -3
View File
@@ -109,13 +109,13 @@ public:
/// Gets the default value of the parameter (set in particle emitter asset).
/// </summary>
/// <returns>The default value.</returns>
API_PROPERTY() Variant GetDefaultEmitterValue() const;
API_PROPERTY() const Variant& GetDefaultEmitterValue() const;
/// <summary>
/// Gets the value of the parameter.
/// </summary>
/// <returns>The value.</returns>
API_PROPERTY() Variant GetValue() const;
API_PROPERTY() const Variant& GetValue() const;
/// <summary>
/// Sets the value of the parameter.
@@ -293,7 +293,7 @@ public:
/// <param name="emitterTrackName">The emitter track name (in particle system asset).</param>
/// <param name="paramName">The emitter parameter name (in particle emitter asset).</param>
/// <returns>The value.</returns>
API_FUNCTION() Variant GetParameterValue(const StringView& emitterTrackName, const StringView& paramName);
API_FUNCTION() const Variant& GetParameterValue(const StringView& emitterTrackName, const StringView& paramName);
/// <summary>
/// Set the particle parameter value.
@@ -778,7 +778,16 @@ void WindowsWindow::UpdateCursor()
if (!_lastCursorHidden)
{
_lastCursorHidden = true;
::ShowCursor(FALSE);
while(::ShowCursor(FALSE) >= 0)
{
if (_cursorHiddenSafetyCount >= 100)
{
LOG(Warning, "Cursor has failed to hide.");
break;
}
_cursorHiddenSafetyCount += 1;
}
_cursorHiddenSafetyCount = 0;
}
::SetCursor(nullptr);
return;
@@ -786,7 +795,16 @@ void WindowsWindow::UpdateCursor()
else if (_lastCursorHidden)
{
_lastCursorHidden = false;
::ShowCursor(TRUE);
while(::ShowCursor(TRUE) < 0)
{
if (_cursorHiddenSafetyCount >= 100)
{
LOG(Warning, "Cursor has failed to show.");
break;
}
_cursorHiddenSafetyCount += 1;
}
_cursorHiddenSafetyCount = 0;
}
int32 index = 0;
@@ -29,6 +29,7 @@ private:
bool _trackingMouse = false;
bool _clipCursorSet = false;
bool _lastCursorHidden = false;
int _cursorHiddenSafetyCount = 0;
bool _isDuringMaximize = false;
Windows::HANDLE _monitor = nullptr;
Windows::LONG _clipCursorRect[4];
@@ -306,7 +306,7 @@ HRESULT LoadFromEXRFile(const StringView& path, DirectX::ScratchImage& image)
LOG_STR(Warning, String(err));
FreeEXRErrorMessage(err);
}
return S_FALSE;
return E_FAIL;
}
// Setup image
@@ -326,7 +326,7 @@ HRESULT LoadFromEXRFile(const StringView& path, DirectX::ScratchImage& image)
return result;
#else
LOG(Warning, "EXR format is not supported.");
return S_FALSE;
return E_FAIL;
#endif
}
+2
View File
@@ -100,6 +100,7 @@ namespace FlaxEngine.GUI
if (value > _maximum)
throw new ArgumentOutOfRangeException();
_minimum = value;
UpdateThumb();
if (Value < _minimum)
Value = _minimum;
}
@@ -116,6 +117,7 @@ namespace FlaxEngine.GUI
if (value < _minimum)
throw new ArgumentOutOfRangeException();
_maximum = value;
UpdateThumb();
if (Value > _maximum)
Value = _maximum;
}