Cleanup.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Surface
|
||||
{
|
||||
@@ -181,50 +178,10 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public Func<Elements.Box, ScriptType, ScriptType> DependentBoxFilter;
|
||||
|
||||
private NodeElementArchetype[] _elements;
|
||||
/// <summary>
|
||||
/// Array with default elements descriptions.
|
||||
/// </summary>
|
||||
public NodeElementArchetype[] Elements
|
||||
{
|
||||
get
|
||||
{
|
||||
return _elements;
|
||||
}
|
||||
set
|
||||
{
|
||||
_elements = value;
|
||||
|
||||
/*Float2 topLeft = Float2.Zero;
|
||||
Float2 bottomRight = Float2.Zero;
|
||||
List<Float2[]> textRectangles = new List<Float2[]>();
|
||||
|
||||
foreach (NodeElementArchetype nodeElementType in _elements)
|
||||
{
|
||||
bool isInputElement = nodeElementType.Type == NodeElementType.Input;
|
||||
bool isOutputElement = nodeElementType.Type == NodeElementType.Output;
|
||||
if (isInputElement)
|
||||
{
|
||||
// Text will be to the right
|
||||
}
|
||||
|
||||
// In case of negatives.. most likely not needed.
|
||||
topLeft.X = Math.Min(topLeft.X, nodeElementType.Position.X);
|
||||
topLeft.Y = Math.Min(topLeft.Y, nodeElementType.Position.Y);
|
||||
|
||||
bottomRight.X = Math.Max(bottomRight.X, nodeElementType.Position.X + nodeElementType.Size.X);
|
||||
bottomRight.Y = Math.Max(bottomRight.Y, nodeElementType.Position.Y + nodeElementType.Size.Y);
|
||||
}
|
||||
|
||||
float paddingConst = 15;
|
||||
|
||||
float sizeXElements = bottomRight.X - topLeft.X + paddingConst;
|
||||
float sizeYElements = bottomRight.Y - topLeft.Y + paddingConst;
|
||||
float titleSize = Style.Current.FontLarge.MeasureText(Title).X + paddingConst;
|
||||
|
||||
Size = new Float2(Math.Max(sizeXElements, titleSize), sizeYElements);*/
|
||||
}
|
||||
}
|
||||
public NodeElementArchetype[] Elements;
|
||||
|
||||
/// <summary>
|
||||
/// Tries to parse some text and extract the data from it.
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Input,
|
||||
Position = new Float2(
|
||||
Constants.NodeMarginX - Constants.BoxOffsetX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderSize + yLevel * Constants.LayoutOffsetY),
|
||||
Constants.NodeMarginX - Constants.BoxOffsetX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderSize + yLevel * Constants.LayoutOffsetY),
|
||||
Text = text,
|
||||
Single = single,
|
||||
ValueIndex = valueIndex,
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
if (Surface == null)
|
||||
return;
|
||||
Size = CalculateNodeSize(width, height);
|
||||
Size = CalculateNodeSize(width, height);
|
||||
|
||||
// Update boxes on width change
|
||||
//if (!Mathf.NearEqual(prevSize.X, Size.X))
|
||||
@@ -228,8 +228,7 @@ namespace FlaxEditor.Surface
|
||||
var rightWidth = 40.0f;
|
||||
var boxLabelFont = Style.Current.FontSmall;
|
||||
var titleLabelFont = Style.Current.FontLarge;
|
||||
int childrenCount = Children.Count;
|
||||
for (int i = 0; i < childrenCount; i++)
|
||||
for (int i = 0; i < Children.Count; i++)
|
||||
{
|
||||
var child = Children[i];
|
||||
if (child is Panel panel)
|
||||
@@ -342,8 +341,7 @@ namespace FlaxEditor.Surface
|
||||
if (element is Control control)
|
||||
AddChild(control);
|
||||
|
||||
if (!(element is Panel panel))
|
||||
ResizeAuto();
|
||||
ResizeAuto(); // Resize when an element is added to avoid hardcoded sizes.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,8 +13,8 @@ using FlaxEditor.Utilities;
|
||||
using FlaxEngine.Utilities;
|
||||
using FlaxEngine;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.Options;
|
||||
using FlaxEngine.GUI;
|
||||
using FlaxEditor.Options;
|
||||
|
||||
namespace FlaxEditor.Surface
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace FlaxEditor.Surface
|
||||
Float2 pointToRound = point;
|
||||
pointToRound.X = round(pointToRound.X);
|
||||
pointToRound.Y = round(pointToRound.Y);
|
||||
|
||||
|
||||
return pointToRound;
|
||||
}
|
||||
|
||||
|
||||
@@ -597,7 +597,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_propertiesEditor.Select(_properties);
|
||||
|
||||
// Toolstrip
|
||||
SurfaceUtils.VisjectCommonToolstripSetup(editor, _toolstrip, _undo,
|
||||
SurfaceUtils.VisjectCommonToolstripSetup(editor, _toolstrip, _undo,
|
||||
Save, ShowWholeGraph, ToggleGridSnap, InputActions,
|
||||
out _saveButton, out _undoButton, out _redoButton, out _gridSnapButton);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user