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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -106,7 +106,7 @@ namespace FlaxEditor.Options
[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.")]
public float EditorFPS { get; set; } = 60.0f;
/// <summary>
/// Gets or sets The FPS of the editor when the editor window is not focused. Usually set to lower then the editor FPS.
/// </summary>
@@ -203,7 +203,7 @@ namespace FlaxEditor.Options
[DefaultValue(5), Limit(1)]
[EditorDisplay("Auto Save", "Auto Save Frequency"), EditorOrder(801), Tooltip("The interval between auto saves (in minutes)")]
public int AutoSaveFrequency { get; set; } = 5;
/// <summary>
/// Gets or sets a value indicating the time before the auto save that the popup shows (in seconds).
/// </summary>

View File

@@ -240,7 +240,7 @@ namespace FlaxEditor.Options
private FontReference _titleFont = new FontReference(DefaultFont, 18);
private FontReference _largeFont = new FontReference(DefaultFont, 14);
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);
/// <summary>

View File

@@ -207,26 +207,6 @@ namespace FlaxEditor.Surface.Archetypes
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

View File

@@ -84,6 +84,7 @@ namespace FlaxEditor.Surface.ContextMenu
/// Updates the filter.
/// </summary>
/// <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)
{
Profiler.BeginEvent("VisjectCMGroup.UpdateFilter");
@@ -116,7 +117,7 @@ namespace FlaxEditor.Surface.ContextMenu
Profiler.EndEvent();
}
public void EvaluateVisibilityWithBox(Box selectedBox)
internal void EvaluateVisibilityWithBox(Box selectedBox)
{
if (selectedBox == null)
{

View File

@@ -8,7 +8,6 @@ using FlaxEditor.Surface.Elements;
using FlaxEditor.Utilities;
using FlaxEngine;
using FlaxEngine.GUI;
using FlaxEngine.Utilities;
namespace FlaxEditor.Surface.ContextMenu
{
@@ -165,6 +164,8 @@ namespace FlaxEditor.Surface.ContextMenu
/// Updates the filter.
/// </summary>
/// <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)
{
if (selectedBox != null)