Merge remote-tracking branch 'origin/master' into sdl_platform

This commit is contained in:
2025-08-24 09:44:28 +03:00
99 changed files with 1300 additions and 1136 deletions

View File

@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Xml;
@@ -471,7 +470,7 @@ namespace FlaxEditor.Windows.Assets
private void OnOverrideMethodClicked()
{
var cm = new ContextMenu();
var cm = new ItemsListContextMenu(235);
var window = (VisualScriptWindow)Values[0];
var scriptMeta = window.Asset.Meta;
var baseType = TypeUtils.GetType(scriptMeta.BaseTypename);
@@ -499,27 +498,39 @@ namespace FlaxEditor.Windows.Assets
if (isAlreadyAdded)
continue;
var cmButton = cm.AddButton($"{name} (in {member.DeclaringType.Name})");
cmButton.TooltipText = Editor.Instance.CodeDocs.GetTooltip(member);
cmButton.Clicked += () =>
var item = new ItemsListContextMenu.Item
{
var surface = ((VisualScriptWindow)Values[0]).Surface;
var surfaceBounds = surface.AllNodesBounds;
surface.ShowArea(new Rectangle(surfaceBounds.BottomLeft, new Float2(200, 150)).MakeExpanded(400.0f));
var node = surface.Context.SpawnNode(16, 3, surfaceBounds.BottomLeft + new Float2(0, 50), new object[]
{
name,
parameters.Length,
Utils.GetEmptyArray<byte>()
});
surface.Select(node);
Name = $"{name} (in {member.DeclaringType.Name})",
TooltipText = Editor.Instance.CodeDocs.GetTooltip(member),
Tag = new object[] { name, parameters.Length, Utils.GetEmptyArray<byte>() },
// Do some basic sorting based on if the method is defined directly in the script base class
SortScore = member.DeclaringType == member.Type.ReflectedType ? 1 : 0,
};
cm.AddItem(item);
}
}
if (!cm.Items.Any())
cm.ItemClicked += (item) =>
{
cm.AddButton("Nothing to override");
var surface = ((VisualScriptWindow)Values[0]).Surface;
var surfaceBounds = surface.AllNodesBounds;
surface.ShowArea(new Rectangle(surfaceBounds.BottomLeft, new Float2(200, 150)).MakeExpanded(400.0f));
var node = surface.Context.SpawnNode(16, 3, surfaceBounds.BottomLeft + new Float2(0, 50), item.Tag as object[]);
surface.Select(node);
};
if (cm.ItemsPanel.ChildrenCount == 0)
{
var item = new ItemsListContextMenu.Item
{
Name = "Nothing to override"
};
item.Enabled = false;
cm.AddItem(item);
}
cm.SortItems();
cm.Show(_overrideButton, new Float2(0, _overrideButton.Height));
}
}

View File

@@ -335,12 +335,12 @@ namespace FlaxEditor.Windows
{
Parent = this,
};
toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries.");
_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");
}).SetAutoCheck(true).LinkTooltip("Clears all log entries on enter playmode.");
_collapseLogsButton = (ToolStripButton)toolstrip.AddButton("Collapse", () =>
{
editor.Options.Options.Interface.DebugLogCollapse = _collapseLogsButton.Checked;
@@ -350,14 +350,14 @@ namespace FlaxEditor.Windows
{
editor.Options.Options.Interface.DebugLogPauseOnError = _pauseOnErrorButton.Checked;
editor.Options.Apply(editor.Options.Options);
}).SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
}).SetAutoCheck(true).LinkTooltip("Performs auto pause on error.");
toolstrip.AddSeparator();
_groupButtons[0] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Error32, () => { OnGroupButtonPressed(0); })
.SetAutoCheck(true).LinkTooltip("Shows/hides error messages");
.SetAutoCheck(true).LinkTooltip("Shows/hides error messages.");
_groupButtons[1] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Warning32, () => { OnGroupButtonPressed(1); })
.SetAutoCheck(true).LinkTooltip("Shows/hides warning messages");
.SetAutoCheck(true).LinkTooltip("Shows/hides warning messages.");
_groupButtons[2] = (ToolStripButton)toolstrip.AddButton(editor.Icons.Info32, () => { OnGroupButtonPressed(2); })
.SetAutoCheck(true).LinkTooltip("Shows/hides info messages");
.SetAutoCheck(true).LinkTooltip("Shows/hides info messages.");
UpdateCount();
// Split panel
@@ -495,6 +495,7 @@ namespace FlaxEditor.Windows
// Pause on Error (we should do it as fast as possible)
if (newEntry.Group == LogGroup.Error && _pauseOnErrorButton.Checked && Editor.StateMachine.CurrentState == Editor.StateMachine.PlayingState)
{
Editor.Log("Pause Play mode on error (toggle this behaviour in the Debug Log panel)");
Editor.Simulation.RequestPausePlay();
}
}

View File

@@ -974,8 +974,9 @@ namespace FlaxEditor.Windows
public void BuildAndRun()
{
Editor.Log("Building and running");
GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration);
GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _);
var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch;
var buildConfig = Editor.Options.Options.Interface.CookAndRunBuildConfiguration;
for (int i = 0; i < numberOfClients; i++)
{
var buildOptions = BuildOptions.AutoRun;
@@ -988,7 +989,7 @@ namespace FlaxEditor.Windows
{
Output = _buildTabProxy.PerPlatformOptions[platform].Output,
Platform = buildPlatform,
Mode = buildConfiguration,
Mode = buildConfig,
},
Options = buildOptions,
});
@@ -1001,8 +1002,9 @@ namespace FlaxEditor.Windows
public void RunCooked()
{
Editor.Log("Running cooked build");
GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration);
GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _);
var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch;
var buildConfig = Editor.Options.Options.Interface.CookAndRunBuildConfiguration;
for (int i = 0; i < numberOfClients; i++)
{
_buildingQueue.Enqueue(new QueueItem
@@ -1011,7 +1013,7 @@ namespace FlaxEditor.Windows
{
Output = _buildTabProxy.PerPlatformOptions[platform].Output,
Platform = buildPlatform,
Mode = buildConfiguration,
Mode = buildConfig,
},
Options = BuildOptions.AutoRun | BuildOptions.NoCook,
});

View File

@@ -63,6 +63,16 @@ namespace FlaxEditor.Windows
},
};
/// <summary>
/// Fired when the game window audio is muted.
/// </summary>
public event Action MuteAudio;
/// <summary>
/// Fired when the game window master audio volume is changed.
/// </summary>
public event Action<float> MasterVolumeChanged;
/// <summary>
/// Gets the viewport.
/// </summary>
@@ -120,6 +130,7 @@ namespace FlaxEditor.Windows
{
Audio.MasterVolume = value ? 0 : AudioVolume;
_audioMuted = value;
MuteAudio?.Invoke();
}
}
@@ -134,6 +145,7 @@ namespace FlaxEditor.Windows
if (!AudioMuted)
Audio.MasterVolume = value;
_audioVolume = value;
MasterVolumeChanged?.Invoke(value);
}
}