-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Create Signal
type for better autocomplete and compiler errors
#2731
Comments
Signal
type that (maybe) inherits Callable
Signal
type for better autocomplete and compiler errors
Yep, closing. |
I guess I got confused because most places in the c++ codebase still use strings for the signal name, is this just a gdscript thing? |
Indeed, it's only used in GDScript for now. I'm not sure if there are plans to use the Signal type in C++. See also #2152. |
Yes, engine uses strings for that. To make the process a bit more controlled you can use the _curve->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &CurveTexture::_update));
emit_signal(CoreStringNames::get_singleton()->changed); Edit: Though Calinou's proposal would be better. |
Describe the project you are working on
Godot
Describe the problem or limitation you are having in your project
Using strings for signals results in worse compiler errors/autocomplete/refactoring tools
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I think there should be a
Signal
type for signals that (maybe) inheritsCallable
(kind of like C#event
s).Object
would no longer needconnect()
,disconnect()
,emit_signal()
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Here's some of my ideas for how it could look:
GDScript:
C++:
If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
Signals are core
See also: #2557
The text was updated successfully, but these errors were encountered: