Big refactor: Fix plugin issues when disabling/reenabling plugins (#598)
Co-authored-by: balloonpopper <5151242+balloonpopper@users.noreply.github.com> Co-authored-by: Duncan Brown <duncan@prometheussoftware.ca>
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
# Plugin script to initialize Escoria simple mouse UI
|
||||
# Plugin script to initialize Escoria 9-verbs with keyboard plugin
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
# Register UI
|
||||
func _enter_tree() -> void:
|
||||
call_deferred("_register")
|
||||
# Override function to return the plugin name.
|
||||
func get_plugin_name():
|
||||
return "escoria-ui-keyboard-9verbs"
|
||||
|
||||
|
||||
# Deregister UI
|
||||
func _exit_tree() -> void:
|
||||
escoria.deregister_ui("res://addons/escoria-ui-keyboard-9verbs/game.tscn")
|
||||
func disable_plugin() -> void:
|
||||
print("Disabling plugin Escoria UI 9-verbs with keyboard.")
|
||||
EscoriaPlugin.deregister_ui("res://addons/escoria-ui-keyboard-9verbs/game.tscn")
|
||||
|
||||
|
||||
# Register UI with Escoria
|
||||
func _register():
|
||||
escoria.register_ui("res://addons/escoria-ui-keyboard-9verbs/game.tscn")
|
||||
func enable_plugin():
|
||||
print("Enabling plugin Escoria UI 9-verbs with keyboard.")
|
||||
if not EscoriaPlugin.register_ui(self, "res://addons/escoria-ui-keyboard-9verbs/game.tscn"):
|
||||
get_editor_interface().set_plugin_enabled(
|
||||
get_plugin_name(),
|
||||
false
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user