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

Add function to get number of port connections in GraphNode #10942

Closed
JekSun97 opened this issue Oct 10, 2024 · 0 comments · Fixed by godotengine/godot#99564
Closed

Add function to get number of port connections in GraphNode #10942

JekSun97 opened this issue Oct 10, 2024 · 0 comments · Fixed by godotengine/godot#99564
Milestone

Comments

@JekSun97
Copy link

JekSun97 commented Oct 10, 2024

Describe the project you are working on

Plugin based on GraphEdit

Describe the problem or limitation you are having in your project

I'm trying to limit the number of connections for an input port in a GraphNode node, so that we can only make one connection to one port, and not several, I tried to implement this using is_node_connected(from_node,from_port,to_node,to_port), but we have to enter extra arguments of the first node, without them the function will not work correctly, especially since I would like to know if the port is connected to anything at all, and not to a specific node

Describe the feature / enhancement and how it helps to overcome the problem or limitation

There is no function that would determine whether a port is connected to something (true/false), or it would be possible to return the number of connections of a certain GraphNode and one of its ports, using a new function

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The new function would return the number of connections of one of the ports:
connections_count(node: StringName, port: int)

If this enhancement will not be used often, can it be worked around with a few lines of script?

At the moment, to find out the number of connections, we will have to use more complex methods, which is difficult especially for beginners, this function would be very useful

Is there a reason why this should be core and not an add-on in the asset library?

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants