Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GraphEdit port valid connections incorrectly checking sides #81600

Merged

Conversation

aaronfranke
Copy link
Member

Minimal reproduction project: GraphEditPortConnectionTest.zip

Screenshot 2023-09-12 at 8 41 35 PM

The project has this code in it to create an asymmetric valid connection type:

func _ready():
	add_valid_connection_type(0, 1)

In the above screenshot, red is type 0 and green is type 1. This code makes it so that a connection from red to green is valid. The expectation is that this will allow to connect the top two GraphNodes, either by dragging from the red output to the green input or the green input to the red output, because we have an output of red and an input of green, and we stated that from red to green is allowed.

However, in the current master, this does not work correctly. In master, the test project will allow you to drag from red to green left to right on top, and from right to left on bottom, and doesn't let you start with green. This behavior is wrong, the only thing that matters is which inputs and outputs may be used together, not where the user started clicking. The fix is to flip the order of the arguments in this ConnectionType constructor (note: this must be the opposite of a similar line of code 20 lines down, in master they are the same which is wrong).

@aaronfranke aaronfranke added this to the 4.2 milestone Sep 13, 2023
@aaronfranke aaronfranke requested a review from a team as a code owner September 13, 2023 02:10
Copy link
Member

@Geometror Geometror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch :)

@YuriSizov YuriSizov merged commit 325ec7f into godotengine:master Sep 14, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@aaronfranke aaronfranke deleted the fix-graph-edit-valid-port-conn-type branch September 14, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants