diff --git a/NodeGraphQt/base/node.py b/NodeGraphQt/base/node.py index 0a43a3c9..3a267a2a 100644 --- a/NodeGraphQt/base/node.py +++ b/NodeGraphQt/base/node.py @@ -393,7 +393,7 @@ def set_property(self, name, value, push_undo=True): push_undo (bool): register the command to the undo stack. (default: True) """ - # prevent signals from causing a infinite loop. + # prevent signals from causing an infinite loop. if self.get_property(name) == value: return diff --git a/NodeGraphQt/base/port.py b/NodeGraphQt/base/port.py index 9ff38d36..8ec63a90 100644 --- a/NodeGraphQt/base/port.py +++ b/NodeGraphQt/base/port.py @@ -117,6 +117,11 @@ def set_visible(self, visible=True, push_undo=True): visible (bool): true if visible. push_undo (bool): register the command to the undo stack. (default: True) """ + + # prevent signals from causing an infinite loop. + if visible == self.visible(): + return + undo_cmd = PortVisibleCmd(self, visible) if push_undo: undo_stack = self.node().graph.undo_stack() @@ -165,8 +170,12 @@ def set_locked(self, state=False, connected_ports=True, push_undo=True): state (Bool): port lock state. connected_ports (Bool): apply to lock state to connected ports. push_undo (bool): register the command to the undo stack. (default: True) - """ + + # prevent signals from causing an infinite loop. + if state == self.locked(): + return + graph = self.node().graph undo_stack = graph.undo_stack() if state: @@ -440,7 +449,7 @@ def add_reject_port_type(self, port_name, port_type, node_type): node_type (str): port node type. """ # storing the connection constrain at the graph level instead of the - # port level so we don't serialize the same data for every port + # port level, so we don't serialize the same data for every port # instance. self.node().add_reject_port_type( port=self,