- Added editor option to toggle description panel for visual scripting

This commit is contained in:
Nils Hausfeld
2024-06-18 18:51:49 +02:00
parent d74b7fb304
commit 3fd4bb622f
2 changed files with 14 additions and 1 deletions

View File

@@ -368,6 +368,13 @@ namespace FlaxEditor.Options
[EditorDisplay("Visject"), EditorOrder(550)]
public float ConnectionCurvature { get; set; } = 1.0f;
/// <summary>
/// Gets or sets the visject connection curvature.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Visject"), EditorOrder(550)]
public bool VisualScriptingDescriptionPanel { get; set; } = true;
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont);
private static FontAsset ConsoleFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont);

View File

@@ -58,6 +58,7 @@ namespace FlaxEditor.Surface.ContextMenu
// Description panel elements
private readonly bool _useDescriptionPanel;
private bool _descriptionPanelVisible;
private readonly Panel _descriptionPanel;
private readonly Image _descriptionClassImage;
private readonly Label _descriptionSignatureLabel;
@@ -801,7 +802,7 @@ namespace FlaxEditor.Surface.ContextMenu
if(!_useDescriptionPanel)
return;
if (archetype == null)
if (archetype == null || !Editor.Instance.Options.Options.Interface.VisualScriptingDescriptionPanel)
{
HideDescriptionPanel();
return;
@@ -903,6 +904,7 @@ namespace FlaxEditor.Surface.ContextMenu
_descriptionPanel.Height = Mathf.Max(120f, panelHeight);
Height = 400 + _descriptionPanel.Height;
UpdateWindowSize();
_descriptionPanelVisible = true;
Profiler.EndEvent();
}
@@ -945,10 +947,14 @@ namespace FlaxEditor.Surface.ContextMenu
/// </summary>
private void HideDescriptionPanel()
{
if(!_descriptionPanelVisible)
return;
_descriptionInputPanel.RemoveChildren();
_descriptionOutputPanel.RemoveChildren();
Height = 400;
UpdateWindowSize();
_descriptionPanelVisible = false;
}
/// <inheritdoc />