Create a reroute node on a connection, optionally using command pattern.
(self, connection, position, use_command=True)
| 661 | return True |
| 662 | |
| 663 | def create_reroute_node_on_connection(self, connection, position, use_command=True): |
| 664 | """Create a reroute node on a connection, optionally using command pattern.""" |
| 665 | if use_command: |
| 666 | # Use command pattern |
| 667 | command = CreateRerouteNodeCommand(self, connection, position) |
| 668 | success = self.execute_command(command) |
| 669 | if success: |
| 670 | return command.reroute_node # Return the created node |
| 671 | else: |
| 672 | return None |
| 673 | else: |
| 674 | # Direct creation (for internal use) |
| 675 | start_pin, end_pin = connection.start_pin, connection.end_pin |
| 676 | self.remove_connection(connection, use_command=False) |
| 677 | reroute_node = self.create_node("", pos=(position.x(), position.y()), is_reroute=True, use_command=False) |
| 678 | self.create_connection(start_pin, reroute_node.input_pin, use_command=False) |
| 679 | self.create_connection(reroute_node.output_pin, end_pin, use_command=False) |
| 680 | return reroute_node |
| 681 | |
| 682 | def start_drag_connection(self, start_pin): |
| 683 | self._drag_start_pin = start_pin |