Check node tree ancestry, rather than superclass ancestry, to associate an EditorProperty with its label.

This commit is contained in:
Nolan Darilek 2019-09-09 14:44:10 -05:00
parent 1f5a6a878f
commit 421dcbcf42

View File

@ -30,6 +30,13 @@ func left_click(item := node):
click.pressed = false click.pressed = false
node.get_tree().input_event(click) node.get_tree().input_event(click)
func guess_label():
var parent = node.get_parent()
while parent:
if parent is EditorProperty and parent.label:
return parent.label
parent = parent.get_parent()
func close_key_event_dialog(): func close_key_event_dialog():
node.get_ok().emit_signal("pressed") node.get_ok().emit_signal("pressed")
@ -310,9 +317,9 @@ func tab_container_input(event):
func focused(): func focused():
print("Focus: %s" % node) print("Focus: %s" % node)
tts.stop() tts.stop()
var parent = node.get_parent() var label = guess_label()
if parent is EditorProperty and parent.label: if label:
tts.speak(parent.label, false) tts.speak(label, false)
if node is MenuButton: if node is MenuButton:
menu_button_focus() menu_button_focus()
elif node is AcceptDialog: elif node is AcceptDialog: