diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 5bed6341..c3231128 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -1727,8 +1727,12 @@ def _serialize(self, nodes): serial_data['graph']['pipe_style'] = self.pipe_style() # connection constrains. - serial_data['graph']['accept_connection_types'] = self.model.accept_connection_types - serial_data['graph']['reject_connection_types'] = self.model.reject_connection_types + serial_data['graph']['accept_connection_types'] = { + k: list(v) for k, v in self.model.accept_connection_types.items() + } + serial_data['graph']['reject_connection_types'] = { + k: list(v) for k, v in self.model.reject_connection_types.items() + } # serialize nodes. for n in nodes: @@ -1798,9 +1802,13 @@ def _deserialize(self, data, relative_pos=False, pos=None): # connection constrains. elif attr_name == 'accept_connection_types': - self.model.accept_connection_types = attr_value + self.model.accept_connection_types = { + k: set(v) for k, v in attr_value.items() + } elif attr_name == 'reject_connection_types': - self.model.reject_connection_types = attr_value + self.model.reject_connection_types = { + k: set(v) for k, v in attr_value.items() + } # build the nodes. nodes = {} diff --git a/NodeGraphQt/base/model.py b/NodeGraphQt/base/model.py index 8d1e8a37..e5896324 100644 --- a/NodeGraphQt/base/model.py +++ b/NodeGraphQt/base/model.py @@ -245,7 +245,7 @@ def add_port_accept_connection_type( ): """ Convenience function for adding to the "accept_connection_types" dict. - If the node graph model is unavailable yet then we store it to a + If the node graph model is unavailable, yet then we store it to a temp var that gets deleted. Args: