Minor cleanup

This commit is contained in:
Wojtek Figat
2023-10-04 23:21:40 +02:00
parent 469c599a5e
commit 1838c7bba7
12 changed files with 21 additions and 40 deletions

View File

@@ -486,7 +486,7 @@ namespace FlaxEditor.Content
else else
Render2D.FillRectangle(rectangle, Color.Black); Render2D.FillRectangle(rectangle, Color.Black);
} }
/// <summary> /// <summary>
/// Draws the item thumbnail. /// Draws the item thumbnail.
/// </summary> /// </summary>
@@ -684,7 +684,7 @@ namespace FlaxEditor.Content
var thumbnailSize = size.X; var thumbnailSize = size.X;
thumbnailRect = new Rectangle(0, 0, thumbnailSize, thumbnailSize); thumbnailRect = new Rectangle(0, 0, thumbnailSize, thumbnailSize);
nameAlignment = TextAlignment.Center; nameAlignment = TextAlignment.Center;
if (this is ContentFolder) if (this is ContentFolder)
{ {
// Small shadow // Small shadow
@@ -692,7 +692,7 @@ namespace FlaxEditor.Content
var color = Color.Black.AlphaMultiplied(0.2f); var color = Color.Black.AlphaMultiplied(0.2f);
Render2D.FillRectangle(shadowRect, color); Render2D.FillRectangle(shadowRect, color);
Render2D.FillRectangle(clientRect, style.Background.RGBMultiplied(1.25f)); Render2D.FillRectangle(clientRect, style.Background.RGBMultiplied(1.25f));
if (isSelected) if (isSelected)
Render2D.FillRectangle(clientRect, Parent.ContainsFocus ? style.BackgroundSelected : style.LightBackground); Render2D.FillRectangle(clientRect, Parent.ContainsFocus ? style.BackgroundSelected : style.LightBackground);
else if (IsMouseOver) else if (IsMouseOver)
@@ -706,14 +706,14 @@ namespace FlaxEditor.Content
var shadowRect = new Rectangle(2, 2, clientRect.Width + 1, clientRect.Height + 1); var shadowRect = new Rectangle(2, 2, clientRect.Width + 1, clientRect.Height + 1);
var color = Color.Black.AlphaMultiplied(0.2f); var color = Color.Black.AlphaMultiplied(0.2f);
Render2D.FillRectangle(shadowRect, color); Render2D.FillRectangle(shadowRect, color);
Render2D.FillRectangle(clientRect, style.Background.RGBMultiplied(1.25f)); Render2D.FillRectangle(clientRect, style.Background.RGBMultiplied(1.25f));
Render2D.FillRectangle(TextRectangle, style.LightBackground); Render2D.FillRectangle(TextRectangle, style.LightBackground);
var accentHeight = 2 * view.ViewScale; var accentHeight = 2 * view.ViewScale;
var barRect = new Rectangle(0, thumbnailRect.Height - accentHeight, clientRect.Width, accentHeight); var barRect = new Rectangle(0, thumbnailRect.Height - accentHeight, clientRect.Width, accentHeight);
Render2D.FillRectangle(barRect, Color.DimGray); Render2D.FillRectangle(barRect, Color.DimGray);
DrawThumbnail(ref thumbnailRect, false); DrawThumbnail(ref thumbnailRect, false);
if (isSelected) if (isSelected)
{ {
@@ -733,18 +733,18 @@ namespace FlaxEditor.Content
var thumbnailSize = size.Y - 2 * DefaultMarginSize; var thumbnailSize = size.Y - 2 * DefaultMarginSize;
thumbnailRect = new Rectangle(DefaultMarginSize, DefaultMarginSize, thumbnailSize, thumbnailSize); thumbnailRect = new Rectangle(DefaultMarginSize, DefaultMarginSize, thumbnailSize, thumbnailSize);
nameAlignment = TextAlignment.Near; nameAlignment = TextAlignment.Near;
if (isSelected) if (isSelected)
Render2D.FillRectangle(clientRect, Parent.ContainsFocus ? style.BackgroundSelected : style.LightBackground); Render2D.FillRectangle(clientRect, Parent.ContainsFocus ? style.BackgroundSelected : style.LightBackground);
else if (IsMouseOver) else if (IsMouseOver)
Render2D.FillRectangle(clientRect, style.BackgroundHighlighted); Render2D.FillRectangle(clientRect, style.BackgroundHighlighted);
DrawThumbnail(ref thumbnailRect); DrawThumbnail(ref thumbnailRect);
break; break;
} }
default: throw new ArgumentOutOfRangeException(); default: throw new ArgumentOutOfRangeException();
} }
// Draw short name // Draw short name
Render2D.PushClip(ref textRect); Render2D.PushClip(ref textRect);
Render2D.DrawText(style.FontMedium, ShowFileExtension || view.ShowFileExtensions ? FileName : ShortName, textRect, style.Foreground, nameAlignment, TextAlignment.Center, TextWrapping.WrapWords, 1f, 0.95f); Render2D.DrawText(style.FontMedium, ShowFileExtension || view.ShowFileExtensions ? FileName : ShortName, textRect, style.Foreground, nameAlignment, TextAlignment.Center, TextWrapping.WrapWords, 1f, 0.95f);

