godot-accessibility/addons/accessibility/accessibility.gd

37 lines
907 B
GDScript3
Raw Normal View History

tool
extends EditorPlugin
var Accessible = preload("accessible.gd")
2018-05-28 21:45:13 +00:00
func augment_node(node):
if node is Control:
Accessible.new(node)
func augment_tree(node):
augment_node(node)
for child in node.get_children():
augment_node(child)
2018-05-28 21:45:13 +00:00
func set_initial_screen_focus(screen):
print("Screen ",screen)
var focus
2018-06-07 21:13:55 +00:00
var root = get_tree().root
augment_tree(root)
if screen == "3D":
focus = root.find_node("ToolButton", true, false)
print("Focus ",focus)
focus.grab_click_focus()
focus.grab_focus()
2018-05-28 21:45:13 +00:00
func set_initial_scene_focus(scene):
print("Set focus in scene")
func _enter_tree():
2018-05-28 21:45:13 +00:00
get_tree().connect("node_added", self, "augment_node")
connect("scene_changed", self, "set_initial_scene_focus")
connect("main_screen_changed", self, "set_initial_screen_focus")
func _exit_tree():
# Clean-up of the plugin goes here
pass