FlaxEngine / FlaxEngine/FlaxEngine
[Bug]: Editor goes crazy when copy pasting Visject nodes that include a (connected) reroute node
- Dominant language
- C++
- Stars
- 7k
- Forks
- 713
- Avg merge
- 7d 11h
- Merged PRs (30d)
- 19
Description
### Description
When copy pasting Visject nodes that include a reroute node, this will happen:
https://github.com/user-attachments/assets/3703b273-71a3-4154-98d8-1195d8938c88
I think it should just paste the reroute node, but of course without the connection, at least when the reroute target node does not exist in the pasted nodes.
If it exists in the pasted nodes, just normally connect the reroute to the pasted target.
### Steps to reproduce
1. Create two materials, name one "From" and the other "To"
2. In "From", create a node (f.e. a Color node), and then connect that reroute node to another node
3. Double click on the connection to add a reroute node
4. Select the node you added and the reroute node
5. Copy them (f.e. with Ctrl + C)
6. Go into the "To" material and paste them (f.e. with Ctrl + V)
### Version
master branch
### Relevant logs
This will show once once paste:
```shell
[ 00:00:45.250 ]: [Warning] Failed to paste Visject Surface nodes
[ 00:00:45.250 ]: [Warning] Exception: Object reference not set to an instance of an object.
[ 00:00:45.267 ]: [Warning] at FlaxEditor.Surface.Archetypes.Tools.RerouteNode.UpdateBoxes() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Archetypes\Tools.cs:line 1147
at FlaxEditor.Surface.Archetypes.Tools.RerouteNode.ConnectionTick(Box box) in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Archetypes\Tools.cs:line 1139
at FlaxEditor.Surface.Elements.Box.ConnectionTick() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Elements\Box.cs:line 326
at FlaxEditor.Surface.Elements.Box.set_CurrentType(ScriptType value) in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Elements\Box.cs:line 132
at FlaxEditor.Surface.SurfaceNode.UpdateBoxesTypes() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\SurfaceNode.cs:line 516
at FlaxEditor.Surface.SurfaceNode.OnSurfaceLoaded(SurfaceNodeActions action) in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\SurfaceNode.cs:line 915
at FlaxEditor.Surface.Archetypes.Tools.RerouteNode.OnSurfaceLoaded(SurfaceNodeActions action) in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Archetypes\Tools.cs:line 1114
at FlaxEditor.Surface.VisjectSurface.Paste() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\VisjectSurface.CopyPaste.cs:line 428
```
This will spam after pasting:
```shell
[ 00:00:46.148 ]: [Warning] Exception has been thrown during Window.OnDraw. Object reference not set to an instance of an object.
Stack strace:
at FlaxEditor.Surface.Archetypes.Tools.RerouteNode.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\Archetypes\Tools.cs:line 1186
at FlaxEditor.Surface.SurfaceRootControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\SurfaceRootControl.cs:line 82
at FlaxEngine.GUI.ContainerControl.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 811
at FlaxEngine.GUI.ContainerControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 858
at FlaxEditor.Surface.VisjectSurface.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\Surface\VisjectSurface.Draw.cs:line 261
at FlaxEngine.GUI.ScrollableControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ScrollableControl.cs:line 63
at FlaxEngine.GUI.Panel.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\Panels\Panel.cs:line 437
at FlaxEngine.GUI.ContainerControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 844
at FlaxEngine.GUI.SplitPanel.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\Panels\SplitPanel.cs:line 143
at FlaxEngine.GUI.ScrollableControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ScrollableControl.cs:line 63
at FlaxEngine.GUI.Panel.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\Panels\Panel.cs:line 437
at FlaxEngine.GUI.ContainerControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 844
at FlaxEditor.GUI.Docking.DockPanelProxy.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Editor\GUI\Docking\DockPanelProxy.cs:line 218
at FlaxEngine.GUI.ContainerControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 844
at FlaxEngine.GUI.ContainerControl.Draw() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 806
at FlaxEngine.GUI.ContainerControl.DrawChildren() in D:\a\FlaxEngine\FlaxEngine\Source\Engine\UI\GUI\ContainerControl.cs:line 844
at lambda_method673(Closure, Window)
at FlaxEngine.Interop.NativeInterop.Invoker.InvokerNoRet0`1.MarshalAndInvoke(Object delegateContext, ManagedHandle instancePtr, IntPtr paramPtr) in D:\a\FlaxEngine\FlaxEngine\Source\Engine\Engine\NativeInterop.Invoker.cs:line 291
at FlaxEngine.Interop.NativeInterop.InvokeMethod(ManagedHandle instanceHandle, ManagedHandle methodHandle, IntPtr paramPtr, IntPtr exceptionPtr) in D:\a\FlaxEngine\FlaxEngine\Source\Engine\Engine\NativeInterop.Unmanaged.cs:line 724
```
Contributor guide
Assessment
This issue has not been assessed yet.