No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dialogic.gd 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. tool
  2. extends EditorPlugin
  3. var _editor_view
  4. var _parts_inspector
  5. func _init():
  6. if Engine.editor_hint:
  7. # Make sure the core files exist
  8. DialogicResources.init_dialogic_files()
  9. add_autoload_singleton('DialogicSingleton', "res://addons/dialogic/Other/DialogicSingleton.gd")
  10. func _enter_tree() -> void:
  11. _parts_inspector = load("res://addons/dialogic/Other/inspector_timeline_picker.gd").new()
  12. add_inspector_plugin(_parts_inspector)
  13. _add_custom_editor_view()
  14. get_editor_interface().get_editor_viewport().add_child(_editor_view)
  15. make_visible(false)
  16. _parts_inspector.dialogic_editor_plugin = self
  17. _parts_inspector.dialogic_editor_view = _editor_view
  18. func _ready():
  19. if Engine.editor_hint:
  20. # Force Godot to show the dialogic folder
  21. get_editor_interface().get_resource_filesystem().scan()
  22. func _exit_tree() -> void:
  23. _remove_custom_editor_view()
  24. remove_inspector_plugin(_parts_inspector)
  25. func has_main_screen():
  26. return true
  27. func get_plugin_name():
  28. return "Dialogic"
  29. func make_visible(visible):
  30. if _editor_view:
  31. _editor_view.visible = visible
  32. func get_plugin_icon():
  33. # https://github.com/godotengine/godot-proposals/issues/572
  34. if get_editor_interface().get_editor_settings().get_setting("interface/theme/base_color").v > 0.5:
  35. return preload("res://addons/dialogic/Images/Plugin/plugin-editor-icon-light-theme.svg")
  36. return preload("res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg")
  37. func _add_custom_editor_view():
  38. _editor_view = preload("res://addons/dialogic/Editor/EditorView.tscn").instance()
  39. #_editor_view.plugin_reference = self
  40. func _remove_custom_editor_view():
  41. if _editor_view:
  42. remove_control_from_bottom_panel(_editor_view)
  43. _editor_view.queue_free()