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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. func _ready():
  17. if Engine.editor_hint:
  18. # Force Godot to show the dialogic folder
  19. get_editor_interface().get_resource_filesystem().scan()
  20. func _exit_tree() -> void:
  21. _remove_custom_editor_view()
  22. remove_inspector_plugin(_parts_inspector)
  23. func has_main_screen():
  24. return true
  25. func get_plugin_name():
  26. return "Dialogic"
  27. func make_visible(visible):
  28. if _editor_view:
  29. _editor_view.visible = visible
  30. func get_plugin_icon():
  31. # https://github.com/godotengine/godot-proposals/issues/572
  32. if get_editor_interface().get_editor_settings().get_setting("interface/theme/base_color").v > 0.5:
  33. return preload("res://addons/dialogic/Images/Plugin/plugin-editor-icon-light-theme.svg")
  34. return preload("res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg")
  35. func _add_custom_editor_view():
  36. _editor_view = preload("res://addons/dialogic/Editor/EditorView.tscn").instance()
  37. #_editor_view.plugin_reference = self
  38. func _remove_custom_editor_view():
  39. if _editor_view:
  40. remove_control_from_bottom_panel(_editor_view)
  41. _editor_view.queue_free()