Closed beddowdm01 closed 3 years ago
Sorry for the late reply. Thanks, no idea why I added OnAddConnection but no remove equivalent. Just one minor change if possible, for consistency and runtime.
Actually, there are two other things, sorry I didn't see it at first. First, right now the callback will get the parameters switched, since you're calling it on the connections body. Second, both port bodies will want the same notification, so we'd need another line:
this.body.OnRemoveConnection(this, port);
port.body.OnRemoveConnection(port, this);
If in your case the callback should only be received on the one side (e.g. only on output ports), then you can do that by checking the port directions. Other than that there is currently no guaranteed order on which port the connection is removed from.
Yeah, makes sense! Apologies for overlooking that :)
No worries, same for me, thanks for the contribution!
Needed a way to override OnRemoveConnection from a class that inherits from Node like can be done with OnAddConnection. Small change but makes it so much nicer when I need to add functionality when a connection is removed.