View File

@@ -20,7 +20,7 @@ public class MissingScriptEditor : GenericEditor
} }
dropPanel.HeaderTextColor = Color.OrangeRed; dropPanel.HeaderTextColor = Color.OrangeRed;
base.Initialize(layout); base.Initialize(layout);
} }
} }

View File

@@ -348,7 +348,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (!CanEditTangent()) if (!CanEditTangent())
return; return;
var index = _lastPointSelected.Index; var index = _lastPointSelected.Index;
var currentTangentInPosition = _selectedSpline.GetSplineLocalTangent(index, true).Translation; var currentTangentInPosition = _selectedSpline.GetSplineLocalTangent(index, true).Translation;
var currentTangentOutPosition = _selectedSpline.GetSplineLocalTangent(index, false).Translation; var currentTangentOutPosition = _selectedSpline.GetSplineLocalTangent(index, false).Translation;

View File

@@ -88,7 +88,7 @@ namespace FlaxEditor.CustomEditors.Editors
LinkValues = Editor.Instance.Windows.PropertiesWin.ScaleLinked; LinkValues = Editor.Instance.Windows.PropertiesWin.ScaleLinked;
// Add button with the link icon // Add button with the link icon
_linkButton = new Button _linkButton = new Button
{ {
BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Link32), BackgroundBrush = new SpriteBrush(Editor.Instance.Icons.Link32),

View File

@@ -160,7 +160,6 @@ namespace FlaxEditor.CustomEditors.Editors
var option = _options[comboBox.SelectedIndex]; var option = _options[comboBox.SelectedIndex];
if (option.Type != null) if (option.Type != null)
value = option.Creator(option.Type); value = option.Creator(option.Type);
} }
SetValue(value); SetValue(value);
RebuildLayoutOnRefresh(); RebuildLayoutOnRefresh();

View File

@@ -634,7 +634,7 @@ namespace FlaxEditor.CustomEditors.Editors
var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText); var textSize = FlaxEngine.GUI.Style.Current.FontMedium.MeasureText(buttonText);
if (textSize.Y > button.Width) if (textSize.Y > button.Width)
button.Width = textSize.Y + 2; button.Width = textSize.Y + 2;
button.SetAnchorPreset(AnchorPresets.MiddleRight, false, true); button.SetAnchorPreset(AnchorPresets.MiddleRight, false, true);
button.Clicked += ShowPicker; button.Clicked += ShowPicker;
} }

View File

