2019-09-24 14:01:37 +00:00
|
|
|
tool
|
|
|
|
extends EditorPlugin
|
|
|
|
|
|
|
|
var ScreenReader = preload("ScreenReader.gd")
|
|
|
|
|
|
|
|
var screen_reader
|
|
|
|
|
|
|
|
func _enter_tree():
|
2019-12-21 16:13:06 +00:00
|
|
|
var editor_accessibility_enabled = true
|
2019-12-21 15:54:12 +00:00
|
|
|
var rate = 50
|
|
|
|
var config = ConfigFile.new()
|
|
|
|
var err = config.load("res://.godot-accessibility-editor-settings.ini")
|
|
|
|
if not err:
|
2019-12-21 16:13:06 +00:00
|
|
|
editor_accessibility_enabled = config.get_value("global", "editor_accessibility_enabled", true)
|
2019-12-21 15:54:12 +00:00
|
|
|
rate = config.get_value("speech", "rate", 50)
|
2019-12-21 16:13:06 +00:00
|
|
|
add_autoload_singleton("TTS", "res://addons/godot-tts/TTS.gd")
|
|
|
|
if editor_accessibility_enabled:
|
2019-12-21 15:54:12 +00:00
|
|
|
TTS.call_deferred("set_rate", rate)
|
|
|
|
screen_reader = ScreenReader.new()
|
|
|
|
get_tree().root.call_deferred("add_child", screen_reader)
|
|
|
|
call_deferred("connect", "scene_changed", screen_reader, "set_initial_scene_focus")
|
|
|
|
call_deferred("connect", "main_screen_changed", screen_reader, "set_initial_screen_focus")
|
2019-12-21 16:13:06 +00:00
|
|
|
add_custom_type("ScreenReader", "Node", preload("ScreenReader.gd"), null)
|
2019-09-24 14:20:45 +00:00
|
|
|
|
|
|
|
func _exit_tree():
|
|
|
|
remove_custom_type("ScreenReader")
|