From 846065007ba9eb94c53fd1355b62f24f6a048d50 Mon Sep 17 00:00:00 2001 From: Zode Date: Mon, 9 Jun 2025 22:49:13 +0300 Subject: [PATCH 1/4] Make visject inputboxes uniform size of 50 pixels --- Source/Editor/Surface/Elements/InputBox.cs | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Editor/Surface/Elements/InputBox.cs b/Source/Editor/Surface/Elements/InputBox.cs index 9861ebacd..e52762298 100644 --- a/Source/Editor/Surface/Elements/InputBox.cs +++ b/Source/Editor/Surface/Elements/InputBox.cs @@ -120,7 +120,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = IntegerValue.Get(box.ParentNode, box.Archetype, box.Value); - var width = 40; + var width = 50; var control = new IntValueBox(value, bounds.X, bounds.Y, width + 12, int.MinValue, int.MaxValue, 0.01f) { Height = bounds.Height, @@ -166,7 +166,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = UnsignedIntegerValue.Get(box.ParentNode, box.Archetype, box.Value); - var width = 40; + var width = 50; var control = new UIntValueBox(value, bounds.X, bounds.Y, width + 12, uint.MinValue, uint.MaxValue, 0.01f) { Height = bounds.Height, @@ -212,7 +212,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = FloatValue.Get(box.ParentNode, box.Archetype, box.Value); - var width = 40; + var width = 50; var control = new FloatValueBox(value, bounds.X, bounds.Y, width + 12, float.MinValue, float.MaxValue, 0.01f) { Height = bounds.Height, @@ -303,7 +303,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 2 - 2, bounds.Height) { ClipChildren = false, @@ -377,7 +377,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 3 - 2, bounds.Height) { ClipChildren = false, @@ -460,7 +460,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 20; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 4 - 2, bounds.Height) { ClipChildren = false, @@ -553,7 +553,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 2 - 2, bounds.Height) { ClipChildren = false, @@ -627,7 +627,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 3 - 2, bounds.Height) { ClipChildren = false, @@ -710,7 +710,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 20; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 4 - 2, bounds.Height) { ClipChildren = false, @@ -803,7 +803,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 2 - 2, bounds.Height) { ClipChildren = false, @@ -877,7 +877,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 30; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 3 - 2, bounds.Height) { ClipChildren = false, @@ -960,7 +960,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box); - var width = 20; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 4 - 2, bounds.Height) { ClipChildren = false, @@ -1053,7 +1053,7 @@ namespace FlaxEditor.Surface.Elements public Control Create(InputBox box, ref Rectangle bounds) { var value = GetValue(box).EulerAngles; - var width = 20; + var width = 50; var control = new ContainerControl(bounds.X, bounds.Y, (width + 2) * 3 - 2, bounds.Height) { ClipChildren = false, From 4bacceb19f5e873d4fb3420ef619cfca64793851 Mon Sep 17 00:00:00 2001 From: Zode Date: Mon, 9 Jun 2025 22:49:30 +0300 Subject: [PATCH 2/4] Make comparisons automatically expand if needed so it contains the inputs --- .../Editor/Surface/Archetypes/Comparisons.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Source/Editor/Surface/Archetypes/Comparisons.cs b/Source/Editor/Surface/Archetypes/Comparisons.cs index bcf0159d2..22adea949 100644 --- a/Source/Editor/Surface/Archetypes/Comparisons.cs +++ b/Source/Editor/Surface/Archetypes/Comparisons.cs @@ -20,6 +20,7 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = id, Title = title, + Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), Description = desc, Flags = NodeFlags.AllGraphs, AlternativeTitles = altTitles, @@ -44,6 +45,28 @@ namespace FlaxEditor.Surface.Archetypes }; } + private class ComparisonNode : SurfaceNode + { + public ComparisonNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) + : base(id, context, nodeArch, groupArch) + { + } + + public override void OnSurfaceLoaded(SurfaceNodeActions action) + { + base.OnSurfaceLoaded(action); + + ResizeAuto(); + } + + public override void ConnectionTick(Box box) + { + base.ConnectionTick(box); + + ResizeAuto(); + } + } + private class SwitchOnEnumNode : SurfaceNode { public SwitchOnEnumNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) @@ -181,6 +204,7 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = 7, Title = "Switch On Bool", + Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), AlternativeTitles = new[] { "if", "switch" }, Description = "Returns one of the input values based on the condition value", Flags = NodeFlags.AllGraphs, From 42ec33bd9ae37ea70db96451eb413c53351a7510 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 1 Apr 2026 16:25:33 +0200 Subject: [PATCH 3/4] Fix auto-sizing nodes with hidden default value fields (eg, comparison node) #3540 --- Source/Editor/Surface/Elements/Box.cs | 8 ++++---- Source/Editor/Surface/SurfaceNode.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Editor/Surface/Elements/Box.cs b/Source/Editor/Surface/Elements/Box.cs index 4c86af041..a110192cf 100644 --- a/Source/Editor/Surface/Elements/Box.cs +++ b/Source/Editor/Surface/Elements/Box.cs @@ -363,10 +363,10 @@ namespace FlaxEditor.Surface.Elements Assert.AreEqual(r1, r2); // Update - ConnectionTick(); - box.ConnectionTick(); OnConnectionsChanged(); box.OnConnectionsChanged(); + ConnectionTick(); + box.ConnectionTick(); Surface?.OnNodesDisconnected(this, box); } @@ -390,10 +390,10 @@ namespace FlaxEditor.Surface.Elements Assert.IsTrue(AreConnected(box)); // Update - ConnectionTick(); - box.ConnectionTick(); OnConnectionsChanged(); box.OnConnectionsChanged(); + ConnectionTick(); + box.ConnectionTick(); Surface?.OnNodesConnected(this, box); } diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs index f1d241485..d28d04e1e 100644 --- a/Source/Editor/Surface/SurfaceNode.cs +++ b/Source/Editor/Surface/SurfaceNode.cs @@ -232,7 +232,7 @@ namespace FlaxEditor.Surface if (child is InputBox inputBox) { var boxWidth = boxLabelFont.MeasureText(inputBox.Text).X + 25; - if (inputBox.DefaultValueEditor != null) + if (inputBox.DefaultValueEditor != null && inputBox.DefaultValueEditor.Visible) boxWidth += inputBox.DefaultValueEditor.Width + 4; leftWidth = Mathf.Max(leftWidth, boxWidth); leftHeight = Mathf.Max(leftHeight, inputBox.Archetype.Position.Y - Constants.NodeMarginY - Constants.NodeHeaderHeight + Constants.BoxRowHeight); From 2d0da37907c9b1104563ce196c97635b27fda273 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 1 Apr 2026 16:26:47 +0200 Subject: [PATCH 4/4] Remove `ComparisonNode` from #3540 that is impl in #3866 --- .../Editor/Surface/Archetypes/Comparisons.cs | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/Source/Editor/Surface/Archetypes/Comparisons.cs b/Source/Editor/Surface/Archetypes/Comparisons.cs index 96a877e32..32baadc1c 100644 --- a/Source/Editor/Surface/Archetypes/Comparisons.cs +++ b/Source/Editor/Surface/Archetypes/Comparisons.cs @@ -20,7 +20,6 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = id, Title = title, - Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), Description = desc, Flags = NodeFlags.AllGraphs, AlternativeTitles = altTitles, @@ -45,28 +44,6 @@ namespace FlaxEditor.Surface.Archetypes }; } - private class ComparisonNode : SurfaceNode - { - public ComparisonNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) - : base(id, context, nodeArch, groupArch) - { - } - - public override void OnSurfaceLoaded(SurfaceNodeActions action) - { - base.OnSurfaceLoaded(action); - - ResizeAuto(); - } - - public override void ConnectionTick(Box box) - { - base.ConnectionTick(box); - - ResizeAuto(); - } - } - private class SwitchOnEnumNode : SurfaceNode { public SwitchOnEnumNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) @@ -204,7 +181,6 @@ namespace FlaxEditor.Surface.Archetypes { TypeID = 7, Title = "Switch On Bool", - Create = (id, context, arch, groupArch) => new ComparisonNode(id, context, arch, groupArch), AlternativeTitles = new[] { "if", "switch" }, Description = "Returns one of the input values based on the condition value", Flags = NodeFlags.AllGraphs,