-
-
Notifications
You must be signed in to change notification settings - Fork 226
connect_self()
is not available for engine classes
#1112
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
Comments
Invoking methods with If you want to use given instance of an engine declared class in a connection you can just move it into closure, doing something along the lines of: let mut node = Node::new_alloc();
let mut renamed = node.signals().renamed();
renamed.connect(move || godot_print!("{}", node)); Additionally, for now, "base" signals are not available for an user-defined classes, see: #1111 (comment).
Currently connecting obj.clone()
.upcast::<BaseButton>()
.signals()
.pressed()
.connect_obj(&obj, MyObj::method); |
Thank you! I honestly hadn’t thought about this point. When I saw PR#1111, “it’s the exact same API as before” and noticed that
I used a closure, moving let mut gd = self.to_gd();
tween
.signals()
.finished()
.connect(move || gd.set_process(true)); equivalent to tween.tween_callback(
&self
.base_mut()
.callable("set_process")
.bind(&[true.to_variant()]), |
It's a fair point, and I agree it's not intuitive that this one is missing. Generally, signal support is added incrementally, due to the magnitude of the topic:
So please don't assume because a PR was merged, everything should work out of the box 😉 Regarding So, for user-defined signal collections, we might need to duplicate all base signals, or introduce a generic parameter that stores the derived class. For engine-defined classes themselves, let node: Gd<Node> = ...; // actual Node, not derived
node.signals().some_signal().connect(...); |
Uh oh!
There was an error while loading. Please reload this page.
Related to #1111

The text was updated successfully, but these errors were encountered: