From e78191cc827bb47a878f7d2bdd258bdbde4c7e79 Mon Sep 17 00:00:00 2001 From: Saas Date: Sat, 1 Nov 2025 17:04:58 +0100 Subject: [PATCH 1/6] fix error when clearing vj context menu --- Source/Editor/Surface/ContextMenu/VisjectCM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index 21d0e7470..1b14c8a9f 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -585,7 +585,7 @@ namespace FlaxEditor.Surface.ContextMenu private void UpdateFilters() { - if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes[0] == null) + if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes.Count > 0) { ResetView(); Profiler.EndEvent(); From 1188150163f087daeca203848208790fdf5e7f16 Mon Sep 17 00:00:00 2001 From: Saas Date: Sat, 1 Nov 2025 17:24:10 +0100 Subject: [PATCH 2/6] prevent node formatting tools from moving nodes with NoMove flag --- Source/Editor/Surface/VisjectSurface.Formatting.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Surface/VisjectSurface.Formatting.cs b/Source/Editor/Surface/VisjectSurface.Formatting.cs index e1b9a6777..26d668f64 100644 --- a/Source/Editor/Surface/VisjectSurface.Formatting.cs +++ b/Source/Editor/Surface/VisjectSurface.Formatting.cs @@ -164,7 +164,9 @@ namespace FlaxEditor.Surface /// /// List of nodes. public void StraightenGraphConnections(List nodes) - { + { + nodes = nodes.Where(n => !n.Archetype.Flags.HasFlag(NodeFlags.NoMove)).ToList(); + if (nodes.Count <= 1) return; @@ -350,8 +352,10 @@ namespace FlaxEditor.Surface /// List of nodes. /// Alignemnt type. public void AlignNodes(List nodes, NodeAlignmentType alignmentType) - { - if(nodes.Count <= 1) + { + nodes = nodes.Where(n => !n.Archetype.Flags.HasFlag(NodeFlags.NoMove)).ToList(); + + if (nodes.Count <= 1) return; var undoActions = new List(); @@ -392,6 +396,8 @@ namespace FlaxEditor.Surface /// If false will be done horizontally, if true will be done vertically. public void DistributeNodes(List nodes, bool vertically) { + nodes = nodes.Where(n => !n.Archetype.Flags.HasFlag(NodeFlags.NoMove)).ToList(); + if(nodes.Count <= 1) return; From d13b98b205e5437d473fb8354d703af4c75abdcc Mon Sep 17 00:00:00 2001 From: Saas Date: Sat, 1 Nov 2025 17:55:21 +0100 Subject: [PATCH 3/6] fix Auto Format Nodes to only produce one undo step --- .../Surface/VisjectSurface.Formatting.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Surface/VisjectSurface.Formatting.cs b/Source/Editor/Surface/VisjectSurface.Formatting.cs index 26d668f64..e55a4eb8a 100644 --- a/Source/Editor/Surface/VisjectSurface.Formatting.cs +++ b/Source/Editor/Surface/VisjectSurface.Formatting.cs @@ -39,6 +39,8 @@ namespace FlaxEditor.Surface if (nodes.Count <= 1) return; + List undoActions = new List(); + var nodesToVisit = new HashSet(nodes); // While we haven't formatted every node @@ -73,18 +75,23 @@ namespace FlaxEditor.Surface } } - FormatConnectedGraph(connectedNodes); + undoActions.AddRange(FormatConnectedGraph(connectedNodes)); } + + Undo?.AddAction(new MultiUndoAction(undoActions, "Format nodes")); + MarkAsEdited(false); } /// /// Formats a graph where all nodes are connected. /// /// List of connected nodes. - protected void FormatConnectedGraph(List nodes) + private List FormatConnectedGraph(List nodes) { + List undoActions = new List(); + if (nodes.Count <= 1) - return; + return undoActions; var boundingBox = GetNodesBounds(nodes); @@ -140,7 +147,6 @@ namespace FlaxEditor.Surface } // Set the node positions - var undoActions = new List(); var topRightPosition = endNodes[0].Location; for (int i = 0; i < nodes.Count; i++) { @@ -155,14 +161,14 @@ namespace FlaxEditor.Surface } } - MarkAsEdited(false); - Undo?.AddAction(new MultiUndoAction(undoActions, "Format nodes")); + return undoActions; } /// /// Straightens every connection between nodes in . /// /// List of nodes. + /// List of undo actions. public void StraightenGraphConnections(List nodes) { nodes = nodes.Where(n => !n.Archetype.Flags.HasFlag(NodeFlags.NoMove)).ToList(); From bf3403449d5c2cf9e8b001e6a6c5c9236c5388ba Mon Sep 17 00:00:00 2001 From: Saas Date: Sat, 1 Nov 2025 18:18:18 +0100 Subject: [PATCH 4/6] disable format nodes option when either a) all selected nodes have NoMove or b) clicked on node has NoMove --- Source/Editor/Surface/VisjectSurface.ContextMenu.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs index d8dfb8ad3..ffb1c725a 100644 --- a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs +++ b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs @@ -410,8 +410,11 @@ namespace FlaxEditor.Surface } menu.AddSeparator(); - _cmFormatNodesMenu = menu.AddChildMenu("Format node(s)"); - _cmFormatNodesMenu.Enabled = CanEdit && HasNodesSelection; + bool allNodesNoMove = SelectedNodes.All(n => n.Archetype.Flags.HasFlag(NodeFlags.NoMove)); + bool clickedNodeNoMove = ((SelectedNodes.Count == 1 && controlUnderMouse is SurfaceNode n && n.Archetype.Flags.HasFlag(NodeFlags.NoMove))); + + _cmFormatNodesMenu = menu.AddChildMenu("Format nodes"); + _cmFormatNodesMenu.Enabled = CanEdit && HasNodesSelection && !(allNodesNoMove || clickedNodeNoMove); _cmFormatNodesConnectionButton = _cmFormatNodesMenu.ContextMenu.AddButton("Auto format", Editor.Instance.Options.Options.Input.NodesAutoFormat, () => { FormatGraph(SelectedNodes); }); _cmFormatNodesConnectionButton = _cmFormatNodesMenu.ContextMenu.AddButton("Straighten connections", Editor.Instance.Options.Options.Input.NodesStraightenConnections, () => { StraightenGraphConnections(SelectedNodes); }); From b5b1d84b3f85d1f466b2c461963f699afafd1010 Mon Sep 17 00:00:00 2001 From: Saas Date: Fri, 12 Dec 2025 22:44:13 +0100 Subject: [PATCH 5/6] fix silent crash sometimes occurring when dragging and dropping connections --- Source/Editor/Surface/ContextMenu/VisjectCM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index 1b14c8a9f..f13cb7117 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -585,7 +585,7 @@ namespace FlaxEditor.Surface.ContextMenu private void UpdateFilters() { - if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes.Count > 0) + if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes.Count > 0 && _selectedBoxes[0] == null) { ResetView(); Profiler.EndEvent(); From b19611e3d2626cda2de1e05836d8062b8a28cd1e Mon Sep 17 00:00:00 2001 From: Saas Date: Sat, 7 Feb 2026 19:58:26 +0100 Subject: [PATCH 6/6] steal right fix from Tryibions PR --- Source/Editor/Surface/ContextMenu/VisjectCM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Editor/Surface/ContextMenu/VisjectCM.cs b/Source/Editor/Surface/ContextMenu/VisjectCM.cs index f13cb7117..e1a61fd5f 100644 --- a/Source/Editor/Surface/ContextMenu/VisjectCM.cs +++ b/Source/Editor/Surface/ContextMenu/VisjectCM.cs @@ -585,7 +585,7 @@ namespace FlaxEditor.Surface.ContextMenu private void UpdateFilters() { - if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes.Count > 0 && _selectedBoxes[0] == null) + if (string.IsNullOrEmpty(_searchBox.Text) && _selectedBoxes.Count == 0) { ResetView(); Profiler.EndEvent();