xNode icon indicating copy to clipboard operation
xNode copied to clipboard

feat: NodePortDictionary serialize keys and value lists directly to retain port order.

Open LukeStampfli opened this issue 3 years ago • 0 comments

Changes NodePortDictionary to keep port order. Dictionary does not guarantee order, with the current implementation when adding dynamic ports and then clearing them and adding them again ports will end up being in a different order.

Changes in this PR:

  • NodePortDictionary no longer inherits from Dictionary
  • NodePortDictionary serializes keys and values lists directly instead of rebuilding them from the dictionary.
  • NodePortDictionary.Values/Keys now accesses the value list which is based on insertion order instead of the dictionary values.
  • Removal now technically runs in O(n), but shouldn't be a performance problem here.

LukeStampfli avatar Apr 13 '21 09:04 LukeStampfli