Created
June 29, 2021 03:05
-
-
Save me2beats/818feaee3f46cb4a06183eeeb6fdb82c to your computer and use it in GitHub Desktop.
get signal last in frame emitting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# not reusable/ abstraction needed | |
tabcont.connect("tab_changed", self, 'on_signal_tab_changed') | |
connect("tab_changed__last_in_frame", self, "on_tab_changed__last_in_frame") | |
signal tab_changed__last_in_frame | |
var started: = false | |
var result:int | |
func on_signal_tab_changed(tab:int): | |
result = tab | |
if !started: | |
started = true | |
yield(VisualServer, "frame_pre_draw") | |
# yield(get_tree(), "idle_frame") | |
emit_signal('tab_changed__last_in_frame', result) | |
started = false | |
# ensures this is the most recent emitted signal in the frame | |
func on_tab_changed__last_in_frame(tab): | |
printt('tab changed!', tab) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment