Closed aloytag closed 1 year ago
In order to test the port names problem, add this piece of code to the _deserialize()
method in NodeGraph
class definition, just before the return
line:
for node in self.all_nodes():
layout_vert = node.get_property('layout_vert')
if layout_vert is True:
node.set_layout_direction(1)
Then, create a graph with some nodes in a vertical layout. Create a layout_vert
custom property with a True
value in those vertical nodes. Save the graph using the serialize_session()
method and then get it back with deserialize_session()
. You will see that port names are not hidden in vertical nodes.
Closing this issue as release v0.5.5 now has the session serialize the layout direction.
After creating a
graph
(NodeGraph
instance) and saving it withgraph.serialize_session()
, I load it again usinggraph.deserialize_session()
and detect that the vertical nodes are now in horizontal layout.It might be interesting if the node had a property with the configured layout. This way it could be possible to recover the layout direction after serializing and deserializing back. I tried to do it without changing the library code. So in my code I created a function the deserializes the graph, then checks for that property and uses
node.set_layout_direction(1)
when appropriate. It works but, however, port names show in vertical nodes (when it is supposed to be hidden). If I go deeper, I see the I have have to zoom (mouse scroll) before executingnode.set_layout_direction(1)
. This way the node changes to vertical layout direction and port names remain hidden.Regards.