2018-05-26 11:34:15 +00:00
|
|
|
tool
|
|
|
|
extends EditorPlugin
|
|
|
|
|
2018-05-28 16:48:02 +00:00
|
|
|
var Accessible = preload("accessible.gd")
|
2018-05-26 14:47:18 +00:00
|
|
|
|
|
|
|
func _augment_node(node):
|
|
|
|
if node is Control:
|
2018-05-28 16:48:02 +00:00
|
|
|
Accessible.new(node)
|
2018-05-26 14:47:18 +00:00
|
|
|
|
2018-05-28 19:22:09 +00:00
|
|
|
func _set_initial_screen_focus(screen):
|
|
|
|
var focus
|
|
|
|
var root = self
|
|
|
|
while root.get_parent() != null:
|
|
|
|
root = root.get_parent()
|
|
|
|
if screen == "3D":
|
|
|
|
focus = root.find_node("LineEdit", true, false)
|
|
|
|
print("Focus ",focus)
|
|
|
|
focus.grab_focus()
|
|
|
|
|
|
|
|
func _set_initial_scene_focus(scene):
|
|
|
|
print("Set focus in scene")
|
|
|
|
|
2018-05-26 11:34:15 +00:00
|
|
|
func _enter_tree():
|
2018-05-26 14:47:18 +00:00
|
|
|
get_tree().connect("node_added", self, "_augment_node")
|
2018-05-28 19:22:09 +00:00
|
|
|
connect("scene_changed", self, "_set_initial_scene_focus")
|
|
|
|
connect("main_screen_changed", self, "_set_initial_screen_focus")
|
2018-05-26 11:34:15 +00:00
|
|
|
|
|
|
|
func _exit_tree():
|
|
|
|
# Clean-up of the plugin goes here
|
|
|
|
pass
|