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

Godot 4.0: Connect is completely different now #383

Closed
bitwes opened this issue Aug 3, 2022 · 4 comments
Closed

Godot 4.0: Connect is completely different now #383

bitwes opened this issue Aug 3, 2022 · 4 comments
Labels
Godot 4.0 Issues related to Godot 4.0

Comments

@bitwes
Copy link
Owner

bitwes commented Aug 3, 2022

Connect is different now. Here's some stuff. https://godotengine.org/article/core-refactoring-progress-report-1

You now pass the callback function. That's cool, might stink to port.

@bitwes bitwes added the Godot 4.0 Issues related to Godot 4.0 label Aug 3, 2022
@bitwes
Copy link
Owner Author

bitwes commented Aug 3, 2022

set_yield_signal_or_time will have to take in a method instead of an object and a string.

gut.gd

func set_yield_signal_or_time(obj, signal_name, max_wait, text=''):
    obj.connect(signal_name, self, '_yielding_callback', [true])
    _yielding_to.obj = obj
    _yielding_to.signal_name = signal_name

    _yield_timer.set_wait_time(max_wait)
    _yield_timer.start()
    _was_yield_method_called = true
    _lgr.yield_msg(str('-- Yielding to signal "', signal_name, '" or for ', max_wait, ' seconds -- ', text))
    return self

@bitwes
Copy link
Owner Author

bitwes commented Aug 3, 2022

Found this, should be helpful. This appears to be how you would do a connect the 3.4 way (with a string). This was seen in bitbrain's 4.0 conversion PR. It might not be completely right, since it's doing obj.connect, but Callable is key part.

obj.connect(name,Callable(self,'_on_watched_signal'),[obj,name])

@bitwes
Copy link
Owner Author

bitwes commented Aug 15, 2022

To pass parameters to a method when connecting you must use bind on the method.

obj.connect('signal_name', my_method.bind(1, 2, 'c'))

@bitwes
Copy link
Owner Author

bitwes commented Feb 23, 2023

This has been addressed everywhere it needs to be.

@bitwes bitwes closed this as completed Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Godot 4.0 Issues related to Godot 4.0
Projects
None yet
Development

No branches or pull requests

1 participant