@@ -175,7 +175,7 @@ namespace FlaxEditor.CustomEditors.GUI
{ {
// Clear flag // Clear flag
_mouseOverSplitter = false; _mouseOverSplitter = false;
if (_cursorChanged) if (_cursorChanged)
{ {
Cursor = CursorType.Default; Cursor = CursorType.Default;

View File

@@ -106,7 +106,7 @@ namespace FlaxEditor.Options
[DefaultValue(60.0f), Limit(0, 666)] [DefaultValue(60.0f), Limit(0, 666)]
[EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")] [EditorDisplay("General", "Editor FPS"), EditorOrder(110), Tooltip("Limit for the editor draw/update frames per second rate (FPS). Use higher values if you need more responsive interface or lower values to use less device power. Value 0 disables any limits.")]
public float EditorFPS { get; set; } = 60.0f; public float EditorFPS { get; set; } = 60.0f;
/// <summary> /// <summary>
/// Gets or sets The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS. /// Gets or sets The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS.
/// </summary> /// </summary>
@@ -203,7 +203,7 @@ namespace FlaxEditor.Options
[DefaultValue(5), Limit(1)] [DefaultValue(5), Limit(1)]
[EditorDisplay("Auto Save", "Auto Save Frequency"), EditorOrder(801), Tooltip("The interval between auto saves (in minutes)")] [EditorDisplay("Auto Save", "Auto Save Frequency"), EditorOrder(801), Tooltip("The interval between auto saves (in minutes)")]
public int AutoSaveFrequency { get; set; } = 5; public int AutoSaveFrequency { get; set; } = 5;
/// <summary> /// <summary>
/// Gets or sets a value indicating the time before the auto save that the popup shows (in seconds). /// Gets or sets a value indicating the time before the auto save that the popup shows (in seconds).
/// </summary> /// </summary>

View File

@@ -240,7 +240,7 @@ namespace FlaxEditor.Options
private FontReference _titleFont = new FontReference(DefaultFont, 18); private FontReference _titleFont = new FontReference(DefaultFont, 18);
private FontReference _largeFont = new FontReference(DefaultFont, 14); private FontReference _largeFont = new FontReference(DefaultFont, 14);
private FontReference _mediumFont = new FontReference(DefaultFont, 9); private FontReference _mediumFont = new FontReference(DefaultFont, 9);
private FontReference _smallFont= new FontReference(DefaultFont, 9); private FontReference _smallFont = new FontReference(DefaultFont, 9);
private FontReference _outputLogFont = new FontReference(FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont), 10); private FontReference _outputLogFont = new FontReference(FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont), 10);
/// <summary> /// <summary>

View File

@@ -207,26 +207,6 @@ namespace FlaxEditor.Surface.Archetypes
AddElement(box); AddElement(box);
} }
} }
protected static bool IsInputCompatible(NodeArchetype nodeArch, ScriptType outputType, ConnectionsHint hint)
{
// Event based nodes always have a pulse input, so it's always compatible with void
if (outputType.IsVoid)
return true;
var eventName = (string)nodeArch.DefaultValues[1];
var eventType = TypeUtils.GetType((string)nodeArch.DefaultValues[0]);
var member = eventType.GetMember(eventName, MemberTypes.Event, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
if (member && SurfaceUtils.IsValidVisualScriptEvent(member))
{
if (!member.IsStatic)
{
if (VisjectSurface.FullCastCheck(eventType, outputType, hint))
return true;
}
}
return false;
}
} }
private sealed class PackStructureNode : StructureNode private sealed class PackStructureNode : StructureNode

View File

@@ -84,6 +84,7 @@ namespace FlaxEditor.Surface.ContextMenu
/// Updates the filter. /// Updates the filter.
/// </summary> /// </summary>
/// <param name="filterText">The filter text.</param> /// <param name="filterText">The filter text.</param>
/// <param name="selectedBox">The optionally selected box to show hints for it.</param>
public void UpdateFilter(string filterText, Box selectedBox) public void UpdateFilter(string filterText, Box selectedBox)
{ {
Profiler.BeginEvent("VisjectCMGroup.UpdateFilter"); Profiler.BeginEvent("VisjectCMGroup.UpdateFilter");
@@ -116,7 +117,7 @@ namespace FlaxEditor.Surface.ContextMenu
Profiler.EndEvent(); Profiler.EndEvent();
} }
public void EvaluateVisibilityWithBox(Box selectedBox) internal void EvaluateVisibilityWithBox(Box selectedBox)
{ {
if (selectedBox == null) if (selectedBox == null)
{ {

View File

@@ -8,7 +8,6 @@ using FlaxEditor.Surface.Elements;
using FlaxEditor.Utilities; using FlaxEditor.Utilities;
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI; using FlaxEngine.GUI;
using FlaxEngine.Utilities;
namespace FlaxEditor.Surface.ContextMenu namespace FlaxEditor.Surface.ContextMenu
{ {
@@ -165,6 +164,8 @@ namespace FlaxEditor.Surface.ContextMenu
/// Updates the filter. /// Updates the filter.
/// </summary> /// </summary>
/// <param name="filterText">The filter text.</param> /// <param name="filterText">The filter text.</param>
/// <param name="selectedBox">The optionally selected box to show hints for it.</param>
/// <param name="groupHeaderMatches">True if item's group header got a filter match and item should stay visible.</param>
public void UpdateFilter(string filterText, Box selectedBox, bool groupHeaderMatches = false) public void UpdateFilter(string filterText, Box selectedBox, bool groupHeaderMatches = false)
{ {
if (selectedBox != null) if (selectedBox != null)