change how connected boxes are drawn
This commit is contained in:
@@ -55,7 +55,7 @@ namespace FlaxEditor.Surface
|
||||
/// <summary>
|
||||
/// The box size (with and height).
|
||||
/// </summary>
|
||||
public const float BoxSize = 12.0f;
|
||||
public const float BoxSize = 13.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The node layout offset on the y axis (height of the boxes rows, etc.). It's used to make the design more consistent.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEditor.Surface.Elements;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.Utilities;
|
||||
|
||||
@@ -228,8 +229,9 @@ namespace FlaxEditor.Surface
|
||||
if (rect.Size.LengthSquared < minBoxSize * minBoxSize)
|
||||
return;
|
||||
|
||||
// Debugging boxes size
|
||||
// Debugging boxes size and bounds
|
||||
//Render2D.DrawRectangle(rect, Color.Orange); return;
|
||||
//Render2D.DrawRectangle(box.Bounds, Color.Green);
|
||||
|
||||
// Draw icon
|
||||
bool hasConnections = box.HasAnyConnection;
|
||||
@@ -244,13 +246,23 @@ namespace FlaxEditor.Surface
|
||||
color *= box.ConnectionsHighlightIntensity + 1;
|
||||
Render2D.DrawSprite(icon, rect, color);
|
||||
|
||||
// Draw connected hint with color from connected output box
|
||||
if (hasConnections && box.Connections[0] is OutputBox connectedOutputBox)
|
||||
{
|
||||
bool connectedSameColor = connectedOutputBox.CurrentTypeColor == box.CurrentTypeColor;
|
||||
Color innerColor = connectedSameColor ? color.RGBMultiplied(0.4f) : connectedOutputBox.CurrentTypeColor;
|
||||
innerColor = innerColor * alpha;
|
||||
Render2D.DrawSprite(icon, rect.MakeExpanded(-5.0f), innerColor);
|
||||
}
|
||||
|
||||
// Draw selection hint
|
||||
if (box.IsSelected)
|
||||
{
|
||||
float outlineAlpha = Mathf.Sin(Time.TimeSinceStartup * 4.0f) * 0.5f + 0.5f;
|
||||
float outlineWidth = Mathf.Lerp(1.5f, 4.0f, outlineAlpha);
|
||||
var outlineRect = new Rectangle(rect.X - outlineWidth, rect.Y - outlineWidth, rect.Width + outlineWidth * 2, rect.Height + outlineWidth * 2);
|
||||
Render2D.DrawSprite(icon, outlineRect, FlaxEngine.GUI.Style.Current.BorderSelected.RGBMultiplied(1.0f + outlineAlpha * 0.4f));
|
||||
Color selectionColor = FlaxEngine.GUI.Style.Current.BorderSelected.RGBMultiplied(1.0f + outlineAlpha * 0.4f);
|
||||
Render2D.DrawSprite(icon, outlineRect, selectionColor.AlphaMultiplied(0.4f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user