-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Reworked signal system, added support for Callable and Signal #36368
Conversation
I hope we get a documentation example as soon as this lands? |
@Zireael07 I dont think so, gdscript is being reworked a lot the next months, so there wont be doc until the syntax changes are done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -99,6 +99,9 @@ extern void unregister_variant_methods(); | |||
|
|||
void register_core_types() { | |||
|
|||
//consistency check | |||
ERR_FAIL_COND(sizeof(Callable) > 16); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An static_assert
would be better to make it a compiler error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, I thought static assert was C++17 but there is a C++11 version. Can probably do a separate PR later changing a lot of those we have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use it #36385 or discard if you already did, I spend 30 minutes searching, and I didn't found more.
2bc973e
to
b7733bd
Compare
b7733bd
to
b1ff307
Compare
…nal objects and made them default.
b1ff307
to
69c95f4
Compare
The Mono build will need some custom bindings,
Otherwise the rest should build fine now after I've rebased on master and fixed a few missed occurrences of old style |
Thanks! |
method = p_method; | ||
} | ||
Callable::Callable(CallableCustom *p_custom) { | ||
if (p_custom->referenced) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this limitation. Why you can't create two Callable with the same custom? The equality function even try to compare them by pointer.
Both add a more abstract way to access callable and signal data, and both are added to the type system (and Variant).
Signal connections are now made by passing a Callable instead of object and method, this opens the door to a lot more custom and efficient ways to get the callbacks. Likewise, signals can be accessed from variants, and methods are now first class (only as a getter though).
Existing within-engine calls to connect and disconnect were renamed to connect_compat and disconnect_compat, they will eventually be modified to use method pointers for performance (and because they dont require a binding for the method), but this is left for step 2.