diff --git a/Source/Editor/Surface/NodeArchetype.cs b/Source/Editor/Surface/NodeArchetype.cs index 4582aa054..b1a36ba0a 100644 --- a/Source/Editor/Surface/NodeArchetype.cs +++ b/Source/Editor/Surface/NodeArchetype.cs @@ -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 /// public Func DependentBoxFilter; - private NodeElementArchetype[] _elements; /// /// Array with default elements descriptions. /// - public NodeElementArchetype[] Elements - { - get - { - return _elements; - } - set - { - _elements = value; - - /*Float2 topLeft = Float2.Zero; - Float2 bottomRight = Float2.Zero; - List textRectangles = new List(); - - 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; /// /// Tries to parse some text and extract the data from it. diff --git a/Source/Editor/Surface/NodeElementArchetype.cs b/Source/Editor/Surface/NodeElementArchetype.cs index 298127c3a..be8b67378 100644 --- a/Source/Editor/Surface/NodeElementArchetype.cs +++ b/Source/Editor/Surface/NodeElementArchetype.cs @@ -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, diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs index 763f82fdb..67fd7a308 100644 --- a/Source/Editor/Surface/SurfaceNode.cs +++ b/Source/Editor/Surface/SurfaceNode.cs @@ -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. } /// diff --git a/Source/Editor/Surface/SurfaceUtils.cs b/Source/Editor/Surface/SurfaceUtils.cs index f5ca394fb..b8563220d 100644 --- a/Source/Editor/Surface/SurfaceUtils.cs +++ b/Source/Editor/Surface/SurfaceUtils.cs @@ -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 { diff --git a/Source/Editor/Surface/VisjectSurface.Input.cs b/Source/Editor/Surface/VisjectSurface.Input.cs index 0b664768d..a250d4df7 100644 --- a/Source/Editor/Surface/VisjectSurface.Input.cs +++ b/Source/Editor/Surface/VisjectSurface.Input.cs @@ -197,7 +197,7 @@ namespace FlaxEditor.Surface Float2 pointToRound = point; pointToRound.X = round(pointToRound.X); pointToRound.Y = round(pointToRound.Y); - + return pointToRound; } diff --git a/Source/Editor/Windows/Assets/VisualScriptWindow.cs b/Source/Editor/Windows/Assets/VisualScriptWindow.cs index 3b6480063..075c127d4 100644 --- a/Source/Editor/Windows/Assets/VisualScriptWindow.cs +++ b/Source/Editor/Windows/Assets/VisualScriptWindow.cs @@ -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);