Eliminate yield in favor of _process.

This commit is contained in:
Nolan Darilek 2019-12-27 12:46:09 -06:00
parent aea75e961e
commit d6a6609673

View File

@ -494,10 +494,7 @@ var timer
func unfocused(): func unfocused():
print_debug("Unfocused") print_debug("Unfocused")
position_in_children = 0 position_in_children = 0
timer = weakref(node.get_tree().create_timer(1)) timer = node.get_tree().create_timer(1)
yield(timer.get_ref(), "timeout")
if node.is_inside_tree() and not node.get_focus_owner():
node.get_tree().root.warp_mouse(node.rect_global_position)
func click_focused(): func click_focused():
if node.has_focus(): if node.has_focus():
@ -626,7 +623,8 @@ func _init(node):
node.connect("item_selected", self, "tree_item_selected") node.connect("item_selected", self, "tree_item_selected")
node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED) node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED)
func _exit_tree(): func _process(delta):
if timer != null and timer.get_ref(): if timer and timer.time_left <= 0:
timer.get_ref().emit_signal("timeout") if node.is_inside_tree() and not node.get_focus_owner():
timer.get_ref().unreference() node.get_tree().root.warp_mouse(node.rect_global_position)
timer = null