Skip to content

Commit 5f9e07d

Browse files
committed
More attempts at cleaning up Plugin Initilization logic
1 parent 6ffb7cc commit 5f9e07d

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

addons/dialogic/plugin.gd

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
extends EditorPlugin
33

44
## Preload the main panel scene
5-
const MainPanel := preload("res://addons/dialogic/Editor/editor_main.tscn")
5+
const MainPanel := preload("uid://de6yhw4r8jqb3")
66
const PLUGIN_NAME := "Dialogic"
77
const PLUGIN_HANDLER_PATH := "res://addons/dialogic/Core/DialogicGameHandler.gd"
8-
const PLUGIN_ICON_PATH := "res://addons/dialogic/Editor/Images/plugin-icon.svg"
8+
const PLUGIN_ICON_PATH := "uid://dybg3l5pwetne"
9+
const PLUGIN_INSPECTOR_PATH := "uid://bok1je25mskp7"
910

1011
## References used by various other scripts to quickly reference these things
1112
var editor_view: Control # the root of the dialogic editor
1213
var inspector_plugin: EditorInspectorPlugin = null
1314

15+
1416
## Initialization
1517
func _init() -> void:
1618
self.name = "DialogicPlugin"
@@ -21,7 +23,6 @@ func _init() -> void:
2123

2224
## Activation & Editor Setup
2325
func _enable_plugin() -> void:
24-
add_autoload_singleton(PLUGIN_NAME, PLUGIN_HANDLER_PATH)
2526
add_dialogic_default_action()
2627

2728

@@ -30,23 +31,19 @@ func _disable_plugin() -> void:
3031

3132

3233
func _enter_tree() -> void:
34+
add_autoload_singleton(PLUGIN_NAME, PLUGIN_HANDLER_PATH)
35+
3336
editor_view = MainPanel.instantiate()
3437
editor_view.plugin_reference = self
3538
EditorInterface.get_editor_main_screen().add_child(editor_view)
36-
get_editor_interface().get_editor_main_screen().add_child(editor_view)
3739
_make_visible(false)
3840

39-
inspector_plugin = load("res://addons/dialogic/Editor/Inspector/inspector_plugin.gd").new()
41+
inspector_plugin = load(PLUGIN_INSPECTOR_PATH).new()
4042
add_inspector_plugin(inspector_plugin)
4143

42-
if not ProjectSettings.has_setting("autoload/"+PLUGIN_NAME):
43-
add_autoload_singleton(PLUGIN_NAME, PLUGIN_HANDLER_PATH)
44-
print("[Dialogic] Dialogic was enabled, but autoload singleton was missing. It was automatically added again.")
45-
4644

4745
func _exit_tree() -> void:
4846
if editor_view:
49-
remove_control_from_bottom_panel(editor_view)
5047
editor_view.queue_free()
5148

5249
if inspector_plugin:

0 commit comments

Comments
 (0)