Visual Scripting - Copy Paste Breaks Script

Richard Gemmell shared this bug 3 years ago
Outdated

Copying and pasting nodes in the Visual Scripting Tool often breaks scripts. This happens so often that I avoid using Copy and Paste altogether. This makes editing scripts even slower.

In this script, I copied and pasted the StringConcat node. The script won't compile. Attempts to edit the script tend to crash VST. For example, clicking on the link between the b input of the second StringConcat node and the Constant node.

If you open the script in VST you can see that the second StringConcat has two inputs and an output that goes nowhere. It didn't look like that before I saved it.

If you look at the node IDs you can see that two of the StringConcat nodes have the same ID: 1499179238. It would appear that paste sometimes gives nodes the same IDs.

The compilation error is:

2020-08-02 18:42:02.996 - Thread: 1 -> Error occured during the graph reconstruction: System.ArgumentException: An item with the same key has already been added.

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

at VRage.Game.VisualScripting.ScriptBuilder.MyVisualScriptNavigator..ctor(MyObjectBuilder_VisualScript scriptOb)

at VRage.Game.VisualScripting.MyVisualScriptBuilder.Load()

2020-08-02 18:42:02.996 - Thread: 1 -> Exception occured: System.ArgumentException: An item with the same key has already been added.

at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)

at VRage.Game.VisualScripting.ScriptBuilder.MyVisualScriptNavigator..ctor(MyObjectBuilder_VisualScript scriptOb)

at VRage.Game.VisualScripting.MyVisualScriptBuilder.Load()

I've attached the buggy script in a ZIP file.

Replies (2)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.

Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department

photo
1

Hey Keen, I was able to reproduce this exact bug. It appears when you attempt to paste the same node(s) twice. Apparently the nodes in the clipboard have always the same IDs when pasting. So the ID is probably set when you press Ctrl+C, not when you press Ctrl+V.

Leave a Comment
 
Attach a file