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

Show generated code snippet after the signal connection dialog #3633

Open
JA-Developer opened this issue Dec 4, 2021 · 3 comments
Open

Show generated code snippet after the signal connection dialog #3633

JA-Developer opened this issue Dec 4, 2021 · 3 comments

Comments

@JA-Developer
Copy link

Describe the project you are working on

Hello. I was using VSCode with the Mono version of Godot Engine 3.4. I just created a project, added a button, and tried to connect a signal to it.

Describe the problem or limitation you are having in your project

I found that when I tried to connect a signal to a node using the Godot Editor it didn't work. After some research, I discovered that this is a bug that has not been solved yet. And, it happens in both mono and standard versions of godot.

Take a look at godotengine/godot#41283

There were only two things I could do to solve the problem:

  1. Avoid using an external editor.
  2. Write the function code manually.

The second option is easy to do when the signals have few parameters, but it is a bit annoying when the signals have many parameters because you have to look at the description of the signal to know what parameters the function needs (which is not user friendly), as it's shown in the following picture:

image

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

After a new signal is created from the Godot editor interface, a dialog will be displayed with the code snippet created. I show an example in the following image:

image

I think the only problem with this solution is that people will have to click more when adding a new signal. I don't really think it's a big inconvenience, but, if anyone worries about it, this code snippet can also be displayed in the same window where the user creates the signal.

This will be useful because if no code is generated automatically, users will be able to copy and paste the code snippet into their file.

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

When creating a new signal, users will need to perform the following steps:

  1. Select the signal:

image

  1. Connect the signal:

image

  1. If no code is generated automatically, copy and paste the code snippet:

image

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

I guess users can't solve it using script but it can be solved as I mentioned before, it's not user friendly though.

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

I think this will improve the usability of the editor and temporarily solve the problem I mentioned earlier. So, this should be available to all users, even when they don't have any plugins installed.

@Calinou

This comment was marked as outdated.

@JA-Developer
Copy link
Author

JA-Developer commented Dec 4, 2021

Thanks for the quick reply : D

I posted this idea because it seems to me that it is easier to implement and also gives developers an alternative way to use signals if it fails again in the future. I think this could also be useful if you are using an external editor that godot does not support (although this does not seem very likely). Also, I think it can be implemented in a better way than what I posted here, like putting this information in the same dialog where the signal is connected.

But I really don't know what Godot's development is like, so you're probably right, it's probably not worth it.

@lenscas
Copy link

lenscas commented Nov 11, 2022

I think fixing the original bug is more straightforward at this point. If it's fixed, then this solution doesn't have much of a reason to exist.

I disagree simply based on the amount of languages that people can use with Godot. There is no way that Godot will be able to generate the correct code, at the correct location for every language that has Godot bindings.

A dialog box makes it easy to copy/paste at least the name in those situations while still being quite decent UX for supported languages.

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

No branches or pull requests

4 participants