Add conditional profiling in Editor (run only when using Profiler window)

This commit is contained in:
Wojtek Figat
2023-09-25 18:34:07 +02:00
parent 216a5e9f92
commit da47088250
6 changed files with 30 additions and 6 deletions

View File

@@ -93,7 +93,7 @@ namespace FlaxEditor.Windows.Profiler
_liveRecordingButton = toolstrip.AddButton(editor.Icons.Play64);
_liveRecordingButton.LinkTooltip("Live profiling events recording");
_liveRecordingButton.AutoCheck = true;
_liveRecordingButton.Clicked += () => _liveRecordingButton.Icon = LiveRecording ? editor.Icons.Stop64 : editor.Icons.Play64;
_liveRecordingButton.Clicked += OnLiveRecordingChanged;
_clearButton = toolstrip.AddButton(editor.Icons.Rotate32, Clear);
_clearButton.LinkTooltip("Clear data");
toolstrip.AddSeparator();
@@ -118,6 +118,12 @@ namespace FlaxEditor.Windows.Profiler
_tabs.SelectedTabChanged += OnSelectedTabChanged;
}
private void OnLiveRecordingChanged()
{
_liveRecordingButton.Icon = LiveRecording ? Editor.Icons.Stop64 : Editor.Icons.Play64;
ProfilingTools.Enabled = LiveRecording;
}
/// <summary>
/// Adds the mode.
/// </summary>